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

Fix inventory_file variable in connection tests #470

Merged
merged 1 commit into from
Jan 17, 2016

Conversation

fullyint
Copy link
Contributor

The default inventory = hosts (in ansible.cfg) is a directory.

Whereas in Ansible <= 1.9.4 the inventory_file variable returned hosts, in Ansible 2.0+ it returns null. The definition comes from self._inventory.src(), whose is_file() check apparently returned true in 1.9.4 but no longer does in 2.0+.

I initially thought we could just omit the -i inventory options from the affected commands and let the commands just use the default inventory specified in ansible.cfg. However, if a user specifies an actual file via the cli, the inventory_file variable will be non-null and our ssh connection tests should use that inventory. So, this PR adjusts commands to use the inventory_file variable only when it is not null.

The inventory_file needs the string filter so that when it is null the playbook will not fail with "ERROR! an unexpected type error occurred. Error was cannot concatenate 'str' and 'NoneType' objects".

@swalkinshaw
Copy link
Member

👍

fullyint added a commit that referenced this pull request Jan 17, 2016
Fix inventory_file variable in connection tests
@fullyint fullyint merged commit 3404567 into roots:master Jan 17, 2016
@fullyint fullyint deleted the inventory-file-var branch January 17, 2016 02:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants