File: puppet_spec.rb

package info (click to toggle)
puppet-agent 8.10.0-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 27,392 kB
  • sloc: ruby: 286,820; sh: 492; xml: 116; makefile: 88; cs: 68
file content (39 lines) | stat: -rw-r--r-- 1,101 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
require 'spec_helper_acceptance'

RSpec.context 'Augeas puppet configuration' do
  before(:all) do
    agents.each do |agent|
      on agent, "mv #{agent.puppet['confdir']}/puppet.conf /tmp/puppet.conf.bak"
    end
  end

  after(:all) do
    agents.each do |agent|
      on agent, "cat /tmp/puppet.conf.bak > #{agent.puppet['confdir']}/puppet.conf && rm /tmp/puppet.conf.bak"
    end
  end

  agents.each do |agent|
    context "on #{agent}" do
      it 'creates a new puppet config that has a master and agent section' do
        puppet_conf = <<CONF
[main]
CONF
        on agent, "echo \"#{puppet_conf}\" >> #{agent.puppet['confdir']}/puppet.conf"
      end

      it 'modifies an existing puppet config' do
        on(agent, puppet_apply('--verbose'), stdin: <<MANIFEST)
augeas { 'puppet agent noop mode':
  context => "/files#{agent.puppet['confdir']}/puppet.conf/agent",
  incl    => "/etc/puppetlabs/puppet/puppet.conf",
  lens    => 'Puppet.lns',
  changes => 'set noop true',
}
MANIFEST

        on agent, "grep 'noop=true' #{agent.puppet['confdir']}/puppet.conf"
      end
    end
  end
end