Project

General

Profile

Bug #32500

Updated by Evgeni Golov about 3 years ago

I am creating Azure VMs using the API (well, Ansible, but that doesn't matter). 

 I submit the following Interfaces config: 

 <pre> 
           interfaces_attributes: 
             - type: "interface" 
               compute_attributes: 
                 network: default #not foreman-vnet-default 
                 public_ip: Dynamic 
                 private_ip: false 

 </pre> 

 Which yields the following error: 

 <pre> 
 MsRestAzure::AzureOperationError: PrivateIPAddressMissing: Private IP address is required when privateIPAllocationMethod is Static in IP configuration /subscriptions/UUID/resourceGroups/foreman/providers/Microsoft.Network/networkInterfaces/whoa-nic0/ipConfigurations/whoa-nic0. 
 </pre> 

 This is because the code at https://github.com/theforeman/foreman_azure_rm/blob/48c22cb6f4e3845d2faf61be26d3f0eea58b6b70/app/models/concerns/foreman_azure_rm/vm_extensions/managed_vm.rb#L126 reads: 

 <pre> 
 private_ip = (attrs[:private_ip] == 'false') ? false : true 
 </pre> 

 Which makes private_ip only False if the API parameter was a *string* with the value "false".

Back