beaker 4.36.1 → 4.37.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a512100e3bdfe558337d1571372ef7131aa8466b05995f36dba8ecf7b6091996
4
- data.tar.gz: 60a43e396d5b1b2354bd26174e4281045ea828e7ca3d0a464bd685ba17b58dbe
3
+ metadata.gz: 94de428f52b80007b5443a3694bfba1c6cf8fb694373a760ba825d0b044117bb
4
+ data.tar.gz: 0d28d5a725253b87ca396639767778f1a70d143094b94049a60616d7e7accd0d
5
5
  SHA512:
6
- metadata.gz: 84e4bd854ef9aa7fc63ca24f61d2062b6dcac4a3cb462cadc8da430bcb92936854b30c9c3aa1ece761f17ca28a5138f4891224c1882b9f8d19b291ba56ecaa8d
7
- data.tar.gz: 5572e704bd0fb2d44632c8a1c196d11886e7966545d6f7e8b9adcea130b152b5bf0da4091b31efd04d687b9720baccc1ce2466a9313543cb9c612f0420c7a686
6
+ metadata.gz: 73f8ec5ae3893fe1b99b08515eac624b1531505c2793d507837a30e5bd0a6d87196fee04828d291e1c8bb1f2ab8dc3b158864270aa75a50d43a3759019ddbb94
7
+ data.tar.gz: c81de7019a75a1532ec4ae1b52826c93bc3cfee7060ee52948c364be6ae50174177743bea06edd52b6cbd0866ed3d501d34c686bfe1c0e2c94ae9edfb4915a7b
data/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # Changelog
2
2
 
