Skip to content
Open

Dev #23

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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).
Expand All @@ -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
Expand Down Expand Up @@ -122,15 +117,15 @@ 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.

Issue Tracking and Roadmap
--------------------------

Our project tracker is on the Fedora QA-devel
`Phabricator <https://phab.qadevel.cloud.fedoraproject.org/tag/testcloud/>`_
`Phabricator <https://phab.qa.fedoraproject.org/tag/testcloud/>`_
instance.

Credit
Expand Down
16 changes: 11 additions & 5 deletions conf/99-testcloud-nonroot-libvirt-access.rules
Original file line number Diff line number Diff line change
@@ -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;
}
});
27 changes: 17 additions & 10 deletions conf/settings-example.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
# 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'

#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 }
Expand All @@ -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 = []

Expand Down
2 changes: 1 addition & 1 deletion docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Self service methods for asking questions and filing tickets:

* `Source Repository <https://github.com/Rorosha/testcloud>`_

* `Currently Open Issues <https://phab.qadevel.cloud.fedoraproject.org/tag/testcloud/>`_
* `Currently Open Issues <https://phab.qa.fedoraproject.org/tag/testcloud/>`_

For other questions, the best places to ask are:

Expand Down
9 changes: 9 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
15 changes: 14 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from setuptools import setup
from setuptools import setup, Command
import codecs
import re
import os
Expand All @@ -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 "
Expand All @@ -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"]),
)
4 changes: 0 additions & 4 deletions test/pytest.ini

This file was deleted.

2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -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