r10k 2.6.6 → 2.6.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
  SHA1:
3
- metadata.gz: c37b475095ce21d823096d20d2e44f57842fda88
4
- data.tar.gz: b1f1a320a079d235b672ab467883616fa550e42a
3
+ metadata.gz: 6dfe2e3855040213486ec3ac3bf7bf6a9ea18b84
4
+ data.tar.gz: 139a09c327d96882971c78c6547aef55cce41ac4
5
5
  SHA512:
6
- metadata.gz: 5c3017e68a3c1a8f6f22d914d372421c57b834a98f5734e14b4d1fbb0da02be4ec928fc36a15a75c2a6db9709460f43ac6d42624a8ab308a5d0f8a3a89e5f7b5
7
- data.tar.gz: 6c3070d06402a786fdf1f854b0c824cd5e5c9c3ac6a1dc5429609c44c98622f684141e19656043ab43e8298f4f3ec7bb0add0f99a1844f4414d4d1e895eb1957
6
+ metadata.gz: 45038a55ecf4b3488e7ede4a027eb707ec63d50707c02bfdff703c305bbdad955875a9484f89082ef31f30f5cde27c24937bba92d8bca8e56610a1729c9e01f9
7
+ data.tar.gz: d2a82738b8a8d1f8b266c0f56b1a5b48bd0b3440fb336133b7795c260e049c838e4617967471f5a20892cbe5c010049c65dc26e6cacf3229d7f0678d0a320d26
data/.travis.yml CHANGED
@@ -6,7 +6,7 @@ notifications:
6
6
  email: false
7
7
  sudo: false
8
8
  jdk:
9
- - oraclejdk8
9
+ - openjdk8
10
10
  before_install: gem install bundler -v '< 2' --no-document
11
11
  matrix:
12
12
  include:
@@ -125,11 +125,24 @@ module R10K
125
125
  end
126
126
 
127
127
  def write_environment_info!(environment, started_at, success)
128
+ module_deploys = []
129
+ begin
130
+ environment.puppetfile.modules.each do |mod|
131
+ name = mod.name
132
+ version = mod.version
133
+ sha = mod.repo.head rescue nil
134
+ module_deploys.push({:name => name, :version => version, :sha => sha})
135
+ end
136
+ rescue
137
+ logger.debug("Unable to get environment module deploy data for .r10k-deploy.json at #{environment.path}")
138
+ end
139
+
128
140
  File.open("#{environment.path}/.r10k-deploy.json", 'w') do |f|
129
141
  deploy_info = environment.info.merge({
130
142
  :started_at => started_at,
131
143
  :finished_at => Time.new,
132
144
  :deploy_success => success,
145
+ :module_deploys => module_deploys,
133
146
  })
134
147
 
135
148
  f.puts(JSON.pretty_generate(deploy_info))
data/lib/r10k/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module R10K
2
- VERSION = '2.6.6'
2
+ VERSION = '2.6.7'
3
3
  end
data/r10k.gemspec CHANGED
@@ -37,7 +37,7 @@ Gem::Specification.new do |s|
37
37
  s.add_development_dependency 'rake'
38
38
 
39
39
  s.add_development_dependency 'yard', '~> 0.9.11'
40
- s.add_development_dependency 'minitar', '~> 0.6.1'
40
+ s.add_development_dependency 'minitar', '~> 0.9.0'
41
41
 
42
42
  s.files = %x[git ls-files].split($/)
43
43
  s.require_path = 'lib'
@@ -127,4 +127,63 @@ describe R10K::Action::Deploy::Environment do
127
127
  end
128
128
  end
129
129
  end