3
+ ## [4.37.2](https://github.com/voxpupuli/beaker/tree/4.37.2) (2022-07-28)
4
+
5
+ ## Fixed
6
+
7
+ - Use the new scheme for agent versions >= 6.28 and < 7 [\#1749](https://github.com/voxpupuli/beaker/pull/1749) ([joshcooper](https://github.com/joshcooper))
8
+
9
+ ## [4.37.1](https://github.com/voxpupuli/beaker/tree/4.37.1) (2022-07-27)
10
+
11
+ ## Fixed
12
+
13
+ - macOS PE tarballs include arch now ([#1747](https://github.com/voxpupuli/beaker/pull/1747))
14
+
15
+ ## [4.37.0](https://github.com/voxpupuli/beaker/tree/4.37.0) (2022-06-27)
16
+
17
+ ## Added
18
+
19
+ - Add support for Win32-OpenSSH ([#1744](https://github.com/voxpupuli/beaker/pull/1744))
20
+
21
+ ## Fixed
22
+
23
+ - Create ~/.ssh on Windows if it doesn't exist ([#1745](https://github.com/voxpupuli/beaker/pull/1745))
24
+
3
25
  ## [4.36.1](https://github.com/voxpupuli/beaker/tree/4.36.1) (2022-06-16)
4
26
 
5
27
  ## Fixed
@@ -118,7 +118,17 @@ module Mac::Pkg
118
118
 
119
119
  variant, version, arch, codename = self['platform'].to_array
120
120
  release_file = "/repos/apple/#{version}/#{puppet_collection}/#{arch}/puppet-agent-*"
121
- download_file = "puppet-agent-#{variant}-#{version}.tar.gz"
121
+
122
+ # macOS puppet-agent tarballs haven't always included arch
123
+ agent_version = opts[:puppet_agent_version]
124
+ agent_version_f = agent_version&.to_f
125
+
126
+ download_file = if agent_version_f.nil? || (agent_version_f < 6.28 || (agent_version_f >= 7.0 && agent_version_f < 7.18))
127
+ "puppet-agent-#{variant}-#{version}.tar.gz"
128
+ else
129
+ "puppet-agent-#{variant}-#{version}-#{arch}.tar.gz"
130
+ end
131
+
122
132
  return '', release_file, download_file
123
133
  end
124
134
 
@@ -120,10 +120,16 @@ module Windows::Exec
120
120
  end
121
121
 
122
122
  # Create the provided directory structure on the host
123
- # @param [String] dir The directory structure to create on the host
123
+ # @param [String,Pathname] dir The directory structure to create on the host
124
124
  # @return [Boolean] True, if directory construction succeeded, otherwise False
125
- def mkdir_p dir
126
- cmd = "mkdir -p \"#{dir}\""
125
+ def mkdir_p(dir)
126
+ # single or double quotes will disable ~ expansion, so only quote if we have to
127
+ str = dir.to_s
128
+ cmd = if str.start_with?('~') && !str.include?(' ')
129
+ "mkdir -p #{str}"
130
+ else
131
+ "mkdir -p \"#{str}\""
132
+ end
127
133
  result = exec(Beaker::Command.new(cmd), :acceptable_exit_codes => [0, 1])
128
134
  result.exit_code == 0
129
135
  end
@@ -59,11 +59,13 @@ module Windows::File
59
59
  case determine_ssh_server
60
60
  when :bitvise
61
61
  # swap out separators
62
- network_path = path.gsub('\\', scp_separator)
62
+ path.gsub('\\', scp_separator)
63
63
  when :openssh
64
64
  path
65
+ when :win32_openssh
66
+ path.gsub('\\', '/')
65
67
  else
66
- raise ArgumentError("windows/file.rb:scp_path: ssh server not recognized: '#{determine_ssh_server}'")
68
+ raise ArgumentError, "windows/file.rb:scp_path: ssh server not recognized: '#{determine_ssh_server}'"
67
69
  end
68
70
  end
69
71
 
@@ -38,8 +38,14 @@ module Windows
38
38
  return @ssh_server if @ssh_server
39
39
  @ssh_server = :openssh
40
40
  status = execute('cmd.exe /c sc query BvSshServer', :accept_all_exit_codes => true)
41
- @ssh_server = :bitvise if status =~ /4 RUNNING/
42
- logger.debug("windows.rb:determine_ssh_server: determined ssh server: '#{@ssh_server}'")
41
+ if status =~ /4 RUNNING/
42
+ @ssh_server = :bitvise
43
+ else
44
+ status = execute('cmd.exe /c sc qc sshd', :accept_all_exit_codes => true)
45
+ if status =~ /C:\\Windows\\System32\\OpenSSH\\sshd\.exe/
46
+ @ssh_server = :win32_openssh
47
+ end
48
+ end
43
49
  @ssh_server
44
50
  end
45
51
 
@@ -1,5 +1,5 @@
1
1
  module Beaker
2
2
  module Version
3
- STRING = '4.36.1'
3
+ STRING = '4.37.2'
4
4
  end
5
5
  end
@@ -82,5 +82,32 @@ module Mac
82
82
  expect( release_path_end ).to be === "apple/PC8"
83
83
  end
84
84
  end
85
+
86
+ describe '#pe_puppet_agent_promoted_package_info' do
87
+ before :each do
88
+ @platform = "osx-10.15-x86_64"
89
+ end
90
+
91
+ it "uses the old scheme if the version is omitted" do
92
+ _, _, download_file = host.pe_puppet_agent_promoted_package_info('pa_collection')
93
+
94
+ expect(download_file).to eq('puppet-agent-osx-10.15.tar.gz')
95
+ end
96
+
97
+ {
98
+ '5.5.22' => 'puppet-agent-osx-10.15.tar.gz',
99
+ '6.27.0' => 'puppet-agent-osx-10.15.tar.gz',
100
+ '6.28.0' => 'puppet-agent-osx-10.15-x86_64.tar.gz',
101
+ '7.0.0' => 'puppet-agent-osx-10.15.tar.gz',
102
+ '7.18.0' => 'puppet-agent-osx-10.15-x86_64.tar.gz',
103
+ '8.0.0' => 'puppet-agent-osx-10.15-x86_64.tar.gz',
104
+ }.each_pair do |version, expected|
105
+ it "returns #{expected} for puppet-agent #{version}" do
106
+ _, _, download_file = host.pe_puppet_agent_promoted_package_info('pa_collection', puppet_agent_version: version)
107
+
108
+ expect(download_file).to eq(expected)
109
+ end
110
+ end
111
+ end
85
112
  end
86
- end
113
+ end
@@ -96,5 +96,35 @@ module Beaker
96
96
  expect( instance.mv(origin, destination, false) ).to be === 0
97
97
  end
98
98
  end
99
+
100
+ context 'mkdir_p' do
101
+ let(:path) { '~/.ssh' }
102
+ let(:result) do
103
+ result = Beaker::Result.new(nil, '')
104
+ result.exit_code = 0
105
+ result
106
+ end
107
+
108
+ it 'accepts Pathname arguments' do
109
+ expect( instance ).to receive(:exec).with(having_attributes(command: "mkdir -p #{path}"), anything).and_return(result)
110
+ expect(instance.mkdir_p(Pathname.new(path))).to eq(true)
111
+ end
112
+
113
+ it 'omits quotes if the path starts with ~ and does not contain spaces' do
114
+ expect( instance ).to receive(:exec).with(having_attributes(command: "mkdir -p #{path}"), anything).and_return(result)
115
+ expect(instance.mkdir_p(path)).to eq(true)
116
+ end
117
+
118
+ it 'double quotes paths containing spaces' do
119
+ expect( instance ).to receive(:exec).with(having_attributes(command: "mkdir -p \"~/.foo bar\""), anything).and_return(result)
120
+ expect(instance.mkdir_p("~/.foo bar")).to eq(true)
121
+ end
122
+
123
+ it 'returns false if the command failed' do
124
+ result.exit_code = 1
125
+ expect( instance ).to receive(:exec).with(having_attributes(command: "mkdir -p #{path}"), anything).and_return(result)
126
+ expect(instance.mkdir_p(path)).to eq(false)
127
+ end
128
+ end
99
129
  end
100
130
  end
@@ -51,5 +51,37 @@ module Beaker
51
51
  host.ls_ld( path )
52
52
  end
53
53
  end
54
+
55
+ describe "#scp_to" do
56
+ let(:path) { 'C:\Windows' }
57
+
58
+ it 'replaces backslashes with ??? when using BitVise and cmd' do
59
+ allow(host).to receive(:determine_ssh_server).and_return(:bitvise)
60
+ expect(host.scp_path(path)).to eq('C:\Windows')
61
+ end
62
+
63
+ it 'replaces backslashes with forward slashes when using BitVise and powershell' do
64
+ host = make_host('name', platform: 'windows', is_cygwin: false)
65
+ allow(host).to receive(:determine_ssh_server).and_return(:bitvise)
66
+ expect(host.scp_path(path)).to eq('C:/Windows')
67
+ end
68
+
69
+ it 'leaves backslashes as is when using cygwin' do
70
+ allow(host).to receive(:determine_ssh_server).and_return(:openssh)
71
+ expect(host.scp_path(path)).to eq('C:\Windows')
72
+ end
73
+
74
+ it 'replace backslashes with forward slashes when using Win32-OpenSSH' do
75
+ allow(host).to receive(:determine_ssh_server).and_return(:win32_openssh)
76
+ expect(host.scp_path(path)).to eq('C:/Windows')
77
+ end
78
+
79
+ it 'raises if the server can not be recognized' do
80
+ allow(host).to receive(:determine_ssh_server).and_return(:unknown)
81
+ expect {
82
+ host.scp_path(path)
83
+ }.to raise_error(ArgumentError, "windows/file.rb:scp_path: ssh server not recognized: 'unknown'")
84
+ end
85
+ end
54
86
  end
55
87
  end
@@ -37,7 +37,7 @@ module Windows
37
37
 
38
38
  describe '#determine_ssh_server' do
39
39
  it 'does not care about return codes from the execute call' do
40
- expect( host ).to receive( :execute ).with( anything, :accept_all_exit_codes => true )
40
+ expect( host ).to receive( :execute ).with( anything, :accept_all_exit_codes => true ).twice
41
41
  host.determine_ssh_server
42
42
  end
43
43
 
@@ -53,6 +53,28 @@ module Windows
53
53
  expect( host.determine_ssh_server ).to be === :bitvise
54
54
  end
55
55
 
56
+ it 'reads Windows OpenSSH status correctly' do
57
+ allow(host).to receive(:execute)
58
+ .with('cmd.exe /c sc query BvSshServer', anything).and_return(bitvise_check_output(:failure))
59
+ allow(host).to receive(:execute)
60
+ .with('cmd.exe /c sc qc sshd', anything).and_return(<<~END)
61
+ [SC] QueryServiceConfig SUCCESS
62
+
63
+ SERVICE_NAME: sshd
64
+ TYPE : 10 WIN32_OWN_PROCESS
65
+ START_TYPE : 2 AUTO_START
66
+ ERROR_CONTROL : 1 NORMAL
67
+ BINARY_PATH_NAME : C:\\Windows\\System32\\OpenSSH\\sshd.exe
68
+ LOAD_ORDER_GROUP :
69
+ TAG : 0
70
+ DISPLAY_NAME : OpenSSH SSH Server
71
+ DEPENDENCIES :
72
+ SERVICE_START_NAME : LocalSystem
73
+ END
74
+
75
+ expect(host.determine_ssh_server).to eq :win32_openssh
76
+ end
77
+
56
78
  it 'returns old value if it has already determined before' do
57
79
  ssh_server_before = host.instance_variable_get( :@ssh_server )
58
80
  test_value = :test916
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: 4.36.1
4
+ version: 4.37.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-16 00:00:00.000000000 Z
11
+ date: 2022-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec