beaker 5.8.1 → 6.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +0 -1
  3. data/.rubocop.yml +4 -4
  4. data/.rubocop_todo.yml +15 -17
  5. data/CHANGELOG.md +31 -1
  6. data/Rakefile +2 -10
  7. data/acceptance/fixtures/module/spec/acceptance/demo_spec.rb +6 -6
  8. data/acceptance/tests/base/host/packages.rb +0 -2
  9. data/acceptance/tests/base/host_prebuilt_steps/ssh_environment_test.rb +1 -1
  10. data/beaker.gemspec +1 -1
  11. data/docs/concepts/argument_processing_and_precedence.md +1 -1
  12. data/lib/beaker/command.rb +1 -5
  13. data/lib/beaker/host/unix/exec.rb +8 -10
  14. data/lib/beaker/host/unix/file.rb +4 -13
  15. data/lib/beaker/host/unix/pkg.rb +12 -21
  16. data/lib/beaker/host/unix.rb +0 -12
  17. data/lib/beaker/host.rb +0 -6
  18. data/lib/beaker/host_prebuilt_steps.rb +13 -23
  19. data/lib/beaker/network_manager.rb +0 -1
  20. data/lib/beaker/options/command_line_parser.rb +1 -1
  21. data/lib/beaker/options/parser.rb +2 -2
  22. data/lib/beaker/perf.rb +3 -3
  23. data/lib/beaker/platform.rb +3 -31
  24. data/lib/beaker/version.rb +1 -1
  25. data/spec/beaker/host/unix/exec_spec.rb +6 -22
  26. data/spec/beaker/host/unix/file_spec.rb +3 -31
  27. data/spec/beaker/host/unix/pkg_spec.rb +26 -41
  28. data/spec/beaker/host/unix_spec.rb +0 -8
  29. data/spec/beaker/host_prebuilt_steps_spec.rb +11 -71
  30. data/spec/beaker/options/parser_spec.rb +0 -1
  31. data/spec/beaker/platform_spec.rb +20 -50
  32. data/spec/helpers.rb +13 -28
  33. metadata +4 -20
  34. data/acceptance/fixtures/module/spec/acceptance/nodesets/fedora-18-x64.yml +0 -10
  35. data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-20-i386.repo +0 -6
  36. data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-20-x86_64.repo +0 -6
  37. data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-21-i386.repo +0 -6
  38. data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-21-x86_64.repo +0 -6
  39. data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-22-i386.repo +0 -6
  40. data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-22-x86_64.repo +0 -6
  41. data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-23-i386.repo +0 -6
  42. data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-23-x86_64.repo +0 -6
  43. data/acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-24-x86_64.repo +0 -6
  44. data/docs/how_to/hosts/cisco.md +0 -40
  45. data/docs/how_to/hosts/eos.md +0 -11
  46. data/lib/beaker/host/cisco.rb +0 -159
  47. data/lib/beaker/host/eos.rb +0 -33
  48. data/spec/beaker/host/cisco_spec.rb +0 -332
  49. data/spec/beaker/host/eos_spec.rb +0 -44
data/spec/helpers.rb CHANGED
@@ -120,32 +120,17 @@ module HostHelpers
120
120
  end
121
121
 
122
122
  module PlatformHelpers
123
- DEBIANPLATFORMS = %w[debian
124
- ubuntu
125
- cumulus
126
- huaweios]
127
-
128
- FEDORASYSTEMD = (14..39).to_a.collect! { |i| "fedora-#{i}" }
129
-
130
- SYSTEMDPLATFORMS = %w[amazon-2023
131
- el-7
132
- centos-7
133
- redhat-7
134
- oracle-7
135
- scientific-7
136
- eos-7
137
- el-8
138
- centos-8
139
- redhat-8
140
- oracle-8].concat(FEDORASYSTEMD)
141
-
142
- FEDORASYSTEMV = (1..13).to_a.collect! { |i| "fedora-#{i}" }
143
-
144
- SYSTEMVPLATFORMS = ['el-',
145
- 'centos',
146
- 'fedora',
147
- 'redhat',
148
- 'oracle',
149
- 'scientific',
150
- 'eos',].concat(FEDORASYSTEMV)
123
+ DEBIANPLATFORMS = %w[debian ubuntu]
124
+
125
+ REDHATPLATFORMS = %w[
126
+ amazon-2023
127
+ amazon-2
128
+ fedora
129
+ el-
130
+ centos
131
+ redhat
132
+ oracle
133
+ scientific
134
+ archlinux
135
+ ]
151
136
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: beaker
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.8.1
4
+ version: 6.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-05-06 00:00:00.000000000 Z
11
+ date: 2024-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fakefs
@@ -58,14 +58,14 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 2.6.0
61
+ version: 2.7.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 2.6.0
68
+ version: 2.7.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: minitar
71
71
  requirement: !ruby/object:Gem::Requirement
