Merge pull request #8 from puppetlabs/set-hostname

Set hostname for instance during create_vm
This commit is contained in:
Jake Spain 2022-04-15 08:36:08 -04:00 committed by GitHub
commit 65965dd542
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -191,9 +191,13 @@ module Vmpooler
boot: true, boot: true,
initialize_params: Google::Apis::ComputeV1::AttachedDiskInitializeParams.new(init_params) initialize_params: Google::Apis::ComputeV1::AttachedDiskInitializeParams.new(init_params)
) )
append_domain = domain || global_config[:config]['domain']
fqdn = "#{new_vmname}.#{append_domain}" if append_domain
# Assume all pool config is valid i.e. not missing # Assume all pool config is valid i.e. not missing
client = ::Google::Apis::ComputeV1::Instance.new( client = ::Google::Apis::ComputeV1::Instance.new(
name: new_vmname, name: new_vmname,
hostname: fqdn,
machine_type: pool['machine_type'], machine_type: pool['machine_type'],
disks: [disk], disks: [disk],
network_interfaces: [network_interfaces], network_interfaces: [network_interfaces],