Skip to content

Commit

Permalink
Sysprep is not supported by default, modify allowed_customization tem…
Browse files Browse the repository at this point in the history
…plates to check for support first.
  • Loading branch information
Daniel Berger committed May 31, 2018
1 parent bf541dd commit 4155045
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,16 @@ def display_name_for_name_description(ci)
ci.description.blank? ? ci.name : "#{ci.name}: #{ci.description}"
end

# Override in provider subclass as needed.
#
def supports_cloud_init?
true
end

# Override in provider subclass as needed.
#
def supports_sysprep?
true
false
end

def set_or_default_hardware_field_values(_vm)
Expand All @@ -81,7 +85,10 @@ def show_customize_fields(fields, _platform)
end

def allowed_customization_templates(options = {})
allowed_cloud_init_customization_templates(options).concat(allowed_sysprep_customization_templates(options))
allowed = []
allowed.concat(allowed_cloud_init_customization_templates(options)) if supports_cloud_init?
allowed.concat(allowed_sysprep_customization_templates(options)) if supports_sysprep?
allowed
end

private
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
it "should retrieve sysprep templates when cloning" do
options = {'key' => 'value' }
allow(sysprep_workflow).to receive(:supports_native_clone?).and_return(true)
allow(sysprep_workflow).to receive(:supports_sysprep?).and_return(true)
allow(sysprep_workflow).to receive(:load_ar_obj).and_return(template)
allow(template).to receive(:platform).and_return('windows')

Expand Down Expand Up @@ -229,7 +230,7 @@

context "#supports_sysprep?" do
it "returns the expected boolean value" do
expect(workflow.supports_sysprep?).to eql(true)
expect(workflow.supports_sysprep?).to eql(false)
end
end
end
Expand Down

0 comments on commit 4155045

Please sign in to comment.