Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

salt-cloud - IPv6 and IPv4 private_ips - preferred_ip sends False to is_public_ip #39444

Closed
clem-compilatio opened this issue Feb 16, 2017 · 3 comments
Labels
Bug broken, incorrect, or confusing behavior P4 Priority 4 Salt-Cloud severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Milestone

Comments

@clem-compilatio
Copy link
Contributor

clem-compilatio commented Feb 16, 2017

Description of Issue/Question

    for private_ip in private:
        private_ip = preferred_ip(vm_, [private_ip])
        if salt.utils.cloud.is_public_ip(private_ip):
  • but is_public_ip() dont support False :
def is_public_ip(ip):
    '''
    Determines whether an IP address falls within one of the private IP ranges
    '''
    if ':' in ip:
  • resulting in :
 'private_ips': ['an:ip:v6', 'an.ip.v4'],
 'public_ips': [],
 'size': None,
 'state': 0}
[WARNING ] Private IPs returned, but not public... Checking for misidentified IPs
[ERROR   ] There was a profile error: argument of type 'bool' is not iterable
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/salt/cloud/cli.py", line 284, in run
    self.config.get('names')
  File "/usr/lib/python2.7/dist-packages/salt/cloud/__init__.py", line 1458, in run_profile
    ret[name] = self.create(vm_)
  File "/usr/lib/python2.7/dist-packages/salt/cloud/__init__.py", line 1288, in create
    output = self.clouds[func](vm_)
  File "/usr/lib/python2.7/dist-packages/salt/cloud/clouds/openstack.py", line 774, in create
    'wait_for_ip_interval', vm_, __opts__, default=10),
  File "/usr/lib/python2.7/dist-packages/salt/utils/cloud.py", line 2371, in wait_for_ip
    data = update_callback(*update_args, **update_kwargs)
  File "/usr/lib/python2.7/dist-packages/salt/cloud/clouds/openstack.py", line 730, in __query_node_data
    if salt.utils.cloud.is_public_ip(private_ip):
  File "/usr/lib/python2.7/dist-packages/salt/utils/cloud.py", line 2266, in is_public_ip
    if ':' in ip:
TypeError: argument of type 'bool' is not iterable

Setup

It seems to occure on a preferred IPv4 setup with a cloud provider (in my case openstack) returning an IPv6 first - see Traceback.

Versions Report

salt --versions-report
Salt Version:
           Salt: 2016.11.2

Dependency Versions:
           cffi: 1.7.0
       cherrypy: Not Installed
       dateutil: 2.2
          gitdb: 0.5.4
      gitpython: 0.3.2 RC1
          ioflo: Not Installed
         Jinja2: 2.9.4
        libgit2: 0.21.0
        libnacl: Not Installed
       M2Crypto: Not Installed
           Mako: Not Installed
   msgpack-pure: Not Installed
 msgpack-python: 0.4.2
   mysql-python: 1.2.3
      pycparser: 2.14
       pycrypto: 2.6.1
         pygit2: 0.21.4
         Python: 2.7.9 (default, Jun 29 2016, 13:08:31)
   python-gnupg: Not Installed
         PyYAML: 3.11
          PyZMQ: 14.4.0
           RAET: Not Installed
          smmap: 0.8.2
        timelib: Not Installed
        Tornado: 4.2.1
            ZMQ: 4.0.5

System Versions:
           dist: debian 8.7
        machine: x86_64
        release: 3.16.0-4-amd64
         system: Linux
        version: debian 8.7

Tempo fix

            for private_ip in private:
                private_ip = preferred_ip(vm_, [private_ip])
                if salt.utils.cloud.is_public_ip(private_ip):
  • with
            for private_ip in private:
                private_ip = preferred_ip(vm_, [private_ip])
                if not private_ip:
                    continue
                if salt.utils.cloud.is_public_ip(private_ip):

Thanks

@Ch3LL
Copy link
Contributor

Ch3LL commented Feb 16, 2017

ping @gtmanfred I think your hte expert here. Can you give @clem-compilatio any ideas on whether where this needs to be patched? Seems we need to account for a possible bool since they return False

@Ch3LL Ch3LL added Bug broken, incorrect, or confusing behavior severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around P4 Priority 4 Salt-Cloud labels Feb 16, 2017
@Ch3LL Ch3LL added this to the Approved milestone Feb 16, 2017
@gtmanfred
Copy link
Contributor

I am ok with skipping the false values, we shouldn't be passing things that aren't ips to is_public_ip.

I am going to submit that fix to the 3 drivers that use this.

We have plans in the future to replace openstack and nova with a new driver that is significantly simplified, so we shouldn't have to use this for long I don't think.

Thanks for reporting.

Daniel

@rallytime
Copy link
Contributor

Fixed by #39464. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug broken, incorrect, or confusing behavior P4 Priority 4 Salt-Cloud severity-medium 3rd level, incorrect or bad functionality, confusing and lacks a work around
Projects
None yet
Development

No branches or pull requests

4 participants