cem_acpt 0.8.5 → 0.8.7

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: 3835ee97ead5dca9e1b7445b4705efef12c7de1ff7f2574bca70d55f06091b47
4
- data.tar.gz: 5482b561206e95a2ee465116c829fff6b9bb953330dbdc77427221e954ccf8ac
3
+ metadata.gz: bd72076945b79db4583d665e691c86214c901331f37ccdfc25e0d07b999b50ca
4
+ data.tar.gz: f32e25b3c220e20c73aa3bcd7bab9873c2ac753b5d41c61e2f069988eaf29822
5
5
  SHA512:
6
- metadata.gz: 597ae4e7b86e3559f40113fe9681ced0cce7152722430e17f0502d9d83aecf80526a1b8d1f3deb2586fcc8a0bf90489191d9898f52767081a2da45384e9de4e6
7
- data.tar.gz: b0587d2487fcb010eea86eb196fd948d23e6e05ed602e920765c0d3e21551f3e4bb173bb971001eb9de2a8617b148cbb42e2cac6645932129e8ac3d7235e7365
6
+ metadata.gz: a9e7b0d71cfd8efedd0faef1e8fb2cb23b0335a049b1b8d270a7325a3cf19b97d1d603042d7326478c6e4e23ae42de890de0b88bc38a21085ab44e19c47d605b
7
+ data.tar.gz: ab1df006f61525ead0c8b64f38b52fe93a1152a337eea0d7a78535f3496fa3d4856b3fdc46e6f9dd29f8fea038e17af5acd76ced4df502707f3880201d6df511
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- cem_acpt (0.8.5)
4
+ cem_acpt (0.8.7)
5
5
  async-http (>= 0.60, < 0.70)
6
6
  bcrypt_pbkdf (>= 1.0, < 2.0)
7
7
  deep_merge (>= 1.2, < 2.0)
@@ -143,4 +143,4 @@ DEPENDENCIES
143
143
  rubocop-rspec
144
144
 
145
145
  BUNDLED WITH
146
- 2.4.18
146
+ 2.4.19
@@ -81,6 +81,7 @@ module CemAcpt
81
81
  'rhel' => 'EnterpriseLinuxFamily',
82
82
  'alma' => 'EnterpriseLinuxFamily',
83
83
  'oel' => 'EnterpriseLinuxFamily',
84
+ 'rocky' => 'EnterpriseLinuxFamily',
84
85
  'windows' => 'WindowsFamily',
85
86
  }.freeze
86
87
 
@@ -144,7 +144,11 @@ module CemAcpt
144
144
  end
145
145
 
146
146
  def terraform
147
- @terraform ||= CemAcpt::Provision::TerraformCmd.new(@image_terraform_dir, @environment)
147
+ # Instead of passing in @image_terraform_dir, we pass in @working_dir. The reason being
148
+ # @image_terraform_dir is the parent directory that has path like ~/.cem_acpt/terraform/image/gcp (gcp being the platform)
149
+ # We want to pass the working directory that has the linux and windows directories in it
150
+ # which we can then further manipulate to get the correct path.
151
+ @terraform ||= CemAcpt::Provision::TerraformCmd.new(@working_dir, @environment)
148
152
  end
149
153
 
150
154
  def new_environment(config)
@@ -7,7 +7,7 @@ module CemAcpt
7
7
  # Class provides methods for gathering provision data for Linux nodes
8
8
  class Linux < OsData
9
9
  def self.valid_names
10
- %w[centos rhel oel alma]
10
+ %w[centos rhel oel alma rocky]
11
11
  end
12
12
 
13
13
  def self.valid_versions
@@ -40,9 +40,25 @@ module CemAcpt
40
40
  commands << "sudo systemctl start #{file} && sudo systemctl enable #{file}"
41
41
  end
42
42
  end
43
+
43
44
  commands << apply_command
44
45
  end
45
46
 
