Skip to main content
Gå til innhold

Testing your changes

We recommend testing your puppet code changes in your branch before merging into master.

To do this log in on a server that the change will be deployed to and run the Puppet Agent with the options described below. It is usually a good idea to stop the daemonized Puppet Agent first so it doesn't revert your changes again before you are done testing.

$ ssh vltrd123.cn.uninett.no
$ systemctl stop puppet

You point the Puppet agent to your branch by using --environment=<your_branch_name>. Running with --noop will display what Puppet intent to change, but will not do any actual changes:

$ sudo puppet agent --test --noop --environment=<your_branch_name>

To deploy the actual changes:

$ sudo puppet agent --test --environment=<your_branch_name>

If you wish to keep your changes as is you can now create a Merge Request and merge your branch into master. See Git Workflow for tips before merging.

When the Gitlab CI/CD pipeline is done you can now run the agent again against production (which corresponds to the master branch) if you want to double check that it doesn't do any unexpected changes:

$ sudo puppet agent --test --noop --environment=production
info

Note that you will see a diff regarding the environment cfg setting being changed in /etc/puppetlabs/puppet/puppet.conf.

You can then start the Puppet Agent again:

systemctl start puppet

If you don't want to deploy your changes, you can start the agent agin as described above without merging in your branch and the Puppet Agent will revert your changes.