knife-pinnings 1.4.3 → 1.4.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
- SHA1:
3
- metadata.gz: e81fa9bc64472ebd0bb1e0301fb1932940eea236
4
- data.tar.gz: f871a393b8abcb87387d769e1c69b6ea3d5518af
2
+ SHA256:
3
+ metadata.gz: 3ad64b484bbe7620e835a84ffc03af5f7104ba60fd622245e8498752221ba758
4
+ data.tar.gz: 2d274e292d546a38376619d8990e79b6007d9f54f647f64668bba2a6bee7bf03
5
5
  SHA512:
6
- metadata.gz: 37f3e3f5ddbc6556586d864f5c713859b83eae479298ba81a6a935997b98d996a9f74b54f0cb036c27c97f6c3ba4f95876e4fc6bbd5cbc14c3ccb6da4af482ce
7
- data.tar.gz: c9aa4da87c27c97b720ea05679afc929f8efa458ffff4af5af496dfbc5937abe6b0cc2987c21bdd15529e47c4c82505edcc49b020354681d510276fc7c2778cb
6
+ metadata.gz: d45c0c78051022234f8319813fa9fb703f2b074fc57a92e46e5bb4bb21a0999d80501160adc65072b8d56eca7bd1a0d3cebc17ea8b5317ac47c03475facf0816
7
+ data.tar.gz: 2e45dab67c3eaa3572da34f9ac9e6ec6bda84b1ef8068781002999d4fb14167fb4aee26208cf24f05a4bec9786f1f9276ff225fbed38452ddcc03dd905b35624
data/.gitignore CHANGED
@@ -12,3 +12,4 @@
12
12
  *.o
13
13
  *.a
14
14
  mkmf.log
15
+ *.gem
data/README.md CHANGED
@@ -1,5 +1,6 @@
1
1
  # knife-pinnings
2
2
 
3
+
3
4
  This gem extends Chef's knife command to manage version pinnings in your Chef environments
4
5
 
5
6
  * Set a cookbook pinning explicitly or by using metadata.rb
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
11
11
  spec.summary = 'Chef knife plugin to set, list, compare, copy and delete cookbook pinnings across environments'
12
12
  spec.description = 'Chef knife plugin to set, list, compare, copy and delete cookbook pinnings across environments'
13
13
  spec.homepage = 'https://github.com/trickyearlobe/knife-pinnings'
14
- spec.license = 'Apache 2.0'
14
+ spec.license = 'Apache-2.0'
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0")
17
17
  spec.require_paths = ['lib']
@@ -21,11 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
22
 
23
23
  spec.add_development_dependency 'rspec'
24
- spec.add_development_dependency 'bundler', '~> 1.7'
25
- spec.add_development_dependency 'rake', '~> 10.0'
24
+ spec.add_development_dependency 'bundler'
25
+ spec.add_development_dependency 'rake'
26
26
  spec.add_development_dependency 'rubocop'
27
- spec.add_development_dependency 'guard'
28
- spec.add_development_dependency 'guard-rake'
29
- spec.add_development_dependency 'guard-shell'
30
- spec.add_development_dependency 'guard-rubocop'
31
27
  end
@@ -14,7 +14,7 @@
14
14
 
15
15
  class Chef
16
16
  class Knife
17
- # This class implements knife pinnings list ['environment_regex'] ['cookbook_regex']
17
+ # This class implements knife pinnings compare ['environment_regex'] ['cookbook_regex']
18
18
  class PinningsCompare < Chef::Knife
19
19
  require 'chef/knife/pinnings_mixin'
20
20
  banner 'knife pinnings compare [ENV_REGEX] [COOKBOOK_REGEX]'
@@ -12,6 +12,8 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ require 'chef/cookbook/metadata'
16
+
15
17
  class Chef
16
18
  class Knife
17
19
  # This class implements knife pinnings get local METADATA_ITEM
@@ -75,13 +75,11 @@ def build_pinnings_table(environments, cookbook_regex)
75
75
  cookbooks_grid
76
76
  end
77
77
 
