Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
foreman_uuid_boot
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LiU IT - Infrastructure
foreman_uuid_boot
Commits
5f9ba5b5
Verified
Commit
5f9ba5b5
authored
10 months ago
by
Alexander Olofsson
Browse files
Options
Downloads
Patches
Plain Diff
Ensure stored UUIDs are of correct format
parent
1edb5a26
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#129686
passed
10 months ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/models/foreman_uuid_boot/uuidboot_host_facet.rb
+4
-1
4 additions, 1 deletion
app/models/foreman_uuid_boot/uuidboot_host_facet.rb
with
4 additions
and
1 deletion
app/models/foreman_uuid_boot/uuidboot_host_facet.rb
+
4
−
1
View file @
5f9ba5b5
...
...
@@ -4,16 +4,19 @@ module ForemanUuidBoot
class
UuidbootHostFacet
<
ApplicationRecord
include
Facets
::
Base
UUID_REX
=
/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/
.
freeze
def
self
.
populate_fields_from_facts
(
host
,
parser
,
_type
,
_proxy
)
uuid
=
parser
.
facts
.
dig
(
'dmi'
,
'product'
,
'uuid'
)
||
parser
.
facts
[
'uuid'
]
if
uuid
if
uuid
&&
uuid
=~
UUID_REX
facet
=
host
.
uuidboot_facet
||
host
.
build_uuidboot_facet
facet
.
uuid
=
uuid
facet
.
save
if
facet
.
changed?
||
!
facet
.
persisted?
facet
else
host
.
uuidboot_facet
&
.
destroy
host
.
uuidboot_facet
=
nil
nil
end
end
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment