Browse Source

Fix beaker on xenial

Since the beaker jobs are being run on xenial, we need a special nodeset
for it, otherwise beaker gives an error:

 beaker-hostgenerator was not able to use this value as input.
 Exiting with an Error.

We also want to install puppet from the Ubuntu repos rather than from
puppetlabs, since puppetlabs doesn't support puppet 3 for Xenial. For
centos we can keep the install process the same.

This patch includes additional fixes for issues that were probably
present when the tests were first merged:

- make sure the irc pip package is installed by the puppet class
- use double quotes for the channels.yaml fixture so properly render the
  newline characters
- add "access" and "global" sections to the channels.yaml fixture since
  accessbot will otherwise be unable to parse the file
- remove spec assertions about the accessbot process, because if it was
  successful it should have exited during the puppet run, and in fact if
  it didn't exit the puppet run would have failed.
- correct the group name the spec is asserting of the config file

Additionally, out of band from this patch, the nick 'accessbot-test' is
nowregistered on freenode. If it's not registered, it becomes stuck in
the irc infinite loop without performing any actions. This does not mean
it has any permissions to make any real access changes.

Change-Id: Ifd2244ae9dd212b2475f9cd6adb994bc058a4769
Depends-On: I23d0a9c0f4b6ecbb3403447adb03e845d2695366
master
Colleen Murphy 2 years ago
parent
commit
593e930d71

+ 7
- 1
manifests/init.pp View File

@@ -28,6 +28,11 @@ class accessbot(
28 28
     }
29 29
   }
30 30
 
31
+  package { 'irc':
32
+    ensure   => installed,
33
+    provider => openstack_pip,
34
+  }
35
+
31 36
   exec { 'run_accessbot' :
32 37
     command     => '/usr/local/bin/accessbot -c /etc/accessbot/accessbot.config -l /etc/accessbot/channels.yaml >> /var/log/accessbot/accessbot.log 2>&1',
33 38
     path        => '/usr/local/bin:/usr/bin:/bin/',
@@ -36,7 +41,8 @@ class accessbot(
36 41
     subscribe   => File['/etc/accessbot/channels.yaml'],
37 42
     require     => [File['/etc/accessbot/channels.yaml'],
38 43
                     File['/etc/accessbot/accessbot.config'],
39
-                    File['/usr/local/bin/accessbot']],
44
+                    File['/usr/local/bin/accessbot'],
45
+                    Package['irc']],
40 46
   }
41 47
 
42 48
   file { '/etc/accessbot':

+ 1
- 10
spec/acceptance/basic_spec.rb View File

@@ -33,16 +33,7 @@ describe 'basic accessbot' do
33 33
         it { should be_file }
34 34
         it { should be_owned_by 'root' }
35 35
         it { should be_mode 440 }
36
-        it { should be_grouped_into 'accessbo' }
37
-      end
38
-
39
-    end
40
-
41
-    context 'main proccess' do
42
-
43
-      describe process("accessbot") do
44
-        its(:user) { should eq "accessbot" }
45
-        its(:args) { should match /-c accessbot.config/ }
36
+        it { should be_grouped_into 'accessbot' }
46 37
       end
47 38
 
48 39
     end

+ 1
- 1
spec/acceptance/fixtures/default.pp View File

@@ -1,6 +1,6 @@
1 1
 file { '/etc/channels.yaml':
2 2
   ensure  => file,
3
-  content => 'channels:\n  - name: openstack-rainbow-unicorn-pals',
3
+  content => "access:\n  nobody: +v\nglobal:\n  nobody:\n  - nobody\nchannels:\n  - name: openstack-rainbow-unicorn-pals",
4 4
 }
5 5
 
6 6
 class { '::accessbot':

+ 10
- 0
spec/acceptance/nodesets/nodepool-xenial.yml View File

@@ -0,0 +1,10 @@
1
+HOSTS:
2
+  ubuntu-16.04-amd64:
3
+    roles:
4
+      - master
5
+    platform: ubuntu-16.04-amd64
6
+    hypervisor: none
7
+    ip: 127.0.0.1
8
+CONFIG:
9
+  type: foss
10
+  set_env: false

+ 9
- 1
spec/spec_helper_acceptance.rb View File

@@ -2,7 +2,15 @@ require 'beaker-rspec'
2 2
 
3 3
 hosts.each do |host|
4 4
 
5
-  install_puppet
5
+  # puppet 3 isn't available from apt.puppetlabs.com so install it from the Xenial repos
6
+  on host, "which apt-get && apt-get install puppet -y", { :acceptable_exit_codes => [0,1] }
7
+  # otherwise use the beaker helpers to install the yum.puppetlabs.com repo and puppet
8
+  r = on host, "which yum",  { :acceptable_exit_codes => [0,1] }
9
+  if r.exit_code == 0
10
+    install_puppet
11
+  end
12
+  add_platform_foss_defaults(host, 'unix')
13
+
6 14
 
7 15
   on host, "mkdir -p #{host['distmoduledir']}"
8 16
 end

Loading…
Cancel
Save