Skip to content

Commit

Permalink
Add support for custom VMware attributes
Browse files Browse the repository at this point in the history
The VMware API has options for custom attributes. This is often used to
configure IP-Addresses or ssh keys inside of a VM. This code extension
allows users to provide a hash with all required data.
  • Loading branch information
bastelfreak committed May 21, 2024
1 parent e9ab7fc commit ecb831d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/beaker/hypervisor/vcloud.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,22 @@ def enable_root(host)

def create_clone_spec(host)
# Add VM annotation
additionalExtraConfig = if host['extraConfig']
host['extraConfig'].map do |key, value|
{ key: key, value: value }
end
else
[]
end
extraConfig = [{ key: 'guestinfo.hostname', value: host['vmhostname'] }] + additionalExtraConfig
@logger.debug("#{host['vmhostname']}: extraConfig is: #{extraConfig}")
configSpec = RbVmomi::VIM.VirtualMachineConfigSpec(
annotation: 'Base template: ' + host['template'] + "\n" +
'Creation time: ' + Time.now.strftime('%Y-%m-%d %H:%M') + "\n\n" +
'CI build link: ' + (ENV['BUILD_URL'] || 'Deployed independently of CI') +
'department: ' + @options[:department] +
'project: ' + @options[:project],
extraConfig: [
{ key: 'guestinfo.hostname',
value: host['vmhostname'], },
],
extraConfig: extraConfig,
)

# Are we using a customization spec?
Expand Down

0 comments on commit ecb831d

Please sign in to comment.