@@ -344,7 +344,6 @@ files:
344
344
  - acceptance/fixtures/module/spec/acceptance/nodesets/centos-64-x64.yml
345
345
  - acceptance/fixtures/module/spec/acceptance/nodesets/centos-65-x64.yml
346
346
  - acceptance/fixtures/module/spec/acceptance/nodesets/default.yml
347
- - acceptance/fixtures/module/spec/acceptance/nodesets/fedora-18-x64.yml
348
347
  - acceptance/fixtures/module/spec/acceptance/nodesets/internal-vpool.yml
349
348
  - acceptance/fixtures/module/spec/acceptance/nodesets/sles-11-x64.yml
350
349
  - acceptance/fixtures/module/spec/acceptance/nodesets/ubuntu-server-10044-x64.yml
@@ -369,15 +368,6 @@ files:
369
368
  - acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-el-6-x86_64.repo
370
369
  - acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-el-7-i386.repo
371
370
  - acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-el-7-x86_64.repo
372
- - acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-20-i386.repo
373
- - acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-20-x86_64.repo
374
- - acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-21-i386.repo
375
- - acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-21-x86_64.repo
376
- - acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-22-i386.repo
377
- - acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-22-x86_64.repo
378
- - acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-23-i386.repo
379
- - acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-23-x86_64.repo
380
- - acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-fedora-24-x86_64.repo
381
371
  - acceptance/fixtures/package/rpm/pl-puppetserver-latest-repos-pe-sles-12-x86_64.repo
382
372
  - acceptance/lib/helpers/test_helper.rb
383
373
  - acceptance/pre_suite/README.md
@@ -447,8 +437,6 @@ files:
447
437
  - docs/how_to/enabling_cross_sut_access.md
448
438
  - docs/how_to/hosts/README.md
449
439
  - docs/how_to/hosts/archlinux.md
450
- - docs/how_to/hosts/cisco.md
451
- - docs/how_to/hosts/eos.md
452
440
  - docs/how_to/hypervisors/README.md
453
441
  - docs/how_to/hypervisors/solaris.md
454
442
  - docs/how_to/install_puppet.md
@@ -501,8 +489,6 @@ files:
501
489
  - lib/beaker/host/aix/file.rb
502
490
  - lib/beaker/host/aix/group.rb
503
491
  - lib/beaker/host/aix/user.rb
504
- - lib/beaker/host/cisco.rb
505
- - lib/beaker/host/eos.rb
506
492
  - lib/beaker/host/freebsd.rb
507
493
  - lib/beaker/host/freebsd/exec.rb
508
494
  - lib/beaker/host/freebsd/pkg.rb
@@ -580,8 +566,6 @@ files:
580
566
  - spec/beaker/dsl/test_tagging_spec.rb
581
567
  - spec/beaker/dsl/wrappers_spec.rb
582
568
  - spec/beaker/host/aix_spec.rb
583
- - spec/beaker/host/cisco_spec.rb
584
- - spec/beaker/host/eos_spec.rb
585
569
  - spec/beaker/host/freebsd/exec_spec.rb
586
570
  - spec/beaker/host/freebsd/pkg_spec.rb
587
571
  - spec/beaker/host/mac/exec_spec.rb