47
+ # A wrapper around provision_commands that allows for extra commands to be added for a specific OS version(i.e EL 8)
48
+ def provision_commands_wrapper(image_name)
49
+ if ['rhel-8', 'oel-8', 'alma-8', 'rocky-8'].any? { |el8| image_name.include?(el8) }
50
+ commands = [
51
+ 'sudo dnf upgrade --refresh -y rpm glibc',
52
+ 'sudo rm /var/lib/rpm/.rpm.lock',
53
+ 'sudo dnf upgrade -y dnf',
54
+ ]
55
+ commands = (commands << provision_commands).flatten
56
+ commands
57
+ else
58
+ provision_commands
59
+ end
60
+ end
61
+
46
62
  private
47
63
 
48
64
  def apply_command
@@ -89,11 +89,17 @@ module CemAcpt
89
89
  end
90
90
 
91
91
  def chdir(opts = {})
92
- [extract_arg!(opts, :chdir), working_dir, Dir.pwd].each do |d|
92
+ [Dir.pwd, working_dir, extract_arg!(opts, :chdir)].each do |d|
93
93
  next if d.nil? || d.empty?
94
94
 
95
95
  d = File.expand_path(d)
96
- return "-chdir=#{d}" if File.directory?(d)
96
+
97
+ # Added a check for main.tf to make sure we're in the right directory and have necessary file whhen running terraform
98
+ # There are three possible path that we can be in:
99
+ # 1. The working directory that was passed in, which is usually the created temporary directory
100
+ # 2. The current directory that this code is being executed from (usually in a linux or windows directory of working directory)
101
+ # 3. The working directory that was passed in, but with a linux or windows directory appended to it
102
+ return "-chdir=#{d}" if File.directory?(d) && File.exist?(File.join(d, 'main.tf'))
97
103
 
98
104
  logger.warn('CemAcpt::Provision::TerraformCmd') { "Directory #{d} does not exist, using next..." }
99
105
  end
@@ -121,7 +127,9 @@ module CemAcpt
121
127
  k = k.to_s
122
128
  k.tr!('_', '-')
123
129
  if k == 'vars'
124
- v.map { |vk, vv| "-var '#{vk}=#{vv}'" }.join(' ')
130
+ # Included a check for Hash so that we can generate JSON to pass to terraform.
131
+ # If not a Hash, then we just pass the value as is, which is a string.
132
+ v.map { |vk, vv| "-var='#{vk}=#{vv.is_a?(Hash) ? JSON.generate(vv) : vv}'" }.join(' ')
125
133
  elsif %w[input lock refresh].include?(k) # These are boolean flags with values
126
134
  "-#{k}=#{v}"
127
135
  elsif v.nil? || (v.respond_to?(:empty) && v.empty?) || v.is_a?(TrueClass)
@@ -209,7 +209,7 @@ module CemAcpt
209
209
  puppet_manifest: node.test_data[:puppet_manifest],
210
210
  provision_dir_source: @backend.provision_directory,
211
211
  provision_dir_dest: @backend.destination_provision_directory,
212
- provision_commands: @backend.provision_commands,
212
+ provision_commands: @backend.instance_of?(CemAcpt::Provision::Linux) ? @backend.provision_commands_wrapper(node.node_data[:image]) : @backend.provision_commands,
213
213
  }
214
214
  )
215
215
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module CemAcpt
4
- VERSION = '0.8.5'
4
+ VERSION = '0.8.7'
5
5
  end
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.8.5
4
+ version: 0.8.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - puppetlabs
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-05 00:00:00.000000000 Z
11
+ date: 2023-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async-http
@@ -277,7 +277,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
277
277
  - !ruby/object:Gem::Version
278
278
  version: '0'
279
279
  requirements: []
280
- rubygems_version: 3.4.18
280
+ rubygems_version: 3.4.19
281
281
  signing_key:
282
282
  specification_version: 4
283
283
  summary: CEM Acceptance Tests