rpm-ostree/tests/library/qemu_teardown.py
Jonathan Lebon d11be14ae1 tests: run parts of the vmcheck testsuite
Run the basic and layering-basic vmcheck tests on qcow2 Atomic Host
images. It's full of hacks for now; I'd like to confirm first that there
aren't any oversights that would prevent the pipeline from running it.

Once we get it going, we can work on cleaning up and upstreaming the
hacks to standard-test-roles, and run all the vmcheck tests.
2017-08-15 14:44:18 -04:00

38 lines
778 B
Python

#!/usr/bin/env python
# XXX: we should move as much of these mods to standard-test-roles
import os
import shutil
import signal
import subprocess
import sys
import tempfile
# HACK: Ansible requires this exact string to be here
from ansible.module_utils.basic import *
WANT_JSON = True
def main(argv):
module = AnsibleModule(argument_spec = {
"statedir": { "required": True, "type": "str" },
})
directory = module.params["statedir"]
pid = os.path.join(directory, "pid")
with open(pid, 'r') as f:
try:
os.kill(int(f.read().strip()), signal.SIGTERM)
except OSError:
pass
shutil.rmtree(directory)
module.exit_json(changed=True)
return 0
if __name__ == '__main__':
sys.exit(main(sys.argv))