Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
foreman_wds
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_wds
Commits
f462d189
Commit
f462d189
authored
6 years ago
by
Alexander Olofsson
Browse files
Options
Downloads
Patches
Plain Diff
Start stubbing out unattend file generation
parent
fded9829
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/models/wds_server.rb
+24
-9
24 additions, 9 deletions
app/models/wds_server.rb
with
24 additions
and
9 deletions
app/models/wds_server.rb
+
24
−
9
View file @
f462d189
...
...
@@ -102,15 +102,30 @@ class WdsServer < ApplicationRecord
end
def
ensure_unattend
(
host
)
# TODO
# if group
# New-WdsInstallImageGroup -Name ForemanUnattend
# Export-WdsInstallImage -ImageGroup <Group>
# Import-WdsInstallImage -ImageGroup ForemanUnattend
# else
# Copy-WdsInstallImage -ImageGroup <Group> -NewFileName "install-#{clean_mac}.wim" -NewImageName "#{image_name} (#{host.name})"
# end
# Set-WdsInstallImage -ImageGroup <Group | 'ForemanUnattend'> -ImageName #{image_name} -NewDescription "Provisioned install image for #{host.name}" -UnattendFile <Generated file path> -OverwriteUnattend -DisplayOrder 9999
return
# TODO
connection
.
shell
(
:powershell
)
do
|
sh
|
unattend_path
=
''
# TODO: find or specify remoteinstall path as a parameter
unattend_file
=
"
#{
unattend_path
}
\\
#{
host
.
mac
.
tr
':'
,
'_'
}
.xml"
# TODO: render template, send as heredoc
# sh.run("$unattend_render = @'\n#{unattend_template}\n'@")
# sh.run("New-Item -Path '#{unattend_file}' -ItemType 'file' -Value $unattend_render")
if
SETTINGS
[
:wds_unattend_group
]
# New-WdsInstallImageGroup -Name #{SETTINGS[:wds_unattend_group]}
# Export-WdsInstallImage -ImageGroup <Group> ...
# Import-WdsInstallImage -ImageGroup #{SETTINGS[:wds_unattend_group]} -UnattendFile '#{unattend_file}' -OverwriteUnattend ...
else
source_image
=
host
.
wds_facet
.
install_image
target_image
=
ForemanWds
::
WdsInstallImage
.
new
(
wds_server:
self
,
file_name:
"install-
#{
host
.
mac
.
tr
':'
,
'_'
}
.wim"
,
image_group:
source_image
.
image_group
,
image_name:
"
#{
source_image
.
image_name
}
(for
#{
host
.
name
}
)"
)
sh
.
run
(
"Copy-WdsInstallImage -ImageGroup '
#{
source_image
.
image_group
}
' -FileName '
#{
source_image
.
file_name
}
' -ImageName '
#{
source_image
.
image_name
}
' -NewFileName '
#{
target_image
.
file_name
}
' -NewImageName '
#{
target_image
.
image_name
}
'"
)
sh
.
run
(
"Set-WdsInstallImage -ImageGroup '
#{
target_image
.
image_group
}
' -FileName '
#{
target_image
.
file_name
}
' -ImageName '
#{
target_image
.
image_name
}
' -DisplayOrder 99999 -UnattendFile '
#{
unattend_file
}
' -OverwriteUnattend"
)
end
end
end
def
self
.
bootfile_path
(
architecture_name
,
loader
=
:bios
,
boot_type
=
:pxe
)
...
...
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