Bug 1956774 - private_ip expected as String, not Boolean when creating a host via the API
Summary: private_ip expected as String, not Boolean when creating a host via the API
Keywords:
Status: POST
Alias: None
Product: Red Hat Satellite
Classification: Red Hat
Component: Compute Resources - Azure
Version: 6.8.0
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: 6.10.0
Assignee: Evgeni Golov
QA Contact: Jitendra Yejare
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-04 11:49 UTC by Evgeni Golov
Modified: 2021-05-10 14:33 UTC (History)
0 users

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Target Upstream Version:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Foreman Issue Tracker 32500 0 Normal New private_ip expected as String, not Boolean when creating a host via the API 2021-05-04 11:49:46 UTC

Description Evgeni Golov 2021-05-04 11:49:44 UTC
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".

Comment 1 Evgeni Golov 2021-05-04 11:49:50 UTC
Created from redmine issue https://projects.theforeman.org/issues/32500

Comment 2 Evgeni Golov 2021-05-04 11:49:52 UTC
Upstream bug assigned to egolov@redhat.com


Note You need to log in before you can comment on or make changes to this bug.