saltstack-formulas / hostsfile-formula

Use minion IDs to keep /etc/hosts and hostnames consistent for clusters without DNS
http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Other
33 stars 89 forks source link

Domain customization generates bogus entry #26

Closed lastmikoi closed 4 years ago

lastmikoi commented 6 years ago

Hello,

I'm a relatively new user of Salt and I've been working on a project that involves using this formula. However, it would seem that the relatively recent domain part of the formula is not working properly in my environment:

OS: CentOS 7 Saltstack: 2016.11.8 with salt-ssh.

Indeed, it generates entries such as this one:

192.168.122.53     saltmaster saltmaster.<function caller at 0x7f4993c70aa0>

As you can see, it doesn't seem to be able to actually grab the domain and instead prints a reference to a function, which changes every run.

I've been trying to tinker a bit with the code and replacing salt.pillar.get with salt['pillar.get'] in https://github.com/saltstack-formulas/hostsfile-formula/blob/master/hostsfile/init.sls#L23 seems to do the trick.

If this workaround sounds reasonable I'll go ahead and open a PR with that modification but I am not familiar with best practices when it comes to making formulas so I'd rather get your input on that issue.

cschneemann commented 4 years ago

I had the same problem with salt-ssh and target centos 7.

Your change fixed it. Thanks

myii commented 4 years ago

Thanks for confirming that, @cschneemann. Would you mind providing that PR, @lastmikoi?

saltstack-formulas-travis commented 4 years ago

:tada: This issue has been resolved in version 0.8.1 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: