Andrew Schoen [Wed, 19 Aug 2015 16:06:22 +0000 (11:06 -0500)]
ansible: raise an AnsibleFailedError even when parsing fails
If _handle_failures fails to parse the yaml in the ansible error log, it
can still give the contents of the failure log to an AnsibleFailedError
in it's unparsed form.
I also changed the log.exception to log.error when an ParserError occurs
as I think it was confusing some having that extra traceback in the log.
Andrew Schoen [Mon, 17 Aug 2015 21:06:13 +0000 (16:06 -0500)]
task.ansible: set the ansible_failure.yaml file mode to 0664
The failure log was originally created with mode 0600 which does not
allow apache to serve the file. This changes the mode to 0664 to match
the rest of the archived files from a teuthology job.
Andrew Schoen [Tue, 4 Aug 2015 20:10:25 +0000 (15:10 -0500)]
ansible: read the ansible failure log and raise a more meaningful error
This works with a custom ansible callback plugin that intercepts task
failures and writes them to a log file (in yaml format) provided by the
ansible task as an environment variable. If the playbook fails, teuthology
reads that failure log and raises an AnsibleFailedError with the actual
output from the failed ansible task.
Andrew Schoen [Fri, 31 Jul 2015 21:06:06 +0000 (16:06 -0500)]
remove the need for teuthology.misc in teuthology.packaging
It's best to get the package type from remote.os.package_type. This also
fixes a circular import that will allows me to import
teuthology.packaging into teuthology.misc
Andrew Schoen [Wed, 22 Jul 2015 21:03:11 +0000 (16:03 -0500)]
Introduces packaging.GitbuilderProject
This is a new class that can be used to interface with gitbuilder to get
information about a project. Currently it's used primarily for version
checks and constructing the correct base url for a projects location on
gitbuilder.
Ilya Dryomov [Thu, 7 May 2015 10:55:14 +0000 (13:55 +0300)]
kernel: support overrides
This is needed for the new unmap subsuite of krbd suite.
normalize_config() config should actually copy config snippets into
new_config, otherwise popping keys from one role's snippet would also
affect other roles, potentially resulting in overrides: overriding more
than it should have.
In the case where we stamp out a config for all roles, don't take
a shortcut and stamp it out once per remote. Instead, do it for each
role, so that the number of items in the resulting dict in this case is
equal to the number of roles and not to the number of remotes. This is
a necessary prerequisite for override support - otherwise something
like
kernel:
client:
branch: testing
override:
kernel:
branch: wip-foobar
won't be deep_merged()'ed correctly if the role:remote mapping looks
like
Dan Mick [Sat, 25 Jul 2015 03:46:14 +0000 (20:46 -0700)]
lock_machines: record total requested, stop only when that many locked
The 'requested' counter is per-loop around the while True, and changes
for partial lock successes and multiple trips around the loop. We need to
save the original number requested to know when we're done.
Also, add a bit of logging for each trip around the loop.
If lock_many() fails to create any VMs, it returns an empty dict, which
was causing an exception to be raised. The existing error reporting in
lock_many() should be adequate here.
b834dd6660a77379b2c693a36487352941a8e52d added decode('utf-8') which
breaks when a substring inadevertendly cuts in the middle of a valid
utf-8 sequence. Add the 'ignore' so the offending sequence is discarded
instead of raising an error.
ssh_keyscan_wait: blocking version of ssh_keysscan
ssh_keyscan is designed to return almost immediately if there is no
connection (the timeout is 1 second). ssh_keyscan_wait will wait up to
10 minutes and report progress every 6 seconds.
If nuke is called with no targets, just do nothing instead of failing
because the target element is not found in the map. This can happen if
the machine fails to be provisioned early in the process.
Andrew Schoen [Mon, 13 Jul 2015 15:47:21 +0000 (10:47 -0500)]
Allow subclasses of task.Ansible to provide an inventory group name
Subclasses of task.Ansible can now provide an inventory group name to
assign all nodes to when creating a dynamic inventory.
This PR also makes ansible.CephLab use the group 'testnodes'. Without this,
teuthology can not run the testnodes.yml playbook against it's locked nodes
using a dynamic inventory as it's restricted to the testnodes group.
These were passing because we were calling Mock.assert_called_once(),
which never existed. In new versions of mock, that is an error -
exposing those tests which were not doing their job.
This should tell pip to use the latest version of packages (taking
pinning into account) - so that we can install newer versions of
packages that happen to be installed system-wide. This won't affect
libvirt-python as it is omitted from our list of requirements.
Ivo Jimenez [Wed, 8 Jul 2015 00:57:02 +0000 (17:57 -0700)]
Allows other users besides ubuntu
Hostname canonicalization using split() instead of RE.
Extends the semantics of canonicalization/decanonicalization routines so
that other user names can be specified. 'ubuntu' is still the default
but if other users are given on the 'targets' config option, those will
be used instead.
Ivo Jimenez [Tue, 7 Jul 2015 19:38:06 +0000 (12:38 -0700)]
Ensures that task list is a python list
* Modifies test for task list validation
* Shows contents of config['tasks'] for error msg
* Properly checks distinct failure conditions
* Fixes typo on kernel task AssertionError
get_latest_image_version_deb(): run apt-get update
When we were still using Chef, we accidentally ran it twice on downburst
VMs during scheduled jobs: once before the kernel task, and once after.
Now that we're using Ansible, and not running the one before, and
because the kernel task is special and runs before most tasks (even the
ansible task that might be part of the job), the kernel task might run
before apt has refreshed its cache. This is more likely to be a problem
on VMs, because their cache is certainly more stale, but could affect
physical hosts as well.
Make all deb-based systems update their cache before attempting to
install a kernel.