No commit activity in last 3 years
A mock version of Puppet Code Manager
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
 Dependencies

Development

~> 2.0
= 0.64.0
~> 12.3
~> 3.8

Runtime

= 2.0.7
~> 0.28.2
= 2.0.5
= 1.4.2
 Project Readme

MockCodeManager

This is a limited mock version of the Puppet Code Manager REST API.

It exists to allow Integration testing of software consuming this service without the need to stand-up a complete working Puppet Enterprise environment

Installation

Add this line to your application's Gemfile:

gem 'mock_code_manager'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mock_code_manager

Requirements

  • Ruby 2.3+ (use RVM)
  • openssl
  • Access to /tmp/mock_code_manager_ssl for credential storage
  • Hostname as reported by hostname -f must match the fqdn the service will be accessed from
  • Port 8170 my be avaiable and reachable by the outside world

Usage

Simple

To generate all required SSL credentials and start a server on port 8170, run the command:

mock_code_manager

Note that this service will terminate when your login shell exits. To prevent this, use screen, nohup, etc.

Ruby

You can use the library as part of your ruby projects if you like. Something like:

Thread.start { MockCodeManager::WEBrick.run! }

In your spec_helper.rb along with a delay/test while the credentials are generated should be enough to get you started.

API completeness

/code-manager/v1/deploys

  • Authentication check
  • Deploy all environments (deploy-all)
  • Deploy selected environments (environments)

Authentication

You must pass authentication tokens using the X-Authentication HTTP header.

The service will return an appropriate response based on the value or absence of this header:

PUPPET_DEPLOY_OK

Proceed to service request

Absent

puppetlabs.rbac/user-unauthenticated

PUPPET_DEPLOY_FAIL (or any other value)

puppetlabs.rbac/token-revoked

Note that the above responses are always expressed as JSON and always with status 200.

Contributing

PRs accepted :)