Py Control Repository is SDK for Pyththon which allows developpers to manage a Puppet Control Repository based on GitHub.
$ pip install py-control-repositorycontrol_repository = ControlRepository('myorga', 'my_control_repository', 'token')
puppet_environment = control_repository.get_environment('production')Returns the list of all Puppet Environment.
control_repository = ControlRepository('myorga', 'my_control_repository', 'token')
puppet_environments = control_repository.get_environments()Returns the list of all Puppet Environment names.
control_repository = ControlRepository('myorga', 'my_control_repository', 'token')
puppet_environment_names = control_repository.get_environment_names()Returns the new Puppet Environment.
control_repository = ControlRepository('myorga', 'my_control_repository', 'token')
new_puppet_environments = control_repository.create_environment('source_environment_name',
'new_environment_name')puppetfile = puppet_environment.get_puppetfile()module_list = puppetfile.list_modules()puppetfile.add_forge_module('puppetlabs/apache', version='0.10.1')puppetfile.update_forge_module('puppetlabs/apache', '0.11.0')puppetfile.remove_forge_module('puppetlabs/apache')With no version spicified, it will install the current master branch.
puppetfile.add_git_module('custom_module', 'https://url.my.git/orga/custom_module')You can specify a specific git reference. Supported are :
- branch
- ref
- tag
- commit
puppetfile.add_git_module('custom_module',
'https://url.my.git/orga/custom_module',
reference_type='commit',
reference='ae1fe')Bump module version
puppetfile.update_git_module('mymodule', '12.0.2')You can also change a module reference type and its value.
For example you have a module deployed by its master branch and want to track it by a specific tag.
puppetfile.update_git_module('mymodule', '1.0.0', reference_type='tag')puppetfile.remove_git_module('apache')