self.client.envs() is called twice and assigned to client_envs and
client_env_list. Remove one of both variables since they are not
modified before usage.
Signed-off-by: Benjamin Drung <benjamin.drung@profitbricks.com>
We appear to be running across an upstream bug of socket.getaddrinfo. If the
ipv4 address is set for the hostname in /etc/hosts, but the ipv6 address is
not, we run into the timeout. If the ipv6 is set, but the ipv4 is not, then
everything works as expected. If neither are set, and you don't have
`myhostname` in nsswitch.conf for hosts, then it will fail for both if dns is
not setup.
There is not much else we can do besides log a warning so that users make sure
that their hostname lookups are setup correctly.
```
root@saltmaster:~# cat /etc/hosts
::1 saltmaster.local saltmaster
root@saltmaster:~# grep hosts /etc/nsswitch.conf
hosts: files myhostname dns
root@saltmaster:~# time salt-call --local grains.item fqdn_ip4 fqdn_ip6
local:
----------
fqdn_ip4:
- 127.0.0.1
fqdn_ip6:
- ::1
real 0m0.299s
user 0m0.217s
sys 0m0.074s
root@saltmaster:~# vi /etc/hosts
root@saltmaster:~# cat /etc/hosts
127.0.0.1 localhost saltmaster.local saltmaster
root@saltmaster:~# time salt-call --local grains.item fqdn_ip4 fqdn_ip6
[WARNING ] Unable to find IPv6 record for saltmaster.local. Create a dns record or add to /etc/hosts to clear this message.
local:
----------
fqdn_ip4:
- 127.0.0.1
fqdn_ip6:
real 0m10.323s
user 0m0.214s
sys 0m0.066s
root@saltmaster:~# vi /etc/hosts
root@saltmaster:~# cat /etc/hosts
root@saltmaster:~# time salt-call --local grains.item fqdn_ip4 fqdn_ip6
local:
----------
fqdn_ip4:
- 192.168.50.10
- 10.0.2.15
fqdn_ip6:
- ::1
real 0m0.310s
user 0m0.244s
sys 0m0.058s
root@saltmaster:~# vi /etc/nsswitch.conf
root@saltmaster:~# grep hosts /etc/nsswitch.conf
hosts: files dns
root@saltmaster:~# time salt-call --local grains.item fqdn_ip4 fqdn_ip6
[WARNING ] Unable to find IPv4 record for saltmaster. Create a dns record or add to /etc/hosts to clear this message.
[WARNING ] Unable to find IPv6 record for saltmaster. Create a dns record or add to /etc/hosts to clear this message.
local:
----------
fqdn_ip4:
fqdn_ip6:
real 0m0.343s
user 0m0.186s
sys 0m0.110s
```
This squelches a spurious warning that we get due to rewriting the low
data such that the name and version are aggregated under the "pkgs" arg,
with the "version" key remaining in the low chunk.
This fixes an issue in which states which contained a single package
name (no "pkgs" or "sources") paired with a "version" argument, were
having the version ignored. This is because just the name was being
added to the aggregated "pkgs".
Since we're munging low data to aggregate states, this bug wouldn't even
result in the state failing if a different version were installed.
Doing so will cause problems trying to install as Salt does not support
installing from both binary packages and repository packages in the same
call to pkg.install.