diff --git a/README.rst b/README.rst
index 99b08d2..53d2018 100644
--- a/README.rst
+++ b/README.rst
@@ -15,8 +15,9 @@ Packages:
- libguestfs-tools
- python-requests (for whatever python version you're running)
-Optional:
- - py.test (if you plan on running or working on the tests)
+Optional (if you plan on running or working on the tests):
+ - python2-pytest
+ - python-pytest-cov
All of these packages are in the Fedora repos (and likely other distros as
well).
@@ -33,15 +34,9 @@ of the current refactoring/transition process.
If you are running testcloud as a non-administrative user (ie. not in wheel) or
on a system that doesn't have a polkit agent running (custom setups, headless
-systems etc.), you may need to adjust local polkit configuration to allow non-root
-users to manage VMs with libvirt. Add the following data into ``/etc/polkit-1/localauthority/50-local.d/50-nonrootlivirt.pkla``::
-
- [nonroot libvirt system connection]
- Identity=unix-group:testcloud
- Action=org.libvirt.unix.manage
- ResultActive=yes
- ResultInactive=yes
- ResultAny=yes
+systems etc.), you may need to adjust local polkit configuration to allow
+non-admin users to manage VMs with libvirt. Look into
+``conf/99-testcloud-nonroot-libvirt-access.rules`` file.
After writing that file, restart polkit (``systemctl restart polkit``) and if
the user in question is a member of the unix group ``testcloud``, that user
@@ -122,7 +117,7 @@ There is a small testsuite you can run with:
.. code:: bash
- py.test test/
+ py.test
This is a good place to contribute if you're looking to help out.
@@ -130,7 +125,7 @@ Issue Tracking and Roadmap
--------------------------
Our project tracker is on the Fedora QA-devel
-`Phabricator `_
+`Phabricator `_
instance.
Credit
diff --git a/conf/99-testcloud-nonroot-libvirt-access.rules b/conf/99-testcloud-nonroot-libvirt-access.rules
index 4a58b74..d14d219 100644
--- a/conf/99-testcloud-nonroot-libvirt-access.rules
+++ b/conf/99-testcloud-nonroot-libvirt-access.rules
@@ -1,11 +1,17 @@
-/* testcloud is often used on headless machines (Taskotron uses it this way)
-where the user only has ssh access to the virt host. This rule file allows
-users in the 'testcloud' group to be able to manipulate spawned machines over
-ssh. */
+/* If you are running testcloud as a non-administrative user (ie. not in wheel) or
+on a system that doesn't have a polkit agent running (custom setups, headless
+systems etc.), you may need to adjust local polkit configuration to allow
+non-admin users to manage VMs with libvirt.
+
+Copy this to /etc/polkit-1/rules.d/ . Then restart polkit
+$ systemctl restart polkit
+and if the user in question is a member of the unix group 'testcloud', that
+user should be able to run testcloud with no additional permissions.
+*/
polkit.addRule(function(action, subject) {
if (action.id == "org.libvirt.unix.manage" &&
subject.isInGroup('testcloud')) {
- return polkit.Result.YES;
+ return polkit.Result.YES;
}
});
diff --git a/conf/settings-example.py b/conf/settings-example.py
index 51d71a3..4fafa0a 100644
--- a/conf/settings-example.py
+++ b/conf/settings-example.py
@@ -1,18 +1,22 @@
-# Commented out default values with details are displayed below. To override
-# these default values, uncomment the values, rename the file to settings.py
-# and place it in a supported config location
+# Commented out default values with details are displayed below. If you want
+# to change the values, make sure this file is available in one of the three
+# supported config locations:
+# - conf/settings.py in the git checkout
+# - ~/.config/testcloud/settings.py
+# - /etc/testcloud/settings.py
-# Do not modify this file directly, it will not be picked up unless the filename
-# is changed to settings.py
#DOWNLOAD_PROGRESS = True
#LOG_FILE = None
-# Directories for data and cached downloaded images
+
+## Directories for data and cached downloaded images ##
+
#DATA_DIR = "/var/lib/testcloud/"
#STORE_DIR = "/var/lib/testcloud/backingstores"
-# Data for cloud-init
+
+## Data for cloud-init ##
#PASSWORD = 'passw0rd'
#HOSTNAME = 'testcloud'
@@ -20,6 +24,8 @@
#META_DATA = """instance-id: iid-123456
#local-hostname: %s
#"""
+## Read http://cloudinit.readthedocs.io/en/latest/topics/examples.html to see
+## what options you can use here.
#USER_DATA = """#cloud-config
#password: %s
#chpasswd: { expire: False }
@@ -32,9 +38,10 @@
#runcmd:
# - [ sh, -c, 'echo -e "ROOT_SIZE=4G\nDATA_SIZE=10G" > /etc/sysconfig/docker-storage-setup']
#"""
-#
-# Extra cmdline args for the qemu invocation.
-# Customize as needed :)
+
+
+## Extra cmdline args for the qemu invocation ##
+## Customize as needed :)
#CMD_LINE_ARGS = []
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 692a7e9..fb7ee31 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -75,7 +75,7 @@ Self service methods for asking questions and filing tickets:
* `Source Repository `_
- * `Currently Open Issues `_
+ * `Currently Open Issues `_
For other questions, the best places to ask are:
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..c54cb4f
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,9 @@
+# This is a list of pypi packages to be installed into virtualenv. Alternatively,
+# you can install these as RPMs instead of pypi packages. See README.
+
+libvirt-python
+requests
+
+# Test suite requirements
+pytest
+pytest-cov
diff --git a/setup.py b/setup.py
index 6dd9042..cc1fb9e 100644
--- a/setup.py
+++ b/setup.py
@@ -1,4 +1,4 @@
-from setuptools import setup
+from setuptools import setup, Command
import codecs
import re
import os
@@ -18,6 +18,18 @@ def find_version(*file_paths):
raise RuntimeError("Unable to find version string.")
+class PyTest(Command):
+ user_options = []
+ def initialize_options(self):
+ pass
+ def finalize_options(self):
+ pass
+ def run(self):
+ import subprocess
+ errno = subprocess.call(['py.test'])
+ raise SystemExit(errno)
+
+
setup(name='testcloud',
version=find_version('testcloud', '__init__.py'),
description="small helper script to download and "
@@ -29,5 +41,6 @@ def find_version(*file_paths):
packages=["testcloud"],
package_dir={"testcloud": "testcloud"},
include_package_data=True,
+ cmdclass={'test': PyTest},
entry_points=dict(console_scripts=["testcloud=testcloud.cli:main"]),
)
diff --git a/test/pytest.ini b/test/pytest.ini
deleted file mode 100644
index 2c789da..0000000
--- a/test/pytest.ini
+++ /dev/null
@@ -1,4 +0,0 @@
-[pytest]
-minversion = 2.0
-python_functions=test should
-python_files=test_* functest_*
diff --git a/tox.ini b/tox.ini
index 579f8c0..22dd1f2 100644
--- a/tox.ini
+++ b/tox.ini
@@ -6,4 +6,4 @@ exclude = conf/*,docs/source/conf.py
minversion=2.0
python_functions=test should
python_files=test_* functest_*
-addopts=test/
+addopts=test/ --cov-report=term-missing --cov testcloud