130
+
131
+ describe "write_environment_info!" do
132
+
133
+ class Fake_Environment
134
+ attr_accessor :path
135
+ attr_accessor :puppetfile
136
+ attr_accessor :info
137
+
138
+ def initialize(path, info)
139
+ @path = path
140
+ @info = info
141
+ @puppetfile = R10K::Puppetfile.new
142
+ end
143
+ end
144
+
145
+ let(:mock_stateful_repo_1) { instance_double("R10K::Git::StatefulRepository", :head => "123456") }
146
+ let(:mock_stateful_repo_2) { instance_double("R10K::Git::StatefulRepository", :head => "654321") }
147
+ let(:mock_git_module_1) { instance_double("R10K::Module::Git", :name => "my_cool_module", :version => "1.0", :repo => mock_stateful_repo_1) }
148
+ let(:mock_git_module_2) { instance_double("R10K::Module::Git", :name => "my_lame_module", :version => "0.0.1", :repo => mock_stateful_repo_2) }
149
+ let(:mock_forge_module_1) { double(:name => "their_shiny_module", :version => "2.0.0") }
150
+ let(:mock_puppetfile) { instance_double("R10K::Puppetfile", :modules => [mock_git_module_1, mock_git_module_2, mock_forge_module_1]) }
151
+
152
+ before(:all) do
153
+ @tmp_path = "./tmp-r10k-test-dir/"
154
+ Dir.mkdir(@tmp_path) unless File.exists?(@tmp_path)
155
+ end
156
+
157
+ after(:all) do
158
+ File.delete("#{@tmp_path}/.r10k-deploy.json")
159
+ Dir.delete(@tmp_path)
160
+ end
161
+
162
+ it "writes the .r10k-deploy file correctly" do
163
+ allow(R10K::Puppetfile).to receive(:new).and_return(mock_puppetfile)
164
+ allow(mock_forge_module_1).to receive(:repo).and_raise(NoMethodError)
165
+
166
+ fake_env = Fake_Environment.new(@tmp_path, {:name => "my_cool_environment", :signature => "pablo picasso"})
167
+ subject.send(:write_environment_info!, fake_env, "2019-01-01 23:23:22 +0000", true)
168
+
169
+ file_contents = File.read("#{@tmp_path}/.r10k-deploy.json")
170
+ r10k_deploy = JSON.parse(file_contents)
171
+
172
+ expect(r10k_deploy['name']).to eq("my_cool_environment")
173
+ expect(r10k_deploy['signature']).to eq("pablo picasso")
174
+ expect(r10k_deploy['started_at']).to eq("2019-01-01 23:23:22 +0000")
175
+ expect(r10k_deploy['deploy_success']).to eq(true)
176
+ expect(r10k_deploy['module_deploys'].length).to eq(3)
177
+ expect(r10k_deploy['module_deploys'][0]['name']).to eq("my_cool_module")
178
+ expect(r10k_deploy['module_deploys'][0]['version']).to eq("1.0")
179
+ expect(r10k_deploy['module_deploys'][0]['sha']).to eq("123456")
180
+ expect(r10k_deploy['module_deploys'][1]['name']).to eq("my_lame_module")
181
+ expect(r10k_deploy['module_deploys'][1]['version']).to eq("0.0.1")
182
+ expect(r10k_deploy['module_deploys'][1]['sha']).to eq("654321")
183
+ expect(r10k_deploy['module_deploys'][2]['name']).to eq("their_shiny_module")
184
+ expect(r10k_deploy['module_deploys'][2]['version']).to eq("2.0.0")
185
+ expect(r10k_deploy['module_deploys'][2]['sha']).to eq(nil)
186
+
187
+ end
188
+ end
130
189
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: r10k
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.6.6
4
+ version: 2.6.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrien Thebo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-16 00:00:00.000000000 Z
11
+ date: 2019-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: colored
@@ -142,14 +142,14 @@ dependencies:
142
142
  requirements:
143
143
  - - "~>"
144
144
  - !ruby/object:Gem::Version
145
- version: 0.6.1
145
+ version: 0.9.0
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
150
  - - "~>"
151
151
  - !ruby/object:Gem::Version
152
- version: 0.6.1
152
+ version: 0.9.0
153
153
  description: |2
154
154
  R10K provides a general purpose toolset for deploying Puppet environments and modules.
