-
Notifications
You must be signed in to change notification settings - Fork 897
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17293 from djberg96/sysprep_templates
Add support for sysprep customization templates
- Loading branch information
Showing
6 changed files
with
80 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
module SysprepTemplateMixin | ||
def allowed_sysprep_customization_templates(_options = {}) | ||
result = [] | ||
return result if (source = load_ar_obj(get_source_vm)).blank? | ||
return result unless source.platform.casecmp('windows').zero? | ||
|
||
customization_template_id = get_value(@values[:customization_template_id]) | ||
@values[:customization_template_script] = nil if customization_template_id.nil? | ||
|
||
result = CustomizationTemplateSysprep.in_region(source.region_number).all.collect do |c| | ||
@values[:customization_template_script] = c.script if c.id == customization_template_id | ||
build_ci_hash_struct(c, %i(name description updated_at)) | ||
end | ||
|
||
result.compact! | ||
@values[:customization_template_script] = nil if result.blank? | ||
result | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
describe CustomizationTemplateSysprep do | ||
context "#default_filename" do | ||
it "should be unattend.xml" do | ||
expect(described_class.new.default_filename).to eq('unattend.xml') | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters