Python 2.7.9 < does not have the `ssl.SSLContext` attribute. If
`validate_certs` is `True`, we cannot validate the SSL connection,
and we need to raise an error.
Python 3 only allows strings through the config parser. This is fine for
the URL, Username, and Password since these values are required. The CA
File is optional so an empty string is used in leiu of None in the
config dictionary.
* Use six from ansible.module_utils for inventory scripts
Remove skips from sanity test
* Change all imports of ConfigParser to use module_utils.six.moves
* Remove commented out lines
* Fix six imports
ovirt4.py inventory file fails with oVirt 4.3 with the following error:
Traceback (most recent call last):
File "inventory/ovirt", line 259, in <module>
main()
File "inventory/ovirt", line 250, in main
vm_name=args.host,
File "inventory/ovirt", line 209, in get_data
vms[name] = get_dict_of_struct(connection, vm)
File "inventory/ovirt", line 178, in get_dict_of_struct
(stat.name, stat.values[0].datum) for stat in stats
File "inventory/ovirt", line 178, in <genexpr>
(stat.name, stat.values[0].datum) for stat in stats
IndexError: list index out of range
Non-management (elastic) IP addresses require manual configuration on
the host as described in https://help.packet.net/article/54-elastic-ips.
Skip those so that only the automatically configured management
addresses are used. Otherwise, a non-routable address may be returned in
the inventory.
* In some cases, it appears that Exception should have been used instead
as there's no need to catch sys.exit KeyboardInterrupt and similar.
* In a few cases, it appears that BaseException is used because
a library we depend on calls sys.exit() contrary to good coding
design. Comment those so that we know that those have been audited
and found to be correct and change to use (Exception, SystemExit)
instead.
If CLI has already assumed a IAM Role, then the cli environment has an additional variable: AWS_SESSION_TOKEN
This needs to be forwarded to boto to successfully reuse the AWS session in boto.
Fixes#23095
Fixed issue preventing a caller from setting a docker
configuration file (e.g. docker.yml) by specifing the
config file path in the `DOCKER_CONFIG_FILE` environment
variable. Previously, the cli argument parser set a default value for
the `--config-file` argument which would prevent ever checking the
environment variable, regardless of whether or not the `--config-file`
argument even specified a valid file.
This commit adds a global `DEFAULT_DOCKER_CONFIG_FILE` variable, which
points to the current default `docker.yml` config in the
contrib/inventory directory. Now, when this script is called from the
command line, the config file passed with the cli `--config-file` arg
will be given the highest precedence; if it is absent, this script will
then check if the `DOCKER_CONFIG_FILE` env var is set, and load the
config file specified if possible. If neither the environment variable
or cli argument are specified, then the script will attempt to parse the
config file `docker.yml` in this script's directory (if present).
If either the `DOCKER_CONFIG_FILE` environment variable or the
`--config-file` argument are given but point to a nonexistant file, then
the script will print an error message and exit with an error code.
It is *not* an error condition if the fallback `docker.yml` does not
exist.
* --host hostname did not work due to calling wrong function
* softlayer api returns a bunch of extra stuff in the tagReference dict that
makes --list output crazy long, like over a terminal buffer for just one server
this culls out the extranneous information and only inserts the actual user
provided tags to each server.
ec2 inventory script was throwing errors when using Python 3.7:
TypeError: option values must be strings
This changes the None ConfigParser options to empty strings instead.
* Fixes ec2.py assume_role
Previously when connect_to_aws was called it updated the credentials in place. "connect_to_aws" is called multiple times: on the second run it tries to assume the same role it is already using, and potentially failing depending on your iam policies.
* Remove use of simplejson throughout code base. Fixes#42761
* Address failing tests
* Remove simplejson from contrib and other outlying files
* Add changelog fragment for simplejson removal
re-applies commit 6667ec4474 which
fixed the plugin to the script so that it will work with current
ansible-inventory.
Also redirect stdout before dumping the ouptput, because not doing
so will cause JSON parse errors in some cases.
The shift to openstacksdk left us with a bug in that when running bare
with --list, the cloud argument to get_one is None. We just need _one_
of the clouds to pull the cache settings, since they are global (yet,
we'll go back and fix this in sdk)
If it's None, just use get_all and grab the first one.