155
155
  It implements the Puppetfile format and provides a native implementation of Puppet
@@ -220,7 +220,6 @@ files:
220
220
  - integration/tests/Puppetfile/HTTP_PROXY_affects_git_source.rb
221
221
  - integration/tests/README.mkd
222
222
  - integration/tests/basic_functionality/install_pe_only_module_with_puppetfile.rb
223
- - integration/tests/basic_functionality/negative/attempt_to_install_peonly_module_without_license.rb
224
223
  - integration/tests/basic_functionality/negative/neg_deploy_with_invalid_r10k_yaml.rb
225
224
  - integration/tests/basic_functionality/negative/neg_deploy_with_missing_r10k_yaml.rb
226
225
  - integration/tests/basic_functionality/negative/neg_invalid_git_provider.rb
@@ -1,71 +0,0 @@
1
- require 'git_utils'
2
- require 'r10k_utils'
3
- require 'master_manipulator'
4
- test_name 'RK-158 - C92361 - Attempt to install a PE-only module with no license file'
5
-
6
- #Init
7
- env_path = on(master, puppet('config print environmentpath')).stdout.rstrip
8
- r10k_fqp = get_r10k_fqp(master)
9
- master_certname = on(master, puppet('config', 'print', 'certname')).stdout.rstrip
10
-
11
- git_repo_path = '/git_repos'
12
- git_repo_name = 'environments'
13
- git_control_remote = File.join(git_repo_path, "#{git_repo_name}.git")
14
- git_environments_path = '/root/environments'
15
- last_commit = git_last_commit(master, git_environments_path)
16
- git_provider = ENV['GIT_PROVIDER'] || 'shellgit'
17
-
18
- r10k_config_path = get_r10k_config_file_path(master)
19
- r10k_config_bak_path = "#{r10k_config_path}.bak"
20
-
21
- #In-line files
22
- r10k_conf = <<-CONF
23
- cachedir: '/var/cache/r10k'
24
- git:
25
- provider: '#{git_provider}'
26
- sources:
27
- control:
28
- basedir: "#{env_path}"
29
- remote: "#{git_control_remote}"
30
- CONF
31
-
32
- #Manifest
33
- site_pp_path = File.join(git_environments_path, 'manifests', 'site.pp')
34
- site_pp = create_site_pp(master_certname, ' include peonly')
35
-
36
- # Verification
37
- error_message_regex = /You must have a valid Puppet Enterprise® license on this node in order to download ztr-peonly/
38
-
39
- #Teardown
40
- teardown do
41
- step 'Restore Original "r10k" Config'
42
- on(master, "mv #{r10k_config_bak_path} #{r10k_config_path}")
43
-
44
- step 'cleanup r10k'
45
- clean_up_r10k(master, last_commit, git_environments_path)
46
- end
47
-
48
- #Setup
49
- step 'Stub the forge'
50
- stub_forge_on(master)
51
-
52
- step 'Backup a Valid "r10k" Config'
53
- on(master, "mv #{r10k_config_path} #{r10k_config_bak_path}")
54
-
55
- step 'Update the "r10k" Config'
56
- create_remote_file(master, r10k_config_path, r10k_conf)
57
-
58
- step 'Inject New "site.pp" to the "production" Environment'
59
- inject_site_pp(master, site_pp_path, site_pp)
60
-
61
- step 'Copy Puppetfile to "production" Environment Git Repo'
62
- create_remote_file(master, "#{git_environments_path}/Puppetfile", 'mod "ztr-peonly"')
63
-
64
- step 'Push Changes'
65
- git_add_commit_push(master, 'production', 'add Puppetfile', git_environments_path)
66
-
67
- #Test
68
- step 'Deploy "production" Environment via r10k'
69
- on(master, "#{r10k_fqp} deploy environment -p", :acceptable_exit_codes => [0,1]) do |result|
70
- assert_match(error_message_regex, result.stderr, 'Expected error message was not observed!')
71
- end