@@ -1,10 +0,0 @@
1
- HOSTS:
2
- fedora-18-x64:
3
- roles:
4
- - master
5
- platform: fedora-18-x86_64
6
- box : fedora-18-x64-vbox4210-nocm
7
- box_url : http://puppet-vagrant-boxes.puppetlabs.com/fedora-18-x64-vbox4210-nocm.box
8
- hypervisor : vagrant
9
- CONFIG:
10
- type: foss
@@ -1,6 +0,0 @@
1
- [pl-puppetserver-latest]
2
- name=PL Repo for puppetserver at commit latest
3
- baseurl=http://nightlies.puppetlabs.com/puppetserver-latest/repos/fedora/f20/PC1/i386/
4
- enabled=1
5
- gpgcheck=1
6
- gpgkey=http://nightlies.puppetlabs.com/07BB6C57
@@ -1,6 +0,0 @@
1
- [pl-puppetserver-latest]
2
- name=PL Repo for puppetserver at commit latest
3
- baseurl=http://nightlies.puppetlabs.com/puppetserver-latest/repos/fedora/f20/PC1/x86_64/
4
- enabled=1
5
- gpgcheck=1
6
- gpgkey=http://nightlies.puppetlabs.com/07BB6C57
@@ -1,6 +0,0 @@
1
- [pl-puppetserver-latest]
2
- name=PL Repo for puppetserver at commit latest
3
- baseurl=http://nightlies.puppetlabs.com/puppetserver-latest/repos/fedora/f21/PC1/i386/
4
- enabled=1
5
- gpgcheck=1
6
- gpgkey=http://nightlies.puppetlabs.com/07BB6C57
@@ -1,6 +0,0 @@
1
- [pl-puppetserver-latest]
2
- name=PL Repo for puppetserver at commit latest
3
- baseurl=http://nightlies.puppetlabs.com/puppetserver-latest/repos/fedora/f21/PC1/x86_64/
4
- enabled=1
5
- gpgcheck=1
6
- gpgkey=http://nightlies.puppetlabs.com/07BB6C57
@@ -1,6 +0,0 @@
1
- [pl-puppetserver-latest]
2
- name=PL Repo for puppetserver at commit latest
3
- baseurl=http://nightlies.puppetlabs.com/puppetserver-latest/repos/fedora/f22/PC1/i386/
4
- enabled=1
5
- gpgcheck=1
6
- gpgkey=http://nightlies.puppetlabs.com/07BB6C57
@@ -1,6 +0,0 @@
1
- [pl-puppetserver-latest]
2
- name=PL Repo for puppetserver at commit latest
3
- baseurl=http://nightlies.puppetlabs.com/puppetserver-latest/repos/fedora/f22/PC1/x86_64/
4
- enabled=1
5
- gpgcheck=1
6
- gpgkey=http://nightlies.puppetlabs.com/07BB6C57
@@ -1,6 +0,0 @@
1
- [pl-puppetserver-latest]
2
- name=PL Repo for puppetserver at commit latest
3
- baseurl=http://nightlies.puppetlabs.com/puppetserver-latest/repos/fedora/f23/PC1/i386/
4
- enabled=1
5
- gpgcheck=1
6
- gpgkey=http://nightlies.puppetlabs.com/07BB6C57
@@ -1,6 +0,0 @@
1
- [pl-puppetserver-latest]
2
- name=PL Repo for puppetserver at commit latest
3
- baseurl=http://nightlies.puppetlabs.com/puppetserver-latest/repos/fedora/f23/PC1/x86_64/
4
- enabled=1
5
- gpgcheck=1
6
- gpgkey=http://nightlies.puppetlabs.com/07BB6C57
@@ -1,6 +0,0 @@
1
- [pl-puppetserver-latest]
2
- name=PL Repo for puppetserver at commit latest
3
- baseurl=http://nightlies.puppetlabs.com/puppetserver-latest/repos/fedora/f24/PC1/x86_64/
4
- enabled=1
5
- gpgcheck=1
6
- gpgkey=http://nightlies.puppetlabs.com/07BB6C57
@@ -1,40 +0,0 @@
1
- # Wind River Linux
2
-
3
- Wind River Linux is an embedded systems OS from Wind, an Intel Company. You can get more details on this from their [product page](http://www.windriver.com/products/linux/).
4
-
5
- Beaker provides support for 2 of Cisco's Wind River Linux platforms. Those platform codenames are `cisco_nexus` for Cisco NX-OS based systems and `cisco_ios_xr` for Cisco IOS XR based systems.
6
-
7
- Beaker currently can install puppet on Cisco Nexus and Cisco IOS XR.
8
-
9
- # Host Requirements
10
-
11
- WRLinux hosts validate their setup once created, and will fail if not setup correctly. There are two conditions that are validated specifically on WRLinux hosts. These conditions are listed below.
12
-
13
- A. All Cisco Nexus hosts will need a `:vrf` value, which determines their virtual routing framework for networking purposes. For our purposes, we tend to use the value `management`, so there is always a hosts file line that looks like this in our configuration:
14
-
15
- HOSTS:
16
- <hostname>:
17
- ...
18
- vrf: management
19
-
20
- B. All Cisco hosts will also require a user to be set on the hosts. This is because they don't allow ssh'ing as the root user, which is one of the main assumptions that Beaker operates under in the usual case. In order to specify a user to ssh with, add this block to a host:
21
-
22
- HOSTS:
23
- <hostname>:
24
- ...
25
- ssh:
26
- user: <username>
27
-
28
- # Hypervisors
29
-
30
- WRLinux has only been developed and tested as a [vmpooler](https://github.com/puppetlabs/vmpooler) host.
31
-
32
- This doesn't mean that it can't be used in another hypervisor, but that Beaker doesn't specifically deal with the details of that hypervisor in creating WRLinux hosts, if there is anything specific to WRLinux that will need to be done in provisioning steps.
33
-
34
- # Installation Methods
35
-
36
- ## Open Source
37
-
38
- In order to install a puppet-agent against a WRLinux host, you'll have to use the [`install_puppet_agent_on`](blob/master/lib/beaker/dsl/install_utils/foss_utils.rb#L327) method.
39
-
40
- It reaches out to the WRLinux-specific host code for any information that it needs. You can check out [these methods](blob/master/lib/beaker/host/cisco.rb) if you need more information about this.
@@ -1,11 +0,0 @@
1
- # EOS - Arista
2
-
3
- EOS is the network device OS from Arista. You can get more details from their [product page](https://www.arista.com/en/products/eos).
4
-
5
- It reaches out to the EOS-specific host code for any information that it needs. You can check out [these methods](blob/master/lib/beaker/host/eos.rb) if you need more information about this.
6
-
7
- # Hypervisors
8
-
9
- EOS has only been developed and tested as a [vmpooler](https://github.com/puppetlabs/vmpooler) host.
10
-
11
- This doesn't mean that it can't be used in another hypervisor, but that Beaker doesn't specifically deal with the details of that hypervisor in creating EOS hosts, if there is anything specific to EOS that will need to be done in provisioning steps.
@@ -1,159 +0,0 @@
1
- %w[host command_factory].each do |lib|
2
- require "beaker/#{lib}"
3
- end
4
-
5
- module Cisco
6
- class Host < Unix::Host
7
- # as the cisco hosts tend to have custom
8
- # ssh configuration, the presets
9
- # do not apply where verification of the
10
- # host keys is disabled
11
- def platform_defaults
12
- h = Beaker::Options::OptionsHash.new
13
- h.merge({
14
- 'ssh' => {
15
- :verify_host_key => false,
16
- },
17
- })
18
- end
19
-
20
- # Tells you whether a host platform supports beaker's
21
- # {Beaker::HostPrebuiltSteps#set_env} method
22
- #
23
- # @return [String,nil] Reason message if set_env should be skipped,
24
- # nil if it should run.
25
- def skip_set_env?
26
- 'Cisco does not allow SSH control through the BASH shell'
27
- end
28
-
29
- # Handles host operations needed after an SCP takes place
30
- #
31
- # @param [String] scp_file_actual File path to actual SCP'd file on host
32
- # @param [String] scp_file_target File path to target SCP location on host
33
- #
34
- # @return nil
35
- def scp_post_operations(scp_file_actual, scp_file_target)
36
- execute("mv #{scp_file_actual} #{scp_file_target}") if self[:platform].include?('cisco_nexus')
37
- nil
38
- end
39
-
40
- # Handles any changes needed in a path for SCP
41
- #
42
- # @param [String] path File path to SCP to
43
- #
44
- # @return [String] path, changed if needed due to host
45
- # constraints
46
- def scp_path(path)
47
- if self[:platform].include?('cisco_nexus')
48
- @home_dir ||= execute('pwd')
49
- answer = "#{@home_dir}/#{File.basename(path)}"
50
- answer << '/' if /\/$/.match?(path)
51
- return answer
52
- end
53
- path
54
- end
55
-
56
- # Gets the repo type for the given platform
57
- #
58
- # @raise [ArgumentError] For an unknown platform
59
- #
60
- # @return [String] Type of repo (rpm|deb)
61
- def repo_type
62
- 'rpm'
63
- end
64
-
65
- # Gets the config dir location for package information
66
- #
67
- # @raise [ArgumentError] For an unknown platform
68
- #
69
- # @return [String] Path to package config dir
70
- def package_config_dir
71
- '/etc/yum/repos.d/'
72
- end
73
-
74
- # Gets the specific prepend commands as needed for this host
75
- #
76
- # @param [String] command Command to be executed
77
- # @param [String] user_pc List of user-specified commands to prepend
78
- # @param [Hash] opts optional parameters
79
- #
80
- # @return [String] Command string as needed for this host
81
- def prepend_commands(command = '', user_pc = '', _opts = {})
82
- return user_pc unless command.index('vsh').nil?
83
-
84
- if self[:platform].include?('cisco_nexus')
85
- return user_pc unless command.index('ntpdate').nil?
86
- end
87
-
88
- prepend_cmds = 'source /etc/profile;'
89
- prepend_cmds << " sudo -E sh -c \"" if self[:user] != 'root'
90
- prepend_cmds << "ip netns exec #{self[:vrf]} " if self[:vrf]
91
- prepend_cmds << "#{user_pc} " if user_pc && !user_pc.empty?
92
- prepend_cmds.strip
93
- end
94
-
95
- # Gets the specific append commands as needed for this host
96
- #
97
- # @param [String] command Command to be executed
98
- # @param [String] user_ac List of user-specified commands to append
99
- # @param [Hash] opts optional parameters
100
- #
101
- # @return [String] Command string as needed for this host
102
- def append_commands(command = '', _user_ac = '', _opts = {})
103
- command.gsub('"') { '\\"' }
104
- # vsh commands, ntpdate or when user is root commands do not require an appended `"`
105
- return '"' unless /ntpdate|\/isan\/bin\/vsh/.match?(command) || self[:user] == 'root'
106
- end
107
-
108
- # Construct the environment string for this command
109
- #
110
- # @param [Hash{String=>String}] env An optional Hash containing
111
- # key-value pairs to be treated
112
- # as environment variables that
113
- # should be set for the duration
114
- # of the puppet command.
115
- #
116
- # @return [String] Returns a string containing command line arguments that
117
- # will ensure the environment is correctly set for the
118
- # given host.
119
- def environment_string env
120
- prestring = ''
121
- return prestring if env.empty?
122
-
123
- env_array = self.environment_variable_string_pair_array(env)
124
- environment_string = env_array.join(' ')
125
-
126
- prestring << if self[:platform].include?('cisco_nexus')
127
- " export"
128
- else
129
- " env"
130
- end
131
- environment_string = "#{prestring} #{environment_string}"
132
- environment_string << ';' if prestring.include?('export')
133
- environment_string
134
- end
135
-
136
- # Validates that the host was setup correctly
137
- #
138
- # @return nil
139
- # @raise [ArgumentError] If the host is setup incorrectly,
140
- # this will be raised with the appropriate message
141
- def validate_setup
142
- msg = nil
143
- if self[:platform].include?('cisco_nexus')
144
- msg = 'Cisco Nexus hosts must be provided with a :vrf value.' if !self[:vrf]
145
- msg = 'Cisco hosts must be provided with a :user value' if !self[:user]
146
- end
147
- if self[:platform].include?('cisco_ios_xr')
148
- msg = 'Cisco hosts must be provided with a :user value' if !self[:user]
149
- end
150
-
151
- return unless msg
152
-
153
- msg << <<-EOF
154
- Check https://github.com/puppetlabs/beaker/blob/master/docs/hosts/cisco.md for more info.'
155
- EOF
156
- raise ArgumentError, msg
157
- end
158
- end
159
- end
@@ -1,33 +0,0 @@
1
- %w[host command_factory].each do |lib|
2
- require "beaker/#{lib}"
3
- end
4
-
5
- module Eos
6
- class Host < Unix::Host
7
- # Copies a remote file to the host location specified
8
- #
9
- # @param [String] remote_url URL to the remote file
10
- # @param [String] host_directory Path to the host directory on the host.
11
- #
12
- # @note in EOS, you just copy the file as an extension, you don't worry
13
- # about location, so that parameter is ignored
14
- #
15
- # @return [Result] The result of copying that file to the host
16
- def get_remote_file(remote_url, _host_directory = '')
17
- commands = ['enable', "copy #{remote_url} extension:"]
18
- command = commands.join("\n")
19
- execute("Cli -c '#{command}'")
20
- end
21
-
22
- # Installs an extension file already copied via {#get_remote_file} or something similar
23
- #
24
- # @param [String] filename Name of the file to install, including file extension
25
- #
26
- # @return [Result] The result of running the install command on the host
27
- def install_from_file(filename)
28
- commands = ['enable', "extension #{filename}"]
29
- command = commands.join("\n")
30
- execute("Cli -c '#{command}'")
31
- end
32
- end
33
- end