beaker 4.41.2 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +9 -0
- data/.github/workflows/release.yml +2 -2
- data/.github/workflows/test.yml +26 -13
- data/.rubocop.yml +23 -10
- data/.rubocop_todo.yml +34 -10
- data/CHANGELOG.md +16 -52
- data/Gemfile +12 -7
- data/HISTORY.md +605 -0
- data/Rakefile +99 -111
- data/acceptance/config/acceptance-options.rb +1 -1
- data/acceptance/config/base/acceptance-options.rb +2 -2
- data/acceptance/config/hypervisor/acceptance-options.rb +2 -2
- data/acceptance/config/subcommands/acceptance-options.rb +2 -2
- data/acceptance/fixtures/module/Rakefile +1 -1
- data/acceptance/fixtures/module/spec/acceptance/demo_spec.rb +8 -12
- data/acceptance/fixtures/module/spec/classes/init_spec.rb +0 -1
- data/acceptance/fixtures/module/spec/spec_helper_acceptance.rb +3 -5
- data/acceptance/lib/helpers/test_helper.rb +6 -5
- data/acceptance/pre_suite/subcommands/05_install_ruby.rb +2 -3
- data/acceptance/pre_suite/subcommands/08_install_beaker.rb +1 -2
- data/acceptance/tests/base/dsl/helpers/configuration_test.rb +4 -4
- data/acceptance/tests/base/dsl/helpers/hocon_helpers_test.rb +1 -2
- data/acceptance/tests/base/dsl/helpers/host_helpers/add_system32_hosts_entry_test.rb +0 -3
- data/acceptance/tests/base/dsl/helpers/host_helpers/archive_file_from_test.rb +3 -1
- data/acceptance/tests/base/dsl/helpers/host_helpers/backup_the_file_test.rb +9 -9
- data/acceptance/tests/base/dsl/helpers/host_helpers/check_for_package_test.rb +0 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/create_remote_file_test.rb +19 -26
- data/acceptance/tests/base/dsl/helpers/host_helpers/curl_on_test.rb +2 -2
- data/acceptance/tests/base/dsl/helpers/host_helpers/curl_with_retries_test.rb +0 -1
- data/acceptance/tests/base/dsl/helpers/host_helpers/on_test.rb +18 -13
- data/acceptance/tests/base/dsl/helpers/host_helpers/retry_on_test.rb +3 -3
- data/acceptance/tests/base/dsl/helpers/host_helpers/rsync_to_test.rb +22 -27
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_cron_on_test.rb +12 -16
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_on_test.rb +3 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/run_script_test.rb +3 -3
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_from_test.rb +4 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/scp_to_test.rb +3 -4
- data/acceptance/tests/base/dsl/helpers/host_helpers/shell_test.rb +5 -5
- data/acceptance/tests/base/dsl/helpers/host_helpers/upgrade_package_test.rb +3 -5
- data/acceptance/tests/base/dsl/platform_tag_confiner_test.rb +14 -17
- data/acceptance/tests/base/dsl/structure_test.rb +5 -11
- data/acceptance/tests/base/host/file_test.rb +2 -2
- data/acceptance/tests/base/host/group_test.rb +0 -1
- data/acceptance/tests/base/host/host_test.rb +66 -63
- data/acceptance/tests/base/host/packages.rb +1 -2
- data/acceptance/tests/base/host/packages_unix.rb +0 -55
- data/acceptance/tests/base/host/user_test.rb +0 -1
- data/acceptance/tests/base/host_prebuilt_steps/ssh_environment_test.rb +1 -2
- data/acceptance/tests/base/test_suite/export.rb +6 -9
- data/acceptance/tests/install/from_file.rb +2 -4
- data/acceptance/tests/load_path_bootstrap.rb +1 -1
- data/acceptance/tests/subcommands/destroy.rb +19 -21
- data/acceptance/tests/subcommands/exec.rb +0 -1
- data/acceptance/tests/subcommands/init.rb +2 -3
- data/acceptance/tests/subcommands/provision.rb +0 -1
- data/beaker.gemspec +4 -7
- data/docs/concepts/argument_processing_and_precedence.md +1 -10
- data/docs/how_to/debug_beaker_tests.md +12 -12
- data/docs/how_to/hosts/eos.md +2 -12
- data/docs/how_to/install_puppet.md +0 -18
- data/docs/how_to/the_beaker_dsl.md +0 -2
- data/lib/beaker/cli.rb +59 -68
- data/lib/beaker/command.rb +20 -28
- data/lib/beaker/command_factory.rb +3 -2
- data/lib/beaker/dsl/assertions.rb +6 -18
- data/lib/beaker/dsl/helpers/hocon_helpers.rb +3 -7
- data/lib/beaker/dsl/helpers/host_helpers.rb +62 -123
- data/lib/beaker/dsl/helpers/test_helpers.rb +3 -5
- data/lib/beaker/dsl/helpers/web_helpers.rb +19 -39
- data/lib/beaker/dsl/helpers.rb +2 -4
- data/lib/beaker/dsl/outcomes.rb +13 -15
- data/lib/beaker/dsl/patterns.rb +1 -3
- data/lib/beaker/dsl/roles.rb +17 -20
- data/lib/beaker/dsl/structure.rb +53 -65
- data/lib/beaker/dsl/test_tagging.rb +7 -10
- data/lib/beaker/dsl/wrappers.rb +15 -16
- data/lib/beaker/dsl.rb +2 -3
- data/lib/beaker/host/aix/exec.rb +1 -1
- data/lib/beaker/host/aix/file.rb +0 -1
- data/lib/beaker/host/aix/group.rb +1 -1
- data/lib/beaker/host/aix/user.rb +1 -1
- data/lib/beaker/host/aix.rb +3 -4
- data/lib/beaker/host/cisco.rb +27 -39
- data/lib/beaker/host/eos.rb +4 -30
- data/lib/beaker/host/freebsd/exec.rb +1 -1
- data/lib/beaker/host/freebsd/pkg.rb +3 -3
- data/lib/beaker/host/freebsd.rb +9 -12
- data/lib/beaker/host/mac/exec.rb +4 -4
- data/lib/beaker/host/mac/group.rb +7 -7
- data/lib/beaker/host/mac/pkg.rb +3 -106
- data/lib/beaker/host/mac/user.rb +2 -2
- data/lib/beaker/host/mac.rb +8 -9
- data/lib/beaker/host/pswindows/exec.rb +66 -70
- data/lib/beaker/host/pswindows/file.rb +3 -5
- data/lib/beaker/host/pswindows/group.rb +3 -3
- data/lib/beaker/host/pswindows/pkg.rb +12 -12
- data/lib/beaker/host/pswindows/user.rb +3 -3
- data/lib/beaker/host/pswindows.rb +4 -3
- data/lib/beaker/host/unix/exec.rb +81 -83
- data/lib/beaker/host/unix/file.rb +40 -45
- data/lib/beaker/host/unix/group.rb +1 -1
- data/lib/beaker/host/unix/pkg.rb +138 -401
- data/lib/beaker/host/unix/user.rb +2 -2
- data/lib/beaker/host/unix.rb +8 -11
- data/lib/beaker/host/windows/exec.rb +17 -17
- data/lib/beaker/host/windows/file.rb +3 -3
- data/lib/beaker/host/windows/group.rb +3 -3
- data/lib/beaker/host/windows/pkg.rb +3 -54
- data/lib/beaker/host/windows/user.rb +3 -3
- data/lib/beaker/host/windows.rb +12 -12
- data/lib/beaker/host.rb +76 -133
- data/lib/beaker/host_prebuilt_steps.rb +88 -196
- data/lib/beaker/hypervisor/noop.rb +2 -4
- data/lib/beaker/hypervisor.rb +44 -61
- data/lib/beaker/local_connection.rb +2 -4
- data/lib/beaker/logger.rb +68 -76
- data/lib/beaker/logger_junit.rb +21 -25
- data/lib/beaker/network_manager.rb +39 -42
- data/lib/beaker/options/command_line_parser.rb +12 -23
- data/lib/beaker/options/hosts_file_parser.rb +16 -25
- data/lib/beaker/options/options_file_parser.rb +3 -6
- data/lib/beaker/options/options_hash.rb +2 -7
- data/lib/beaker/options/parser.rb +86 -102
- data/lib/beaker/options/presets.rb +114 -123
- data/lib/beaker/options/subcommand_options_file_parser.rb +3 -6
- data/lib/beaker/options/validator.rb +26 -31
- data/lib/beaker/perf.rb +25 -30
- data/lib/beaker/platform.rb +26 -37
- data/lib/beaker/result.rb +7 -6
- data/lib/beaker/shared/error_handler.rb +8 -10
- data/lib/beaker/shared/fog_credentials.rb +5 -9
- data/lib/beaker/shared/host_manager.rb +36 -41
- data/lib/beaker/shared/options_resolver.rb +3 -7
- data/lib/beaker/shared/repetition.rb +2 -4
- data/lib/beaker/shared/semvar.rb +37 -41
- data/lib/beaker/shared/timed.rb +0 -3
- data/lib/beaker/shared.rb +1 -1
- data/lib/beaker/ssh_connection.rb +38 -47
- data/lib/beaker/subcommand.rb +17 -24
- data/lib/beaker/subcommands/subcommand_util.rb +4 -4
- data/lib/beaker/tasks/quick_start.rb +4 -9
- data/lib/beaker/tasks/rake_task.rb +25 -27
- data/lib/beaker/tasks/test.rb +4 -4
- data/lib/beaker/test_case.rb +16 -28
- data/lib/beaker/test_suite.rb +35 -39
- data/lib/beaker/test_suite_result.rb +45 -47
- data/lib/beaker/version.rb +1 -1
- data/lib/beaker.rb +6 -7
- data/spec/beaker/cli_spec.rb +121 -142
- data/spec/beaker/command_spec.rb +55 -59
- data/spec/beaker/dsl/assertions_spec.rb +36 -36
- data/spec/beaker/dsl/helpers/host_helpers_spec.rb +110 -131
- data/spec/beaker/dsl/helpers/test_helpers_spec.rb +9 -10
- data/spec/beaker/dsl/helpers/web_helpers_spec.rb +22 -31
- data/spec/beaker/dsl/outcomes_spec.rb +14 -14
- data/spec/beaker/dsl/roles_spec.rb +125 -130
- data/spec/beaker/dsl/structure_spec.rb +172 -161
- data/spec/beaker/dsl/test_tagging_spec.rb +89 -90
- data/spec/beaker/dsl/wrappers_spec.rb +32 -33
- data/spec/beaker/host/aix_spec.rb +14 -14
- data/spec/beaker/host/cisco_spec.rb +84 -94
- data/spec/beaker/host/eos_spec.rb +15 -36
- data/spec/beaker/host/freebsd/exec_spec.rb +3 -6
- data/spec/beaker/host/freebsd/pkg_spec.rb +24 -27
- data/spec/beaker/host/mac/exec_spec.rb +2 -3
- data/spec/beaker/host/mac/group_spec.rb +48 -57
- data/spec/beaker/host/mac/user_spec.rb +54 -63
- data/spec/beaker/host/pswindows/exec_spec.rb +30 -32
- data/spec/beaker/host/pswindows/file_spec.rb +16 -16
- data/spec/beaker/host/pswindows/user_spec.rb +17 -23
- data/spec/beaker/host/pswindows_spec.rb +13 -13
- data/spec/beaker/host/unix/exec_spec.rb +75 -80
- data/spec/beaker/host/unix/file_spec.rb +66 -71
- data/spec/beaker/host/unix/pkg_spec.rb +150 -411
- data/spec/beaker/host/unix_spec.rb +11 -207
- data/spec/beaker/host/windows/exec_spec.rb +30 -32
- data/spec/beaker/host/windows/file_spec.rb +18 -19
- data/spec/beaker/host/windows/group_spec.rb +10 -12
- data/spec/beaker/host/windows/pkg_spec.rb +6 -9
- data/spec/beaker/host/windows/user_spec.rb +17 -23
- data/spec/beaker/host/windows_spec.rb +39 -39
- data/spec/beaker/host_prebuilt_steps_spec.rb +168 -349
- data/spec/beaker/host_spec.rb +204 -284
- data/spec/beaker/hypervisor/hypervisor_spec.rb +36 -61
- data/spec/beaker/localhost_connection_spec.rb +10 -11
- data/spec/beaker/logger_junit_spec.rb +19 -30
- data/spec/beaker/logger_spec.rb +153 -136
- data/spec/beaker/network_manager_spec.rb +23 -23
- data/spec/beaker/options/command_line_parser_spec.rb +20 -23
- data/spec/beaker/options/hosts_file_parser_spec.rb +30 -32
- data/spec/beaker/options/options_file_parser_spec.rb +4 -7
- data/spec/beaker/options/options_hash_spec.rb +4 -6
- data/spec/beaker/options/parser_spec.rb +167 -167
- data/spec/beaker/options/presets_spec.rb +7 -9
- data/spec/beaker/options/subcommand_options_parser_spec.rb +13 -14
- data/spec/beaker/options/validator_spec.rb +10 -11
- data/spec/beaker/perf_spec.rb +18 -21
- data/spec/beaker/platform_spec.rb +25 -50
- data/spec/beaker/shared/error_handler_spec.rb +7 -16
- data/spec/beaker/shared/fog_credentials_spec.rb +29 -29
- data/spec/beaker/shared/host_manager_spec.rb +50 -84
- data/spec/beaker/shared/options_resolver_spec.rb +9 -12
- data/spec/beaker/shared/repetition_spec.rb +17 -24
- data/spec/beaker/shared/semvar_spec.rb +21 -26
- data/spec/beaker/ssh_connection_spec.rb +76 -83
- data/spec/beaker/subcommand/subcommand_util_spec.rb +31 -33
- data/spec/beaker/subcommand_spec.rb +75 -77
- data/spec/beaker/test_case_spec.rb +25 -50
- data/spec/beaker/test_suite_spec.rb +147 -154
- data/spec/helpers.rb +39 -45
- data/spec/matchers.rb +8 -7
- data/spec/mocks.rb +1 -6
- data/spec/spec_helper.rb +0 -1
- metadata +8 -24
- data/acceptance/tests/base/dsl/helpers/host_helpers/deploy_package_repo_test.rb +0 -142
- data/acceptance/tests/base/external_resources_test.rb +0 -31
- data/spec/beaker/host/mac_spec.rb +0 -113
data/lib/beaker/host/unix/pkg.rb
CHANGED
|
@@ -16,47 +16,45 @@ module Unix::Pkg
|
|
|
16
16
|
# even if the command didn't exist, so it'll return a 0 exit code in
|
|
17
17
|
# either case. Instead we match for the phrase output when a match isn't
|
|
18
18
|
# found: "no #{name} in $PATH", reversing it to match our API
|
|
19
|
-
!(
|
|
19
|
+
!(result.stdout.match(/^no\ #{name}\ in\ /))
|
|
20
20
|
else
|
|
21
21
|
result.exit_code == 0
|
|
22
22
|
end
|
|
23
23
|
end
|
|
24
24
|
|
|
25
25
|
def check_for_package(name, opts = {})
|
|
26
|
-
opts = {:accept_all_exit_codes => true}.merge(opts)
|
|
26
|
+
opts = { :accept_all_exit_codes => true }.merge(opts)
|
|
27
27
|
case self['platform']
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
else
|
|
59
|
-
raise "Package #{name} cannot be queried on #{self}"
|
|
28
|
+
when /sles-10/
|
|
29
|
+
result = execute("zypper se -i --match-exact #{name}", opts) { |result| result }
|
|
30
|
+
result.stdout.include?('No packages found') ? (return false) : (return result.exit_code == 0)
|
|
31
|
+
when /opensuse|sles-/
|
|
32
|
+
if !self[:sles_rpmkeys_nightly_pl_imported]
|
|
33
|
+
# The `:sles_rpmkeys_nightly_pl_imported` key is only read here at this
|
|
34
|
+
# time. It's just to make sure that we only do the key import once, &
|
|
35
|
+
# isn't for setting or use outside of beaker.
|
|
36
|
+
execute('rpmkeys --import http://nightlies.puppetlabs.com/07BB6C57', opts)
|
|
37
|
+
self[:sles_rpmkeys_nightly_pl_imported] = true
|
|
38
|
+
end
|
|
39
|
+
result = execute("zypper --gpg-auto-import-keys se -i --match-exact #{name}", opts) { |result| result }
|
|
40
|
+
when /el-4/
|
|
41
|
+
@logger.debug("Package query not supported on rhel4")
|
|
42
|
+
return false
|
|
43
|
+
when /cisco|fedora|centos|redhat|eos|el-/
|
|
44
|
+
result = execute("rpm -q #{name}", opts) { |result| result }
|
|
45
|
+
when /ubuntu|debian|cumulus|huaweios/
|
|
46
|
+
result = execute("dpkg -s #{name}", opts) { |result| result }
|
|
47
|
+
when /solaris-11/
|
|
48
|
+
result = execute("pkg info #{name}", opts) { |result| result }
|
|
49
|
+
when /solaris-10/
|
|
50
|
+
result = execute("pkginfo #{name}", opts) { |result| result }
|
|
51
|
+
result = execute("pkginfo CSW#{name}", opts) { |result| result } if result.exit_code == 1
|
|
52
|
+
when /openbsd/
|
|
53
|
+
result = execute("pkg_info #{name}", opts) { |result| result }
|
|
54
|
+
when /archlinux/
|
|
55
|
+
result = execute("pacman -Q #{name}", opts) { |result| result }
|
|
56
|
+
else
|
|
57
|
+
raise "Package #{name} cannot be queried on #{self}"
|
|
60
58
|
end
|
|
61
59
|
result.exit_code == 0
|
|
62
60
|
end
|
|
@@ -64,98 +62,91 @@ module Unix::Pkg
|
|
|
64
62
|
# If apt has not been updated since the last repo deployment it is
|
|
65
63
|
# updated. Otherwise this is a noop
|
|
66
64
|
def update_apt_if_needed
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
end
|
|
65
|
+
return unless /debian|ubuntu|cumulus|huaweios/.match?(self['platform'])
|
|
66
|
+
return unless @apt_needs_update
|
|
67
|
+
|
|
68
|
+
execute("apt-get update")
|
|
69
|
+
@apt_needs_update = false
|
|
73
70
|
end
|
|
74
71
|
|
|
75
72
|
# Arch Linux is a rolling release distribution. We need to ensure that it is up2date
|
|
76
73
|
# Except for the kernel. An upgrade will purge the modules for the currently running kernel
|
|
77
74
|
# Before upgrading packages, we need to ensure we've the latest keyring
|
|
78
75
|
def update_pacman_if_needed
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
end
|
|
76
|
+
return unless self['platform'].include?('archlinux')
|
|
77
|
+
return unless @pacman_needs_update
|
|
78
|
+
|
|
79
|
+
execute("pacman --sync --noconfirm --noprogressbar --refresh archlinux-keyring")
|
|
80
|
+
execute("pacman --sync --noconfirm --noprogressbar --refresh --sysupgrade --ignore linux --ignore linux-docs --ignore linux-headers")
|
|
81
|
+
@pacman_needs_update = false
|
|
86
82
|
end
|
|
87
83
|
|
|
88
84
|
def install_package(name, cmdline_args = '', version = nil, opts = {})
|
|
89
85
|
case self['platform']
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
raise ArgumentException
|
|
145
|
-
end
|
|
146
|
-
# If the package advises symlinks to be created, do it
|
|
147
|
-
command.stdout.split("\n").select { |x| /^\s+ln\s/.match?(x) }.each do |ln|
|
|
148
|
-
execute(ln, opts)
|
|
149
|
-
end
|
|
86
|
+
when /opensuse|sles-/
|
|
87
|
+
execute("zypper --non-interactive --gpg-auto-import-keys in #{name}", opts)
|
|
88
|
+
when /el-4/
|
|
89
|
+
@logger.debug("Package installation not supported on rhel4")
|
|
90
|
+
when /fedora-(2[2-9]|3[0-9])/
|
|
91
|
+
name = "#{name}-#{version}" if version
|
|
92
|
+
execute("dnf -y #{cmdline_args} install #{name}", opts)
|
|
93
|
+
when /cisco|fedora|centos|redhat|eos|el-/
|
|
94
|
+
name = "#{name}-#{version}" if version
|
|
95
|
+
execute("yum -y #{cmdline_args} install #{name}", opts)
|
|
96
|
+
when /ubuntu|debian|cumulus|huaweios/
|
|
97
|
+
name = "#{name}=#{version}" if version
|
|
98
|
+
update_apt_if_needed
|
|
99
|
+
execute("apt-get install --force-yes #{cmdline_args} -y #{name}", opts)
|
|
100
|
+
when /solaris-11/
|
|
101
|
+
if opts[:acceptable_exit_codes]
|
|
102
|
+
opts[:acceptable_exit_codes] << 4
|
|
103
|
+
else
|
|
104
|
+
opts[:acceptable_exit_codes] = [0, 4] unless opts[:accept_all_exit_codes]
|
|
105
|
+
end
|
|
106
|
+
execute("pkg #{cmdline_args} install #{name}", opts)
|
|
107
|
+
when /solaris-10/
|
|
108
|
+
if !check_for_command('pkgutil')
|
|
109
|
+
# https://www.opencsw.org/package/pkgutil/
|
|
110
|
+
noask_text = self.noask_file_text
|
|
111
|
+
noask_file = File.join(external_copy_base, 'noask')
|
|
112
|
+
create_remote_file(self, noask_file, noask_text)
|
|
113
|
+
execute("pkgadd -d http://get.opencsw.org/now -a #{noask_file} -n all", opts)
|
|
114
|
+
execute('/opt/csw/bin/pkgutil -U', opts)
|
|
115
|
+
execute('/opt/csw/bin/pkgutil -y -i pkgutil', opts)
|
|
116
|
+
end
|
|
117
|
+
execute("pkgutil -i -y #{cmdline_args} #{name}", opts)
|
|
118
|
+
when /openbsd/
|
|
119
|
+
begin
|
|
120
|
+
execute("pkg_add -I #{cmdline_args} #{name}", opts) do |command|
|
|
121
|
+
# Handles where there are multiple rubies, installs the latest one
|
|
122
|
+
if (match = /^Ambiguous: #{name} could be (.+)$/.match(command.stderr))
|
|
123
|
+
name = match[1].chomp.split(' ').collect do |x|
|
|
124
|
+
# FIXME: Ruby 3.2 compatibility?
|
|
125
|
+
x =~ /-(\d[^-p]+)/
|
|
126
|
+
[x, $1]
|
|
127
|
+
end.select do |x|
|
|
128
|
+
# Blacklist Ruby 2.2.0+ for the sake of Puppet 3.x
|
|
129
|
+
Gem::Version.new(x[1]) < Gem::Version.new('2.2.0')
|
|
130
|
+
end.sort do |a, b|
|
|
131
|
+
Gem::Version.new(b[1]) <=> Gem::Version.new(a[1])
|
|
132
|
+
end.collect do |x|
|
|
133
|
+
x[0]
|
|
134
|
+
end.first
|
|
135
|
+
raise ArgumentException
|
|
136
|
+
end
|
|
137
|
+
# If the package advises symlinks to be created, do it
|
|
138
|
+
command.stdout.split("\n").select { |x| /^\s+ln\s/.match?(x) }.each do |ln|
|
|
139
|
+
execute(ln, opts)
|
|
150
140
|
end
|
|
151
|
-
rescue
|
|
152
|
-
retry
|
|
153
141
|
end
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
142
|
+
rescue
|
|
143
|
+
retry
|
|
144
|
+
end
|
|
145
|
+
when /archlinux/
|
|
146
|
+
update_pacman_if_needed
|
|
147
|
+
execute("pacman -S --noconfirm #{cmdline_args} #{name}", opts)
|
|
148
|
+
else
|
|
149
|
+
raise "Package #{name} cannot be installed on #{self}"
|
|
159
150
|
end
|
|
160
151
|
end
|
|
161
152
|
|
|
@@ -171,9 +162,7 @@ module Unix::Pkg
|
|
|
171
162
|
# @api public
|
|
172
163
|
def install_package_with_rpm(name, cmdline_args = '', opts = {})
|
|
173
164
|
proxy = ''
|
|
174
|
-
if name&.start_with?('http') and opts[:package_proxy]
|
|
175
|
-
proxy = extract_rpm_proxy_options(opts[:package_proxy])
|
|
176
|
-
end
|
|
165
|
+
proxy = extract_rpm_proxy_options(opts[:package_proxy]) if name&.start_with?('http') and opts[:package_proxy]
|
|
177
166
|
execute("rpm #{cmdline_args} -Uvh #{name} #{proxy}")
|
|
178
167
|
end
|
|
179
168
|
|
|
@@ -183,7 +172,7 @@ module Unix::Pkg
|
|
|
183
172
|
execute("zypper --non-interactive rm #{name}", opts)
|
|
184
173
|
when /el-4/
|
|
185
174
|
@logger.debug("Package uninstallation not supported on rhel4")
|
|
186
|
-
when /
|
|
175
|
+
when /edora-(2[2-9]|3[0-9])/
|
|
187
176
|
execute("dnf -y #{cmdline_args} remove #{name}", opts)
|
|
188
177
|
when /cisco|fedora|centos|redhat|eos|el-/
|
|
189
178
|
execute("yum -y #{cmdline_args} remove #{name}", opts)
|
|
@@ -209,115 +198,37 @@ module Unix::Pkg
|
|
|
209
198
|
# the package manager
|
|
210
199
|
def upgrade_package(name, cmdline_args = '', opts = {})
|
|
211
200
|
case self['platform']
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
else
|
|
227
|
-
opts[:acceptable_exit_codes] = [0, 4] unless opts[:accept_all_exit_codes]
|
|
228
|
-
end
|
|
229
|
-
execute("pkg #{cmdline_args} update #{name}", opts)
|
|
230
|
-
when /solaris-10/
|
|
231
|
-
execute("pkgutil -u -y #{cmdline_args} #{name}", opts)
|
|
232
|
-
else
|
|
233
|
-
raise "Package #{name} cannot be upgraded on #{self}"
|
|
234
|
-
end
|
|
235
|
-
end
|
|
236
|
-
|
|
237
|
-
# Deploy apt configuration generated by the packaging tooling
|
|
238
|
-
#
|
|
239
|
-
# @note Due to the debian use of codenames in repos, the
|
|
240
|
-
# DEBIAN_PLATFORM_CODENAMES map must be kept up-to-date as
|
|
241
|
-
# support for new versions is added.
|
|
242
|
-
#
|
|
243
|
-
# @note See {Beaker::DSL::Helpers::HostHelpers#deploy_package_repo} for info on
|
|
244
|
-
# params
|
|
245
|
-
# @deprecated no longer used in beaker, beaker-puppet, or beaker-pe
|
|
246
|
-
# @visibility private
|
|
247
|
-
def deploy_apt_repo(path, name, version)
|
|
248
|
-
codename = self['platform'].codename
|
|
249
|
-
|
|
250
|
-
if codename.nil?
|
|
251
|
-
@logger.warn "Could not determine codename for debian platform #{self['platform']}. Skipping deployment of repo #{name}"
|
|
252
|
-
return
|
|
253
|
-
end
|
|
254
|
-
|
|
255
|
-
repo_file = "#{path}/deb/pl-#{name}-#{version}-#{codename}.list"
|
|
256
|
-
do_scp_to repo_file, "/etc/apt/sources.list.d/#{name}.list", {}
|
|
257
|
-
@apt_needs_update = true
|
|
258
|
-
end
|
|
259
|
-
|
|
260
|
-
# Deploy yum configuration generated by the packaging tooling
|
|
261
|
-
#
|
|
262
|
-
# @note See {Beaker::DSL::Helpers::HostHelpers#deploy_package_repo} for info on
|
|
263
|
-
# params
|
|
264
|
-
# @deprecated no longer used in beaker, beaker-puppet, or beaker-pe
|
|
265
|
-
# @visibility private
|
|
266
|
-
def deploy_yum_repo(path, name, version)
|
|
267
|
-
repo_file = "#{path}/rpm/pl-#{name}-#{version}-repos-pe-#{self['platform']}.repo"
|
|
268
|
-
do_scp_to repo_file, "/etc/yum.repos.d/#{name}.repo", {}
|
|
269
|
-
end
|
|
270
|
-
|
|
271
|
-
# Deploy zypper repo configuration generated by the packaging tooling
|
|
272
|
-
#
|
|
273
|
-
# @note See {Beaker::DSL::Helpers::HostHelpers#deploy_package_repo} for info on
|
|
274
|
-
# params
|
|
275
|
-
# @deprecated no longer used in beaker, beaker-puppet, or beaker-pe
|
|
276
|
-
# @visibility private
|
|
277
|
-
def deploy_zyp_repo(path, name, version)
|
|
278
|
-
repo_file = "#{path}/rpm/pl-#{name}-#{version}-repos-pe-#{self['platform']}.repo"
|
|
279
|
-
repo = IniFile.load(repo_file)
|
|
280
|
-
repo_name = repo.sections[0]
|
|
281
|
-
repo_url = repo[repo_name]["baseurl"]
|
|
282
|
-
execute("zypper ar -t YUM #{repo_url} #{repo_name}")
|
|
283
|
-
end
|
|
284
|
-
|
|
285
|
-
# Deploy configuration generated by the packaging tooling to this host.
|
|
286
|
-
#
|
|
287
|
-
# This method calls one of #deploy_apt_repo, #deploy_yum_repo, or
|
|
288
|
-
# #deploy_zyp_repo depending on the platform of this Host.
|
|
289
|
-
#
|
|
290
|
-
# @note See {Beaker::DSL::Helpers::HostHelpers#deploy_package_repo} for info on
|
|
291
|
-
# params
|
|
292
|
-
# @deprecated no longer used in beaker, beaker-puppet, or beaker-pe
|
|
293
|
-
# @visibility private
|
|
294
|
-
def deploy_package_repo(path, name, version)
|
|
295
|
-
if not File.exist? path
|
|
296
|
-
@logger.warn "Was asked to deploy package repository from #{path}, but it doesn't exist!"
|
|
297
|
-
return
|
|
298
|
-
end
|
|
299
|
-
|
|
300
|
-
case self['platform']
|
|
301
|
-
when /el-4/
|
|
302
|
-
@logger.debug("Package repo deploy is not supported on rhel4")
|
|
303
|
-
when /fedora|centos|redhat|eos|el-/
|
|
304
|
-
deploy_yum_repo(path, name, version)
|
|
305
|
-
when /ubuntu|debian|cumulus|huaweios/
|
|
306
|
-
deploy_apt_repo(path, name, version)
|
|
307
|
-
when /opensuse|sles/
|
|
308
|
-
deploy_zyp_repo(path, name, version)
|
|
201
|
+
when /opensuse|sles-/
|
|
202
|
+
execute("zypper --non-interactive --no-gpg-checks up #{name}", opts)
|
|
203
|
+
when /el-4/
|
|
204
|
+
@logger.debug("Package upgrade is not supported on rhel4")
|
|
205
|
+
when /fedora-(2[2-9]|3[0-9])/
|
|
206
|
+
execute("dnf -y #{cmdline_args} update #{name}", opts)
|
|
207
|
+
when /cisco|fedora|centos|redhat|eos|el-/
|
|
208
|
+
execute("yum -y #{cmdline_args} update #{name}", opts)
|
|
209
|
+
when /ubuntu|debian|cumulus|huaweios/
|
|
210
|
+
update_apt_if_needed
|
|
211
|
+
execute("apt-get install -o Dpkg::Options::='--force-confold' #{cmdline_args} -y --force-yes #{name}", opts)
|
|
212
|
+
when /solaris-11/
|
|
213
|
+
if opts[:acceptable_exit_codes]
|
|
214
|
+
opts[:acceptable_exit_codes] << 4
|
|
309
215
|
else
|
|
310
|
-
|
|
311
|
-
|
|
216
|
+
opts[:acceptable_exit_codes] = [0, 4] unless opts[:accept_all_exit_codes]
|
|
217
|
+
end
|
|
218
|
+
execute("pkg #{cmdline_args} update #{name}", opts)
|
|
219
|
+
when /solaris-10/
|
|
220
|
+
execute("pkgutil -u -y #{cmdline_args} #{name}", opts)
|
|
221
|
+
else
|
|
222
|
+
raise "Package #{name} cannot be upgraded on #{self}"
|
|
312
223
|
end
|
|
313
224
|
end
|
|
314
225
|
|
|
315
|
-
#Examine the host system to determine the architecture
|
|
316
|
-
|
|
226
|
+
# Examine the host system to determine the architecture
|
|
227
|
+
# @return [Boolean] true if x86_64, false otherwise
|
|
317
228
|
def determine_if_x86_64
|
|
318
229
|
if self[:platform].include?('solaris')
|
|
319
230
|
result = exec(Beaker::Command.new("uname -a | grep x86_64"), :accept_all_exit_codes => true)
|
|
320
|
-
|
|
231
|
+
result.exit_code == 0
|
|
321
232
|
else
|
|
322
233
|
result = exec(Beaker::Command.new("arch | grep x86_64"), :accept_all_exit_codes => true)
|
|
323
234
|
result.exit_code == 0
|
|
@@ -334,189 +245,15 @@ module Unix::Pkg
|
|
|
334
245
|
# @api private
|
|
335
246
|
def extract_rpm_proxy_options(url)
|
|
336
247
|
begin
|
|
337
|
-
host, port = url.match(/https?:\/\/(.*):(\d*)/)[1,2]
|
|
248
|
+
host, port = url.match(/https?:\/\/(.*):(\d*)/)[1, 2]
|
|
338
249
|
raise if host.empty? or port.empty?
|
|
250
|
+
|
|
339
251
|
"--httpproxy #{host} --httpport #{port}"
|
|
340
252
|
rescue
|
|
341
253
|
raise "Cannot extract host and port from '#{url}'"
|
|
342
254
|
end
|
|
343
255
|
end
|
|
344
256
|
|
|
345
|
-
# Gets the path & file name for the puppet agent dev package on Unix
|
|
346
|
-
#
|
|
347
|
-
# @param [String] puppet_collection Name of the puppet collection to use
|
|
348
|
-
# @param [String] puppet_agent_version Version of puppet agent to get
|
|
349
|
-
# @param [Hash{Symbol=>String}] opts Options hash to provide extra values
|
|
350
|
-
#
|
|
351
|
-
# @note Solaris does require :download_url to be set on the opts argument
|
|
352
|
-
# in order to check for builds on the builds server
|
|
353
|
-
#
|
|
354
|
-
# @raise [ArgumentError] If one of the two required parameters (puppet_collection,
|
|
355
|
-
# puppet_agent_version) is either not passed or set to nil
|
|
356
|
-
#
|
|
357
|
-
# @return [String, String] Path to the directory and filename of the package, respectively
|
|
358
|
-
def solaris_puppet_agent_dev_package_info( puppet_collection = nil, puppet_agent_version = nil, opts = {} )
|
|
359
|
-
error_message = "Must provide %s argument to get puppet agent package information"
|
|
360
|
-
raise ArgumentError, error_message % "puppet_collection" unless puppet_collection
|
|
361
|
-
raise ArgumentError, error_message % "puppet_agent_version" unless puppet_agent_version
|
|
362
|
-
raise ArgumentError, error_message % "opts[:download_url]" unless opts[:download_url]
|
|
363
|
-
|
|
364
|
-
variant, version, arch, _codename = self['platform'].to_array
|
|
365
|
-
|
|
366
|
-
version = version.split('.')[0] # packages are only published for major versions
|
|
367
|
-
|
|
368
|
-
platform_error = "Incorrect platform '#{variant}' for #solaris_puppet_agent_dev_package_info"
|
|
369
|
-
raise ArgumentError, platform_error if variant != 'solaris'
|
|
370
|
-
|
|
371
|
-
if arch == 'x86_64'
|
|
372
|
-
arch = 'i386'
|
|
373
|
-
end
|
|
374
|
-
release_path_end = "solaris/#{version}/#{puppet_collection}"
|
|
375
|
-
solaris_revision_conjunction = '-'
|
|
376
|
-
revision = '1'
|
|
377
|
-
if version == '10'
|
|
378
|
-
solaris_release_version = ''
|
|
379
|
-
pkg_suffix = 'pkg.gz'
|
|
380
|
-
solaris_name_conjunction = '-'
|
|
381
|
-
component_version = puppet_agent_version
|
|
382
|
-
elsif version == '11'
|
|
383
|
-
# Ref:
|
|
384
|
-
# http://www.oracle.com/technetwork/articles/servers-storage-admin/ips-package-versioning-2232906.html
|
|
385
|
-
#
|
|
386
|
-
# Example to show package name components:
|
|
387
|
-
# Full package name: puppet-agent@1.2.5.38.6813,5.11-1.sparc.p5p
|
|
388
|
-
# Schema: <component-name><solaris_name_conjunction><component_version><solaris_release_version><solaris_revision_conjunction><revision>.<arch>.<pkg_suffix>
|
|
389
|
-
solaris_release_version = ',5.11' # injecting comma to prevent from adding another var
|
|
390
|
-
pkg_suffix = 'p5p'
|
|
391
|
-
solaris_name_conjunction = '@'
|
|
392
|
-
component_version = puppet_agent_version.dup
|
|
393
|
-
component_version.gsub!(/[a-zA-Z]/, '')
|
|
394
|
-
component_version.gsub!(/(^-)|(-$)/, '')
|
|
395
|
-
# Here we strip leading 0 from version components but leave
|
|
396
|
-
# singular 0 on their own.
|
|
397
|
-
component_version = component_version.split('-').join('.')
|
|
398
|
-
component_version = component_version.split('.').map(&:to_i).join('.')
|
|
399
|
-
end
|
|
400
|
-
release_file_base = "puppet-agent#{solaris_name_conjunction}#{component_version}#{solaris_release_version}"
|
|
401
|
-
release_file_end = "#{arch}.#{pkg_suffix}"
|
|
402
|
-
release_file = "#{release_file_base}#{solaris_revision_conjunction}#{revision}.#{release_file_end}"
|
|
403
|
-
if not link_exists?("#{opts[:download_url]}/#{release_path_end}/#{release_file}")
|
|
404
|
-
release_file = "#{release_file_base}.#{release_file_end}"
|
|
405
|
-
end
|
|
406
|
-
return release_path_end, release_file
|
|
407
|
-
end
|
|
408
|
-
|
|
409
|
-
# Gets the path & file name for the puppet agent dev package on Unix
|
|
410
|
-
#
|
|
411
|
-
# @param [String] puppet_collection Name of the puppet collection to use
|
|
412
|
-
# @param [String] puppet_agent_version Version of puppet agent to get
|
|
413
|
-
# @param [Hash{Symbol=>String}] opts Options hash to provide extra values
|
|
414
|
-
#
|
|
415
|
-
# @note Solaris & OSX do require some options to be set. See
|
|
416
|
-
# {#solaris_puppet_agent_dev_package_info} &
|
|
417
|
-
# {Mac::Pkg#puppet_agent_dev_package_info} for more details
|
|
418
|
-
#
|
|
419
|
-
# @raise [ArgumentError] If one of the two required parameters (puppet_collection,
|
|
420
|
-
# puppet_agent_version) is either not passed or set to nil
|
|
421
|
-
#
|
|
422
|
-
# @return [String, String] Path to the directory and filename of the package, respectively
|
|
423
|
-
def puppet_agent_dev_package_info( puppet_collection = nil, puppet_agent_version = nil, opts = {} )
|
|
424
|
-
error_message = "Must provide %s argument to get puppet agent dev package information"
|
|
425
|
-
raise ArgumentError, error_message % "puppet_collection" unless puppet_collection
|
|
426
|
-
raise ArgumentError, error_message % "puppet_agent_version" unless puppet_agent_version
|
|
427
|
-
|
|
428
|
-
variant, version, arch, _codename = self['platform'].to_array
|
|
429
|
-
|
|
430
|
-
case variant
|
|
431
|
-
when /^(solaris)$/
|
|
432
|
-
release_path_end, release_file = solaris_puppet_agent_dev_package_info(
|
|
433
|
-
puppet_collection, puppet_agent_version, opts )
|
|
434
|
-
when /^(opensuse|sles|aix|el|centos|oracle|redhat|scientific)$/
|
|
435
|
-
variant = 'el' if variant.match?(/(?:el|centos|oracle|redhat|scientific)/)
|
|
436
|
-
variant = 'sles' if variant == 'opensuse'
|
|
437
|
-
|
|
438
|
-
if variant == 'aix'
|
|
439
|
-
arch = 'ppc' if arch == 'power'
|
|
440
|
-
version_x, version_y = /^(\d+)\.(\d+)/.match(puppet_agent_version).captures.map(&:to_i)
|
|
441
|
-
if version_x < 5 || version_x == 5 && version_y < 99 # 5.99.z indicates pre-release puppet6
|
|
442
|
-
version = '7.1' if version == '7.2'
|
|
443
|
-
else
|
|
444
|
-
version = '6.1'
|
|
445
|
-
end
|
|
446
|
-
end
|
|
447
|
-
release_path_end = "#{variant}/#{version}/#{puppet_collection}/#{arch}"
|
|
448
|
-
release_file = "puppet-agent-#{puppet_agent_version}-1.#{variant}#{version}.#{arch}.rpm"
|
|
449
|
-
else
|
|
450
|
-
msg = "puppet_agent dev package info unknown for platform '#{self['platform']}'"
|
|
451
|
-
raise ArgumentError, msg
|
|
452
|
-
end
|
|
453
|
-
return release_path_end, release_file
|
|
454
|
-
end
|
|
455
|
-
|
|
456
|
-
# Gets host-specific information for PE promoted puppet-agent packages
|
|
457
|
-
#
|
|
458
|
-
# @param [String] puppet_collection Name of the puppet collection to use
|
|
459
|
-
# @param [Hash{Symbol=>String}] opts Options hash to provide extra values
|
|
460
|
-
#
|
|
461
|
-
# @return [String, String, String] Host-specific information for packages
|
|
462
|
-
# 1. release_path_end Suffix for the release_path. Used on Windows. Check
|
|
463
|
-
# {Windows::Pkg#pe_puppet_agent_promoted_package_info} to see usage.
|
|
464
|
-
# 2. release_file Path to the file on release build servers
|
|
465
|
-
# 3. download_file Filename for the package itself
|
|
466
|
-
def pe_puppet_agent_promoted_package_info( puppet_collection = nil, _opts = {} )
|
|
467
|
-
error_message = "Must provide %s argument to get puppet agent dev package information"
|
|
468
|
-
raise ArgumentError, error_message % "puppet_collection" unless puppet_collection
|
|
469
|
-
|
|
470
|
-
variant, version, arch, codename = self['platform'].to_array
|
|
471
|
-
case variant
|
|
472
|
-
when /^(fedora|el|centos|redhat|opensuse|sles)$/
|
|
473
|
-
variant = ((['centos', 'redhat'].include?(variant)) ? 'el' : variant)
|
|
474
|
-
release_file = "/repos/#{variant}/#{version}/#{puppet_collection}/#{arch}/puppet-agent-*.rpm"
|
|
475
|
-
download_file = "puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
|
|
476
|
-
when /^(debian|ubuntu|cumulus)$/
|
|
477
|
-
if arch == 'x86_64'
|
|
478
|
-
arch = 'amd64'
|
|
479
|
-
end
|
|
480
|
-
version = version[0,2] + '.' + version[2,2] if (variant.include?('ubuntu') && !version.include?("."))
|
|
481
|
-
release_file = "/repos/apt/#{codename}/pool/#{puppet_collection}/p/puppet-agent/puppet-agent*#{arch}.deb"
|
|
482
|
-
download_file = "puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
|
|
483
|
-
when /^solaris$/
|
|
484
|
-
if arch == 'x86_64'
|
|
485
|
-
arch = 'i386'
|
|
486
|
-
end
|
|
487
|
-
release_file = "/repos/solaris/#{version}/#{puppet_collection}/"
|
|
488
|
-
download_file = "puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
|
|
489
|
-
else
|
|
490
|
-
raise "No pe-promoted installation step for #{variant} yet..."
|
|
491
|
-
end
|
|
492
|
-
return '', release_file, download_file
|
|
493
|
-
end
|
|
494
|
-
|
|
495
|
-
# Installs a given PE promoted package on a host
|
|
496
|
-
#
|
|
497
|
-
# @param [String] onhost_copy_base Base copy directory on the host
|
|
498
|
-
# @param [String] onhost_copied_download Downloaded file path on the host
|
|
499
|
-
# @param [String] onhost_copied_file Copied file path once un-compressed
|
|
500
|
-
# @param [String] download_file File name of the downloaded file
|
|
501
|
-
# @param [Hash{Symbol=>String}] opts additional options
|
|
502
|
-
#
|
|
503
|
-
# @return nil
|
|
504
|
-
def pe_puppet_agent_promoted_package_install(
|
|
505
|
-
onhost_copy_base, onhost_copied_download, onhost_copied_file, download_file, _opts
|
|
506
|
-
)
|
|
507
|
-
uncompress_local_tarball( onhost_copied_download, onhost_copy_base, download_file )
|
|
508
|
-
if /^solaris/.match?(self['platform'])
|
|
509
|
-
# above uncompresses the install from .tar.gz -> .p5p into the
|
|
510
|
-
# onhost_copied_file directory w/a weird name. We have to read that file
|
|
511
|
-
# name from the filesystem, so that we can provide it to install_local...
|
|
512
|
-
pkg_filename = execute( "ls #{onhost_copied_file}" )
|
|
513
|
-
onhost_copied_file = "#{onhost_copied_file}#{pkg_filename}"
|
|
514
|
-
end
|
|
515
|
-
|
|
516
|
-
install_local_package( onhost_copied_file, onhost_copy_base )
|
|
517
|
-
nil
|
|
518
|
-
end
|
|
519
|
-
|
|
520
257
|
# Installs a package already located on a SUT
|
|
521
258
|
#
|
|
522
259
|
# @param [String] onhost_package_file Path to the package file to install
|
|
@@ -527,9 +264,9 @@ module Unix::Pkg
|
|
|
527
264
|
def install_local_package(onhost_package_file, onhost_copy_dir = nil)
|
|
528
265
|
variant, version, _arch, _codename = self['platform'].to_array
|
|
529
266
|
case variant
|
|
530
|
-
when /^(
|
|
267
|
+
when /^(fedora|el|redhat|centos)$/
|
|
531
268
|
command_name = 'yum'
|
|
532
|
-
command_name = 'dnf' if
|
|
269
|
+
command_name = 'dnf' if variant == 'fedora' && version.to_i > 21
|
|
533
270
|
execute("#{command_name} --nogpgcheck localinstall -y #{onhost_package_file}")
|
|
534
271
|
when /^(opensuse|sles)$/
|
|
535
272
|
execute("zypper --non-interactive --no-gpg-checks in #{onhost_package_file}")
|
|
@@ -537,9 +274,9 @@ module Unix::Pkg
|
|
|
537
274
|
execute("dpkg -i --force-all #{onhost_package_file}")
|
|
538
275
|
execute("apt-get update")
|
|
539
276
|
when /^solaris$/
|
|
540
|
-
self.solaris_install_local_package(
|
|
277
|
+
self.solaris_install_local_package(onhost_package_file, onhost_copy_dir)
|
|
541
278
|
when /^osx$/
|
|
542
|
-
install_package(
|
|
279
|
+
install_package(onhost_package_file)
|
|
543
280
|
else
|
|
544
281
|
msg = "Platform #{variant} is not supported by the method "
|
|
545
282
|
msg << 'install_local_package'
|
|
@@ -557,7 +294,7 @@ module Unix::Pkg
|
|
|
557
294
|
def uncompress_local_tarball(onhost_tar_file, onhost_base_dir, download_file)
|
|
558
295
|
variant, version, _arch, _codename = self['platform'].to_array
|
|
559
296
|
case variant
|
|
560
|
-
when /^(
|
|
297
|
+
when /^(fedora|el|centos|redhat|opensuse|sles|debian|ubuntu|cumulus)$/
|
|
561
298
|
execute("tar -zxvf #{onhost_tar_file} -C #{onhost_base_dir}")
|
|
562
299
|
when /^solaris$/
|
|
563
300
|
# uncompress PE puppet-agent tarball
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
module Unix::User
|
|
2
2
|
include Beaker::CommandFactory
|
|
3
3
|
|
|
4
|
-
def user_list
|
|
4
|
+
def user_list
|
|
5
5
|
execute("getent passwd") do |result|
|
|
6
6
|
users = []
|
|
7
7
|
result.stdout.each_line do |line|
|
|
8
|
-
users << (line.match(
|
|
8
|
+
users << (line.match(/^([^:]+)/) or next)[1]
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
yield result if block_given?
|