78
- def set_environnment_pinnings(environment, pinnings)
79
-
78
+ def set_environnment_pinnings(environment, pinnings)
80
79
  pinnings.each do |name,pinning|
81
80
  environment.cookbook_versions[name] = pinning
82
81
  end
83
82
  environment.save
84
-
85
83
  end
86
84
 
87
85
  def add_color(row)
@@ -128,19 +126,21 @@ def cookbooks_used_by(rest, environment)
128
126
  roles = []
129
127
  nodes = nodes_in(rest, environment)
130
128
  nodes.each do |node|
131
- response = rest.get_rest("/nodes/#{node}").run_list
132
- _recipes = response.recipe_names
129
+ response=Chef::RunList.new(rest.get_rest("/nodes/#{node}")['run_list'].join(','))
130
+ _recipes = response.recipe_names
133
131
  _roles = response.role_names
134
132
  recipes = recipes | (if (_recipes==nil) then [] else _recipes end)
135
133
  roles = roles | (if (_roles==nil) then [] else _roles end)
136
134
  end
137
135
  recipes_from_roles = []
138
- roles.each do |role|
136
+ roles.each do |role|
139
137
  run_list = [Chef::RunList::RunListItem.new("role[#{role}]")]
140
138
  expansion = Chef::RunList::RunListExpansionFromAPI.new(environment, run_list, rest)
141
139
  expansion.expand
142
140
  recipes_from_roles = recipes_from_roles | expansion.recipes
143
141
  end
142
+ recipes.delete ""
143
+ recipes_from_roles.delete ""
144
144
  (recipes | recipes_from_roles).map { |r| r.split('@').first.split('::').first }
145
145
  end
146
146
 
@@ -178,7 +178,7 @@ def solve_recipes(rest, environment, cookbooks_with_contraints)
178
178
  response = rest.post_rest("/environments/#{environment}/cookbook_versions",{:run_list => cookbooks_with_contraints})
179
179
  solution = Hash.new
180
180
  response.sort.each do |name, cb|
181
- solution[name]=cb.version
181
+ solution[name]=cb['version']
182
182
  end
183
183
  return solution
184
184
  end
@@ -12,9 +12,11 @@
12
12
  # See the License for the specific language governing permissions and
13
13
  # limitations under the License.
14
14
 
15
+ require 'chef/cookbook/metadata'
16
+
15
17
  class Chef
16
18
  class Knife
17
- # This class implements knife pinnings list ['environment_regex'] ['cookbook_regex']
19
+ # This class implements knife pinnings set <environment> [cookbook version]
18
20
  class PinningsSet < Chef::Knife
19
21
  banner 'knife pinnings set ENVIRONMENT [COOKBOOK VERSION]'
20
22
 
@@ -14,11 +14,11 @@
14
14
 
15
15
  class Chef
16
16
  class Knife
17
- # This class knife pinnings set auto ['environment'] ['cookbook_regex']
17
+ # This class implements knife pinnings set auto <environment> [cookbook[@version]]
18
18
  class PinningsSetAuto < Chef::Knife
19
19
  require 'chef/knife/pinnings_mixin'
20
20
  banner 'knife pinnings set auto ENVIRONMENT [COOKBOOK_VERSION_CONSTRAINTS]'
21
- FakeChefEnvironmentStruct = Struct.new :name, :cookbook_versions
21
+ FakeChefEnvironmentStruct = Struct.new :name, :cookbook_versions
22
22
 
23
23
  def run
24
24
  case name_args.length
@@ -35,7 +35,7 @@ class Chef
35
35
  exit 255
36
36
  end
37
37
  @environment = Environment.load(@environment_name)
38
- nodes = nodes_in(rest, @environment)
38
+ nodes = nodes_in(rest, @environment)
39
39
  ui.info("#{nodes.length} nodes have been found in environment #{@environment_name}: #{nodes.to_s}")
40
40
  cookbooks = cookbooks_used_by(rest, @environment_name)
41
41
  ui.info("#{cookbooks.length} recipes have been found for the nodes: #{cookbooks.to_s}")
@@ -54,7 +54,7 @@ class Chef
54
54
  environments.push(@environment)
