cem_acpt 0.2.1 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/cem_acpt.gemspec +3 -3
- data/lib/cem_acpt/utils.rb +16 -14
- data/lib/cem_acpt/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1eb607b0dd6b47c759056a0aa3c1c50d1d304b8aeb604bb7fe2ce5e8738a39b8
|
4
|
+
data.tar.gz: e2733d6abe61cfae7124d4ad8527d2ef2c1862e8ed9aae14933115f3e09ace6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd2429510a3d927e809b5459c6af5893a1786f19398c861a540de45490ef772944dbd05889a244c5b7be1e2ead068df5547baa9da9f74fed99a3fa47daac8c2d
|
7
|
+
data.tar.gz: 79eb5728f077fadc64eff99ffd8b665c06abf2aa420c3b164991928dfa561af7dc349b570be6ab174e14f0fae87422b10054c79973c0547c5c25338f0861d94c
|
data/Gemfile.lock
CHANGED
data/cem_acpt.gemspec
CHANGED
@@ -5,14 +5,14 @@ require_relative 'lib/cem_acpt/version'
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.name = 'cem_acpt'
|
7
7
|
spec.version = CemAcpt::VERSION
|
8
|
-
spec.authors = ['
|
9
|
-
spec.email = ['
|
8
|
+
spec.authors = ['puppetlabs']
|
9
|
+
spec.email = ['abide-team@puppet.com']
|
10
10
|
|
11
11
|
spec.summary = 'CEM Acceptance Tests'
|
12
12
|
spec.description = 'Litmus-like library focusing on CEM Acceptance Tests'
|
13
13
|
spec.homepage = 'https://github.com/puppetlabs/cem_acpt'
|
14
14
|
spec.license = 'proprietary'
|
15
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.
|
15
|
+
spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
|
16
16
|
|
17
17
|
spec.metadata['homepage_uri'] = spec.homepage
|
18
18
|
spec.metadata['source_code_uri'] = 'https://github.com/puppetlabs/cem_acpt'
|
data/lib/cem_acpt/utils.rb
CHANGED
@@ -18,7 +18,7 @@ module CemAcpt
|
|
18
18
|
# File-related utilities
|
19
19
|
module File
|
20
20
|
def self.set_permissions(permission, *file_paths)
|
21
|
-
file_paths.map { |p| File.chmod(permission, p) }
|
21
|
+
file_paths.map { |p| ::File.chmod(permission, p) }
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
@@ -32,7 +32,7 @@ module CemAcpt
|
|
32
32
|
# Finds and returns the Puppet executable
|
33
33
|
def self.puppet_executable
|
34
34
|
this_os = CemAcpt::Utils.os
|
35
|
-
if File.file?(DEFAULT_PUPPET_PATH[this_os]) && File.executable?(DEFAULT_PUPPET_PATH[this_os])
|
35
|
+
if ::File.file?(DEFAULT_PUPPET_PATH[this_os]) && ::File.executable?(DEFAULT_PUPPET_PATH[this_os])
|
36
36
|
return DEFAULT_PUPPET_PATH[this_os]
|
37
37
|
end
|
38
38
|
|
@@ -41,9 +41,9 @@ module CemAcpt
|
|
41
41
|
exts = ENV['PATHEXT'] ? ".{#{ENV['PATHEXT'].tr(';', ',').tr('.', '').downcase}}" : '.{exe,com,bat}'
|
42
42
|
file_name = "#{file_name}#{exts}"
|
43
43
|
end
|
44
|
-
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
45
|
-
if File.file?(File.join(path, file_name)) && File.executable?(File.join(path, file_name))
|
46
|
-
return File.join(path, file_name)
|
44
|
+
ENV['PATH'].split(::File::PATH_SEPARATOR).each do |path|
|
45
|
+
if ::File.file?(::File.join(path, file_name)) && ::File.executable?(::File.join(path, file_name))
|
46
|
+
return ::File.join(path, file_name)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
raise 'Could not find Puppet executable! Is Puppet installed?'
|
@@ -75,30 +75,32 @@ module CemAcpt
|
|
75
75
|
module Node
|
76
76
|
def self.random_instance_name(prefix: 'cem-acpt-', length: 24)
|
77
77
|
rand_length = length - prefix.length
|
78
|
-
"#{prefix}#{SecureRandom.hex(rand_length)}"
|
78
|
+
"#{prefix}#{::SecureRandom.hex(rand_length)}"
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
82
82
|
# SSH-related utilities
|
83
83
|
module SSH
|
84
|
-
def self.
|
85
|
-
bin_path =
|
84
|
+
def self.ssh_keygen
|
85
|
+
bin_path = `#{ENV['SHELL']} -c 'command -v ssh-keygen'`.chomp
|
86
86
|
raise 'Cannot find ssh-keygen! Install it and verify PATH' unless bin_path
|
87
87
|
|
88
88
|
bin_path
|
89
|
+
rescue StandardError => e
|
90
|
+
raise "Cannot find ssh-keygen! Install it and verify PATH. Orignal error: #{e}"
|
89
91
|
end
|
90
92
|
|
91
93
|
def self.default_keydir
|
92
|
-
ssh_dir = File.join(ENV['HOME'], '.ssh')
|
93
|
-
raise "SSH directory at #{ssh_dir} does not exist" unless File.directory?(ssh_dir)
|
94
|
+
ssh_dir = ::File.join(ENV['HOME'], '.ssh')
|
95
|
+
raise "SSH directory at #{ssh_dir} does not exist" unless ::File.directory?(ssh_dir)
|
94
96
|
|
95
97
|
ssh_dir
|
96
98
|
end
|
97
99
|
|
98
100
|
def self.ephemeral_ssh_key(type: 'rsa', bits: '4096', comment: nil, keydir: default_keydir)
|
99
|
-
raise ArgumentError, 'keydir does not exist' unless File.directory?(keydir)
|
101
|
+
raise ArgumentError, 'keydir does not exist' unless ::File.directory?(keydir)
|
100
102
|
|
101
|
-
keyfile = File.join(keydir,
|
103
|
+
keyfile = ::File.join(keydir, 'acpt_test_key')
|
102
104
|
keygen_cmd = [ssh_keygen, "-t #{type}", "-b #{bits}", "-f #{keyfile}", '-N ""']
|
103
105
|
keygen_cmd << "-C \"#{comment}\"" if comment
|
104
106
|
_, stderr, status = Open3.capture3(keygen_cmd.join(' '))
|
@@ -108,8 +110,8 @@ module CemAcpt
|
|
108
110
|
end
|
109
111
|
|
110
112
|
def self.acpt_known_hosts(keydir: default_keydir, file_name: 'acpt_known_hosts', overwrite: true)
|
111
|
-
kh_file = File.join(keydir, file_name)
|
112
|
-
File.open(kh_file, 'w') { |f| f.write("\n") } unless File.exist?(kh_file) && !overwrite
|
113
|
+
kh_file = ::File.join(keydir, file_name)
|
114
|
+
::File.open(kh_file, 'w') { |f| f.write("\n") } unless ::File.exist?(kh_file) && !overwrite
|
113
115
|
kh_file
|
114
116
|
end
|
115
117
|
|
data/lib/cem_acpt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cem_acpt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
|
-
-
|
7
|
+
- puppetlabs
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,7 +124,7 @@ dependencies:
|
|
124
124
|
version: '0'
|
125
125
|
description: Litmus-like library focusing on CEM Acceptance Tests
|
126
126
|
email:
|
127
|
-
-
|
127
|
+
- abide-team@puppet.com
|
128
128
|
executables:
|
129
129
|
- cem_acpt
|
130
130
|
extensions: []
|
@@ -184,7 +184,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
184
184
|
requirements:
|
185
185
|
- - ">="
|
186
186
|
- !ruby/object:Gem::Version
|
187
|
-
version: 2.
|
187
|
+
version: 2.6.0
|
188
188
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
189
189
|
requirements:
|
190
190
|
- - ">="
|