salt icon indicating copy to clipboard operation
salt copied to clipboard

If master_port is a string the minion cannot connect and prints an unhelpful error message

Open nicksloan opened this issue 9 years ago • 3 comments

Description of Issue/Question

If master_port is encoded in YAML as a string, the socket connection in salt.utils.dns_check will fail. This was not the case in previous versions. It also appears that a previous version of salt-cloud (or salt-bootstrap) was responsible for generating minion configs with the port encoded as a string.

See https://github.com/nicksloan/salt/blob/develop/salt/utils/init.py#L517

The original exception provides useful context that is stripped away in the SaltSystemExit error. I was not able to determine the cause of the error here without modifying the code to view the original exception. That's hardly ideal.

Here are a few ideas:

  • Improve the error message so that the user can identify the port being a string as the piece that is broken.
  • Reintroduce the behavior that allowed this to work previously. It may be as simple as wrapping the port argument with int in the socket.connect call. It may be wise to do the previous suggestion as a warning as well.

I'm happy to work on a pull request here, but want advice on how to best address this.

Setup

Specify master_port: '4506' in your minion config.

Steps to Reproduce Issue

Do anything.

Versions Report

Salt Version: Salt: 2016.11.4

Dependency Versions: cffi: Not Installed cherrypy: Not Installed dateutil: 2.2 docker-py: Not Installed gitdb: 0.5.4 gitpython: 0.3.2 RC1 ioflo: Not Installed Jinja2: 2.7.3 libgit2: Not Installed libnacl: Not Installed M2Crypto: Not Installed Mako: 1.0.0 msgpack-pure: Not Installed msgpack-python: 0.4.2 mysql-python: 1.2.3 pycparser: Not Installed pycrypto: 2.6.1 pycryptodome: Not Installed pygit2: Not Installed 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.6 machine: x86_64 release: 3.16.0-4-amd64 system: Linux version: debian 8.6

Minion running the same.

nicksloan avatar Apr 26 '17 20:04 nicksloan

Just experienced the same on multiple minions after update.

The (confusing) error message that appears is:

Master address: 'salt' could not be resolved. Invalid or unresolveable address. Set 'master' value in minion config.

iplux avatar Apr 27 '17 13:04 iplux

@iplux Thanks for that. I knew I was forgetting something.

nicksloan avatar Apr 27 '17 16:04 nicksloan

Thanks for reporting this, I have done a git bisect to find where this was introduced and created the following PR to remedy the problem.

Thanks, Daniel

gtmanfred avatar Apr 27 '17 16:04 gtmanfred