55
55
  environments.push(FakeChefEnvironmentStruct.new('chef_resolver_solution',solution_cookbook_versions))
56
56
  display_pinnings_table(environments, @cookbook_regex)
57
-
57
+
58
58
  ui.msg('')
59
59
  ui.confirm("Do you want to set these cookbook versions on chef environment:#{@environment_name} ")
60
60
  ui.msg('')
@@ -14,7 +14,7 @@
14
14
 
15
15
  class Chef
16
16
  class Knife
17
- # This class implements knife pinnings list ['environment_regex'] ['cookbook_regex']
17
+ # This class implements knife pinnings wipe ['environment'] ['cookbook_regex']
18
18
  class PinningsWipe < Chef::Knife
19
19
  require 'chef/knife/pinnings_mixin'
20
20
  banner 'knife pinnings wipe ENVIRONMENT [COOKBOOK_REGEX]'
@@ -29,7 +29,7 @@ class Chef
29
29
  environment = Environment.load(name_args[0])
30
30
  display_environments([environment], cookbook_regex)
31
31
  ui.msg('')
32
- ui.confirm("Do you want to wipe cookbooks in #{environment.name}")
32
+ ui.confirm("Do you want to wipe cookbook constraints in #{environment.name}")
33
33
  ui.msg('')
34
34
  wipe(environment, cookbook_regex)
35
35
  end
@@ -39,7 +39,7 @@ class Chef
39
39
  name =~ /#{cookbook_regex}/
40
40
  end
41
41
  environment.save
42
- ui.msg('Done')
42
+ ui.msg("Cookbook constraints wiped from #{environment.name}")
43
43
  end
44
44
  end
45
45
  end
@@ -15,7 +15,7 @@
15
15
  # rubocop:disable Style/Documentation
16
16
  module Knife
17
17
  module Pinnings
18
- VERSION = '1.4.3'
18
+ VERSION = '1.4.7'
19
19
  MAJOR, MINOR, TINY = VERSION.split('.')
20
20
  end
21
21
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-pinnings
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.3
4
+ version: 1.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Nixon
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-21 00:00:00.000000000 Z
11
+ date: 2020-05-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -26,62 +26,6 @@ dependencies:
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '1.7'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '1.7'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '10.0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '10.0'
55
- - !ruby/object:Gem::Dependency
56
- name: rubocop
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: guard
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: guard-rake
85
29
  requirement: !ruby/object:Gem::Requirement
86
30
  requirements:
87
31
  - - ">="
@@ -95,7 +39,7 @@ dependencies:
95
39
  - !ruby/object:Gem::Version
96
40
  version: '0'
97
41
  - !ruby/object:Gem::Dependency
98
- name: guard-shell
42
+ name: rake
99
43
  requirement: !ruby/object:Gem::Requirement
100
44
  requirements:
101
45
  - - ">="
@@ -109,7 +53,7 @@ dependencies:
109
53
  - !ruby/object:Gem::Version
110
54
  version: '0'
111
55
  - !ruby/object:Gem::Dependency
112
- name: guard-rubocop
56
+ name: rubocop
113
57
  requirement: !ruby/object:Gem::Requirement
114
58
  requirements:
115
59
  - - ">="
@@ -150,7 +94,7 @@ files:
150
94
  - lib/knife-pinnings/version.rb
151
95
  homepage: https://github.com/trickyearlobe/knife-pinnings
152
96
  licenses:
153
- - Apache 2.0
97
+ - Apache-2.0
154
98
  metadata: {}
155
99
  post_install_message:
156
100
  rdoc_options: []
@@ -167,11 +111,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
111
  - !ruby/object:Gem::Version
168
112
  version: '0'
169
113
  requirements: []
170
- rubyforge_project:
171
- rubygems_version: 2.5.2
114
+ rubygems_version: 3.0.3
172
115
  signing_key:
173
116
  specification_version: 4
174
117
  summary: Chef knife plugin to set, list, compare, copy and delete cookbook pinnings
175
118
  across environments
176
119
  test_files: []
177
- has_rdoc: