Due to a software bug in vSphere, it fails to handle ampersand in datacenter names.
The solution is to do what vSphere does (when browsing) and double-encode ampersands.
It is likely other characters need special treatment like this as well, haven't found any.
This fixes::
Traceback (most recent call last):
File "/home/jpic/.ansible/tmp/ansible-tmp-1435080800.61-38257321141340/lxc_container", line 3353, in <module>
main()
File "/home/jpic/.ansible/tmp/ansible-tmp-1435080800.61-38257321141340/lxc_container", line 1712, in main
if not HAS_LXC:
NameError: global name 'HAS_LXC' is not defined
This fixes::
Traceback (most recent call last):
File "/home/jpic/.ansible/tmp/ansible-tmp-1435080916.98-133068627776311/lxc_container", line 3355, in <module>
main()
File "/home/jpic/.ansible/tmp/ansible-tmp-1435080916.98-133068627776311/lxc_container", line 1724, in main
lxc_manage.run()
File "/home/jpic/.ansible/tmp/ansible-tmp-1435080916.98-133068627776311/lxc_container", line 1605, in run
action()
File "/home/jpic/.ansible/tmp/ansible-tmp-1435080916.98-133068627776311/lxc_container", line 1145, in _started
self._config()
File "/home/jpic/.ansible/tmp/ansible-tmp-1435080916.98-133068627776311/lxc_container", line 714, in _config
_, _value = option_line.split('=')
ValueError: too many values to unpack
With such a task::
tasks:
- lxc_container:
name: buildbot-master
container_config:
- "lxc.mount.entry = {{ cwd }} srv/peopletest none defaults,bind,uid=0,create=dir 0 0"
The `--noreplace` argument to `emerge` is generally coupled with
`--newuse` or `--changed-use`, and can be used instruct Portage to
rebuild a package only if necessary. Simply checking to see if the
package is already installed using `equery` is not sufficient to
determine if any changes would be made, so that step is skipped when
the `noreplace` module argument is specified. The module then falls back
to parsing the output from `emerge` to determine if anything changed. In
check mode, `emerge` is called with `--pretend`, so it produces
different output, and the parsing fails to correctly infer that a change
would be made.
This commit adds another regular expression to check when running in
check mode that matches the pretend output from `emerge`.
Signed-off-by: Dustin C. Hatch <dustin@hatch.name>
When running in check mode, the *portage* module always reports that no
changes were made, even if the requested packages do not exist on the
system. This is because it was erroneously expecting `emerge --pretend`
to produce the same output as `emerge` by itself would, and attempts to
parse it. This is not correct, for several reasons. Most specifically,
the string for which it is searching does not exist in the pretend
output. Additionally, `emerge --pretend` always prints the requested
packages, whether they are already installed or not; in the former case,
it shows them as reinstalls.
This commit adjusts the behavior to rely on `equery` alone when running
in check mode. If `equery` reports at least one package is not
installed, then nothing else is done: the system will definitely be
changed.
Signed-off-by: Dustin C. Hatch <dustin@hatch.name>