Skip to content
Go to file

Latest commit


Failed to load latest commit information.
Latest commit message
Commit time
Oct 22, 2020
Oct 22, 2020
May 10, 2013


The Subscription Manager package provides programs and libraries to allow users to manage subscriptions and yum repositories from the Candlepin.

Local Installation

Consider using Vagrant instead (see below) for development as it can be a much more consistent and easy experience.

In order to build, develop, and test locally, please follow instructions at

For instructions on building the debian-packages of this project, see instructions in contrib/debian/README.source.

Due to unintuitive behavior with sys.path (see, python src/subscription_manager/scripts/ does not work as expected. One can run the script like this instead:

PYTHONPATH=./src:./syspurpose/src python -m subscription_manager.scripts.subscription_manager

Similar for other bin scripts:

PYTHONPATH=./src python -m subscription_manager.scripts.rct
PYTHONPATH=./src python -m subscription_manager.scripts.rhn_migrate_classic_to_rhsm
# ... etc.

(You can also just export PYTHONPATH instead of setting it in each command).


The setup that most developers are using is vagrant-libvirt with vagrant-hostmanager and vagrant-sshfs installed on Fedora via:

dnf install vagrant-libvirt vagrant-hostmanager vagrant-sshfs

If you are testing on RHEL CentOS you can install vagrant from and then install the plugins using:

vagrant plugin install vagrant-hostmanager
vagrant plugin install vagrant-libvirt
vagrant plugin install vagrant-sshfs

We are avoiding coupling to libvirt, but use of VirtualBox is less tested. If you'd like to ensure vagrant uses libvirt, you can set VAGRANT_DEFAULT_PROVIDER=libvirt in your environment.

vagrant up can be used to spin up various VMs set up for development work. These VMs are all configured using the included ansible role "subman-devel". The python paths and PATH inside these environments are modified so that running subscription-manager or subscription-manager-gui will use scripts and modules from the source code.

Cockpit can be accessed at port 9090 on the VM, for example:

NOTE: Use of hostnames per above requires the vagrant hostmanager plugin. Cockpit credentials are the same as user credientials; i.e. User name: vagrant password: vagrant

There are two links added in the cockpit interface: one for the subscription-manager cockpit plugin itself, and then one which runs integration tests for the D-Bus interface.

Currently, the source is set up as a vagrant shared folder using sshfs. This means that it is necessary to install the vagrant-sshfs plugin to sync changes from the host to the guest.

The ansible role that provisions the VMs tries to find the IP address of, so if the candlepin vagrant image is started first, then the box can resolve it. (If it is started later, vagrant provision can be used to update the VM's hosts file).

Additionally, the Vagrantfile is set up for sharing base VMs with katello/forklift. Specifically, forklift plugins can be added to a subscription-manager checkout beneath vagrant/pluginsin order to provide additional base images.

If RHEL-based images are added, then the Vagrantfile uses the values of SUBMAN_RHSM_USERNAME, SUBMAN_RHSM_PASSWORD, SUBMAN_RHSM_HOSTNAME, SUBMAN_RHSM_PORT, and SUBMAN_RHSM_INSECURE to register and auto-attach during provisioning (best done in .bashrc or similar). If unspecified, hostname and port are left alone (i.e. whatever is in the VM's rhsm.conf will be untouched).

To register against, .bashrc might contain:

export SUBMAN_RHSM_PASSWORD=password

(Replace username and password with actual values).

To register against a local candlepin instance, .bashrc might contain:

export SUBMAN_RHSM_PASSWORD=password

(Replace username and password with actual values).

Note, however, since the registration is necessary to download RPMs to set up the VM for development, registering against a local candlepin might not be particularly useful (at least not for initial provisioning).

If you want use proxy server to play with subscription you can run it using vagrant: vagrant up proxy-server

The current info about proxy

url | username | proxyuser password | password


There is experimental support for installation of subscription-manager using Pipenv. We tested installing subscription-manager using Pipenv only on following operating systems:

  • Fedora 30
  • RHEL/CentOS 7
  • RHEL/CentOS 8

We tested pipenv with Python 2 and Python 3. It is necessary to install following packages to your system, because binary module have to be compiled in virtual environment:

Python 2

dnf install -y pipenv gcc make python2-devel \
    openssl-devel intltool libnl3-devel

Python 3

dnf install -y pipenv gcc make python3-devel \
    openssl-devel intltool libnl3-devel

You can create virtual environment using following steps:

  1. Create virtual environment using Python 2 or Python 3 and it is necessary to use --site-packages argument, because virtual environment has to use rpm Python package installed in your system. It is not possible to install rpm Python package to virtual environment using pip/pipenv.

    Python 2:

    pipenv --site-packages --two

    Python 3:

    pipenv --site-packages --three
  2. Install required Python packages defined in Pipfile into virtual environment:

    pipevn install
  3. Start virtual environment:

    pipenv shell
  4. Build binary modules in virtual environment:

    python ./ build
  5. Install subscription-manager into virtual environment:

    python ./ install
  6. It should be possible to run subscription-manager in virtual environment

    sudo subscription-manager version

Development of the Subscription-Manager Deployment Ansible role

The Ansible role that is used for deploying subscription-manager can be found at In order to test changes for this Ansible role you will need to check it out locally. Edit the vagrant/requirements.yml file and change the src property to - src: git+file:///your/development/path/to/ansible-role-subman-devel. This will pull the latest commit from this path and use it for deployment.

D-Bus Development

In a vagrant VM, the com.redhat.RHSM1 service along with related files (scripts, policy files, etc.) are linked to those from the source. However, it is necessary to restart the D-Bus service if edits are made while it is running with, for example, sudo systemctl restart rhsm.


The easiest way to get started with cockpit plugin development is Vagrant. Inside the VM, from the directory /vagrant/cockpit, the following commands can be used:

  • yarn install - fetch dependencies, and update the lockfile if necessary.
  • npm run build - do a build of the JavaScript source.
  • npm run watch - monitor the source for changes and rebuild the cockpit plugin when necessary.

See cockpit/ for more detailed information on cockpit development.


The syspurpose utility manages certain user-definable values tracked in the /etc/rhsm/syspurpose/syspurpose.json file (in json format).

See ./packages/syspurpose/ for details on getting started


We run tests using nose (see for details). Some tests are not run by default. For example, since we are not maintaining the GTK GUI for all platforms, they are not run by default. They can be included via -a gui option for the nose command. It is recommended if you run the GUI tests to also use --with-xvfb in order to use Xvfb instead of spawning GTK windows in your desktop session (ex. nosetests -a gui --with-xvfb).

More details about testing


If you are working inside one of the vagrant boxes and you find subscription-manager and/or subscription-manager-gui will not work with output that looks like the following: "Unable to find Subscription Manager module. Error: cannot open shared object file: No such file or directory"

You should be able to run vagrant provision [vm-name] from the host machine to fix the issue.

This issue can happen if the python-rhsm/build or python-rhsm/build_ext directories are copied to the virtual machine and the virtual machine provides different libraries than those available on the build host.

You can’t perform that action at this time.