knife-pinnings 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +9 -0
- data/CHANGELOG.md +21 -0
- data/Guardfile +16 -0
- data/README.md +46 -18
- data/Rakefile +4 -2
- data/knife-pinnings.gemspec +18 -12
- data/lib/chef/knife/pinnings_compare.rb +30 -0
- data/lib/chef/knife/pinnings_list.rb +6 -27
- data/lib/chef/knife/pinnings_mixin.rb +104 -0
- data/lib/chef/knife/pinnings_promote.rb +48 -0
- data/lib/chef/knife/pinnings_wipe.rb +47 -0
- data/lib/knife-pinnings/version.rb +2 -1
- metadata +69 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bf68c9548eb98813a8cb2fe8de5d266ffb86761e
|
4
|
+
data.tar.gz: f7bc67ff850f3cd9c2f6d1e22af2d2602253eb1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9a1aea8c107c53e875a1c00c1ba44d8cd010b9cc474686b7dcd09032b5a1b7243b95d20143e8746abf2c187b30ff4c62e0a559b9e6d6212d5d24f62f181ab3e2
|
7
|
+
data.tar.gz: ee2b9a24077acc3683fab6e9a444fcb4eaccfe8b68ec293f938b08b5e929ad6831a70f1d47f033ae9f42ced597c1e41c74ed961429e7bf2deb4382c322d7b48d
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
# In these days of widescreen TV and big monitors
|
2
|
+
# a line length of 80 sounds a bit unreasonable
|
3
|
+
Metrics/LineLength:
|
4
|
+
Max: 120
|
5
|
+
|
6
|
+
# Actually, I don't like hash rockets as they look untidy
|
7
|
+
# If Rubocop doesn't use them in the config file, why should I ?
|
8
|
+
Style/HashSyntax:
|
9
|
+
Enabled: false
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
## Change log for knife-pinnings
|
2
|
+
|
3
|
+
This GEM is versioned according to "Semantic versioning".
|
4
|
+
More information at <http://semver.org/>
|
5
|
+
|
6
|
+
Given a version xx.yy.zz
|
7
|
+
|
8
|
+
* A change in zz is a bug fix
|
9
|
+
* A change in yy is a non-breaking change (usually a new feature)
|
10
|
+
* A change in zz is a major change which likely breaks stuff that depends on us.
|
11
|
+
|
12
|
+
## 1.1.0
|
13
|
+
* Improved performance by using search instead of iteration to get environment detail.
|
14
|
+
* Added support for comparing pinnings between environments with color highlighting
|
15
|
+
* Added support for promoting pinnings between environments
|
16
|
+
* Added support for regex based wiping pinnings in a single environment
|
17
|
+
* Stop Rubocop whining about code formatting and complexity
|
18
|
+
|
19
|
+
## 1.0.0
|
20
|
+
* Initial release to view pinnings in different Chef environments
|
21
|
+
* REGEX support for filtering lists of environments and cookbooks
|
data/Guardfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# rubocop:disable Style/RegexpLiteral
|
2
|
+
|
3
|
+
guard :rubocop do
|
4
|
+
watch(%r{.+\.rb$})
|
5
|
+
watch(%r{(?:.+/)?\.rubocop\.yml$}) { |m| File.dirname(m[0]) }
|
6
|
+
end
|
7
|
+
|
8
|
+
guard :shell do
|
9
|
+
watch(/.*/) { `git add --all` }
|
10
|
+
end
|
11
|
+
|
12
|
+
guard 'rake', :task => 'install' do
|
13
|
+
watch(%r{^lib/.*\.rb})
|
14
|
+
watch(%r{^.*\.gemspec})
|
15
|
+
watch(%r{^Gemfile$})
|
16
|
+
end
|
data/README.md
CHANGED
@@ -1,37 +1,38 @@
|
|
1
1
|
# knife-pinnings
|
2
2
|
|
3
|
-
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/knife-pinnings.svg)](http://badge.fury.io/rb/knife-pinnings)
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
Add this line to your application's Gemfile:
|
8
|
-
|
9
|
-
|
10
|
-
gem 'knife-pinnings'
|
11
|
-
|
12
|
-
And then execute:
|
5
|
+
This gem extends Chef's knife command to manage version pinnings in your Chef environments
|
13
6
|
|
14
|
-
|
7
|
+
* Get a list of all pinnings in all environments
|
8
|
+
* Compare pinnings across multiple environments
|
9
|
+
* Promote pinnings between environments
|
10
|
+
* Wipe pinnings from environments
|
15
11
|
|
16
|
-
|
12
|
+
## Installation
|
13
|
+
Pretty standard stuff....
|
17
14
|
|
18
15
|
$ gem install knife-pinnings
|
19
16
|
|
20
17
|
## Usage
|
21
18
|
|
22
|
-
|
23
|
-
|
24
|
-
$ knife pinnings list ['cookbook_regex'] ['environment_regex']
|
19
|
+
A lot of `knife pinning` commands use the power of ruby's REGEX matching for flexible matching of environment and cookbook names.
|
25
20
|
|
26
|
-
|
21
|
+
* You can try out REGEX expressions in this editor <http://rubular.com>
|
22
|
+
* You can learn about ruby REGEX here <http://www.tutorialspoint.com/ruby/ruby_regular_expressions.htm>
|
23
|
+
* REGEX with wildcards may need to be wrapped in single quotes to hide them from the shell
|
27
24
|
|
25
|
+
### Getting a list of pinnings in multiple environments
|
26
|
+
In general you can use
|
27
|
+
```bash
|
28
|
+
$ knife pinnings list ['environment_regex'] ['cookbook_regex']
|
29
|
+
```
|
28
30
|
|
29
|
-
To find cookbooks begining with app_
|
30
|
-
(Note the use of '' around wildcards to prevent interpretation by the shell)
|
31
|
+
To find cookbooks begining with app_ in any environment
|
31
32
|
|
32
33
|
$ knife pinnings '.*' '^app_.*'
|
33
34
|
|
34
|
-
To find cookbooks
|
35
|
+
To find cookbooks beginning with app_ but only in production
|
35
36
|
|
36
37
|
$ knife pinnings list '^production$' '^app_.*$'
|
37
38
|
|
@@ -39,6 +40,33 @@ To find cookbooks in acceptance or production with names beginning with app_
|
|
39
40
|
|
40
41
|
$ knife pinnings list '(^accept.*|^production$)' '^app_.*'
|
41
42
|
|
43
|
+
### Comparing environments
|
44
|
+
To get a color coded comparison grid showing whats not up to date and whats missing.
|
45
|
+
|
46
|
+
knife compare ENV1 ENV2
|
47
|
+
|
48
|
+
|
49
|
+
### Promoting pinnings between environments
|
50
|
+
Promote pinnings from one environment to another.
|
51
|
+
|
52
|
+
knife pinnings promote ENV1 ENV2
|
53
|
+
|
54
|
+
NOTE: Pinnings which are missing in the source environment will NOT be deleted from the target.
|
55
|
+
|
56
|
+
### Wiping pinnings in an environment
|
57
|
+
|
58
|
+
To wipe pinnings in a single environment
|
59
|
+
|
60
|
+
knife pinnings wipe ENVIRONMENT ['cookbook_regex']
|
61
|
+
|
62
|
+
To wipe the pinnings from development
|
63
|
+
|
64
|
+
knife pinnings wipe development
|
65
|
+
|
66
|
+
To wipe my skunk app cookbooks from development
|
67
|
+
|
68
|
+
knife pinnings wipe development '^skunk_app.*'
|
69
|
+
|
42
70
|
## Contributing
|
43
71
|
|
44
72
|
1. Fork it ( <https://github.com/trickyearlobe/knife-pinnings/fork> )
|
data/Rakefile
CHANGED
@@ -7,12 +7,14 @@ Bundler::GemHelper.install_tasks
|
|
7
7
|
|
8
8
|
task :default => :spec
|
9
9
|
|
10
|
-
desc
|
10
|
+
desc 'Run specs'
|
11
11
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
12
12
|
spec.pattern = 'spec/**/*_spec.rb'
|
13
13
|
end
|
14
14
|
|
15
|
-
|
15
|
+
# rubocop:disable Lint/Eval
|
16
|
+
gem_spec = eval(File.read('knife-pinnings.gemspec'))
|
17
|
+
# rubocop:enable Lint/Eval
|
16
18
|
|
17
19
|
RDoc::Task.new do |rdoc|
|
18
20
|
rdoc.rdoc_dir = 'rdoc'
|
data/knife-pinnings.gemspec
CHANGED
@@ -4,22 +4,28 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
4
4
|
require 'knife-pinnings/version'
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
|
-
spec.name =
|
7
|
+
spec.name = 'knife-pinnings'
|
8
8
|
spec.version = Knife::Pinnings::VERSION
|
9
|
-
spec.authors = [
|
10
|
-
spec.email = [
|
11
|
-
spec.summary =
|
12
|
-
spec.description =
|
13
|
-
spec.homepage =
|
14
|
-
spec.license =
|
9
|
+
spec.authors = ['Richard Nixon']
|
10
|
+
spec.email = ['richard.nixon@btinternet.com']
|
11
|
+
spec.summary = 'Extend Chef\'s Knife command to list, compare, promote and wipe pinnings across environments'
|
12
|
+
spec.description = 'List, compare, promote or wipe pinnings across chef environments. Some commands use REGEX matches to do bulk pinning work.'
|
13
|
+
spec.homepage = 'https://github.com/trickyearlobe/knife-pinnings'
|
14
|
+
spec.license = 'Apache 2.0'
|
15
15
|
|
16
16
|
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.require_paths = ['lib']
|
18
|
+
|
19
|
+
# rubocop:disable Style/RegexpLiteral
|
17
20
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
21
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ["lib"]
|
20
22
|
|
21
|
-
spec.add_dependency
|
22
|
-
spec.add_development_dependency
|
23
|
-
spec.add_development_dependency
|
24
|
-
spec.add_development_dependency
|
23
|
+
spec.add_dependency 'chef', '>=11.10.4'
|
24
|
+
spec.add_development_dependency 'rspec'
|
25
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
26
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
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 'rubocop'
|
25
31
|
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# Copyright 2015 Richard Nixon
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
class Chef
|
16
|
+
class Knife
|
17
|
+
# This class implements knife pinnings list ['environment_regex'] ['cookbook_regex']
|
18
|
+
class PinningsCompare < Chef::Knife
|
19
|
+
require 'chef/knife/pinnings_mixin'
|
20
|
+
banner "knife pinnings compare ['environment_regex'] ['cookbook_regex']"
|
21
|
+
|
22
|
+
def run
|
23
|
+
environment_regex = "#{name_args[0] || '.*'}"
|
24
|
+
cookbook_regex = "#{name_args[1] || '.*'}"
|
25
|
+
environments = filter_environments(Environment.list(true), environment_regex)
|
26
|
+
display_pinnings_table(environments, cookbook_regex)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -14,38 +14,17 @@
|
|
14
14
|
|
15
15
|
class Chef
|
16
16
|
class Knife
|
17
|
+
# This class implements knife pinnings list ['environment_regex'] ['cookbook_regex']
|
17
18
|
class PinningsList < Chef::Knife
|
18
|
-
|
19
|
-
banner "knife pinnings list [environment_regex] [cookbook_regex]"
|
19
|
+
require 'chef/knife/pinnings_mixin'
|
20
|
+
banner "knife pinnings list ['environment_regex'] ['cookbook_regex']"
|
20
21
|
|
21
22
|
def run
|
22
|
-
rest = Chef::REST.new(Chef::Config[:chef_server_url])
|
23
23
|
environment_regex = "#{name_args[0] || '.*'}"
|
24
24
|
cookbook_regex = "#{name_args[1] || '.*'}"
|
25
|
-
|
26
|
-
|
27
|
-
environments = rest.get_rest("/environments").to_hash
|
28
|
-
environments.each do |env_name,env_url|
|
29
|
-
|
30
|
-
# Did the user want to see this environment?
|
31
|
-
if (env_name =~ /#{environment_regex}/ )
|
32
|
-
|
33
|
-
# If so grab the environment detail and display it
|
34
|
-
env_detail = rest.get_rest("/environments/#{env_name}").to_hash
|
35
|
-
ui.msg(ui.color("Environment: #{env_name}", :yellow))
|
36
|
-
|
37
|
-
# Iterate through the pinnings in this environment
|
38
|
-
env_detail['cookbook_versions'].each do |cookbook_name,cookbook_version|
|
39
|
-
|
40
|
-
# Did the user want to see this cookbook pinning?
|
41
|
-
if (cookbook_name =~ /#{cookbook_regex}/)
|
42
|
-
ui.msg(" #{cookbook_name} #{cookbook_version}")
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
end
|
25
|
+
environments = filter_environments(Environment.list(true), environment_regex)
|
26
|
+
display_environments(environments, cookbook_regex)
|
48
27
|
end
|
49
28
|
end
|
50
29
|
end
|
51
|
-
end
|
30
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
# Copyright 2015 Richard Nixon
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
# This method strips the = off Chef "= xxx.yyy.zzz" versions numbers
|
16
|
+
def version_strip(version_string)
|
17
|
+
version_string.match(/()[0-9]*\.[0-9]*\.[0-9]*/).to_s
|
18
|
+
end
|
19
|
+
|
20
|
+
# This method takes an array of environments and filters then using a REGEX
|
21
|
+
def filter_environments(environments, environment_regex)
|
22
|
+
filtered_environments = []
|
23
|
+
environments.each do |name, environment|
|
24
|
+
filtered_environments << environment if name =~ /#{environment_regex}/
|
25
|
+
end
|
26
|
+
filtered_environments
|
27
|
+
end
|
28
|
+
|
29
|
+
def filter_cookbooks(cookbooks, cookbook_regex)
|
30
|
+
filtered_cookbooks = []
|
31
|
+
cookbooks.each do |name, version|
|
32
|
+
filtered_cookbooks << [name, version] if name =~ /#{cookbook_regex}/
|
33
|
+
end
|
34
|
+
filtered_cookbooks
|
35
|
+
end
|
36
|
+
|
37
|
+
# This method generates a color coded table of cookbook versions across environments
|
38
|
+
def display_pinnings_table(environments, cookbook_regex)
|
39
|
+
ui.msg(
|
40
|
+
ui.list(
|
41
|
+
build_pinnings_table(environments, cookbook_regex),
|
42
|
+
:columns_across,
|
43
|
+
environments.length + 1
|
44
|
+
)
|
45
|
+
)
|
46
|
+
end
|
47
|
+
|
48
|
+
def build_pinnings_table(environments, cookbook_regex)
|
49
|
+
cookbooks = {}
|
50
|
+
|
51
|
+
# Get the cookbooks into a sparse hash of hashes
|
52
|
+
environments.each do |environment|
|
53
|
+
environment.cookbook_versions.each do |name, version|
|
54
|
+
if name =~ /#{cookbook_regex}/
|
55
|
+
cookbooks[name] ||= {}
|
56
|
+
cookbooks[name][environment.name] = version_strip(version)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
# Make a grid header
|
62
|
+
cookbooks_grid = ['']
|
63
|
+
environments.each do |environment|
|
64
|
+
cookbooks_grid << environment.name
|
65
|
+
end
|
66
|
+
|
67
|
+
cookbooks.each do |cookbook_name, versions|
|
68
|
+
row = [cookbook_name]
|
69
|
+
environments.each do |environment|
|
70
|
+
row << (versions[environment.name] || '---')
|
71
|
+
end
|
72
|
+
row = add_color(row)
|
73
|
+
cookbooks_grid += row
|
74
|
+
end
|
75
|
+
cookbooks_grid
|
76
|
+
end
|
77
|
+
|
78
|
+
def add_color(row)
|
79
|
+
# The first element in the row is the cookbook name so skip that
|
80
|
+
row[0] = ui.color(row[0], :white)
|
81
|
+
row_color = 'green'
|
82
|
+
row[2..row.size].each do |version|
|
83
|
+
row_color = 'red' unless version == row[1]
|
84
|
+
end
|
85
|
+
for i in 1..row.size - 1
|
86
|
+
row[i] = ui.color(row[i], row_color.to_sym)
|
87
|
+
end
|
88
|
+
row
|
89
|
+
end
|
90
|
+
|
91
|
+
def display_environments(environments, cookbook_regex)
|
92
|
+
environments.each do |environment|
|
93
|
+
ui.msg(ui.color(environment.name, :yellow))
|
94
|
+
display_cookbooks(environment.cookbook_versions, cookbook_regex)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
def display_cookbooks(cookbooks, cookbook_regex)
|
99
|
+
rows = []
|
100
|
+
filter_cookbooks(cookbooks, cookbook_regex).each do |name, version|
|
101
|
+
rows << " #{name}" << version_strip(version)
|
102
|
+
end
|
103
|
+
ui.msg(ui.list(rows, :columns_across, 2)) if rows.length > 0
|
104
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# Copyright 2015 Richard Nixon
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
class Chef
|
16
|
+
class Knife
|
17
|
+
# This class copies cookbook pinnings between environments
|
18
|
+
class PinningsPromote < Chef::Knife
|
19
|
+
require 'chef/knife/pinnings_mixin'
|
20
|
+
banner 'knife pinnings promote <SOURCE_ENV> <TARGET_ENV>'
|
21
|
+
|
22
|
+
def run
|
23
|
+
unless name_args.length > 2
|
24
|
+
ui.fatal('You must specify a source and target environment.')
|
25
|
+
exit 255
|
26
|
+
end
|
27
|
+
source_env = Environment.load(name_args[0])
|
28
|
+
target_env = Environment.load(name_args[1])
|
29
|
+
cookbook_regex = name_args || '.*'
|
30
|
+
display_pinnings_table([source_env, target_env], '.*')
|
31
|
+
copy_pinnings(source_env, target_env)
|
32
|
+
end
|
33
|
+
|
34
|
+
def copy_pinnings(source_env, target_env)
|
35
|
+
ui.msg('')
|
36
|
+
ui.confirm("Do you want to write to #{target_env.name}")
|
37
|
+
ui.msg('')
|
38
|
+
|
39
|
+
source_env.cookbook_versions.each do |name, version|
|
40
|
+
target_env.cookbook_versions[name] = version if name =~ /#{cookbook_regex}/
|
41
|
+
end
|
42
|
+
|
43
|
+
target_env.save
|
44
|
+
ui.msg('Done!')
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# Copyright 2015 Richard Nixon
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
class Chef
|
16
|
+
class Knife
|
17
|
+
# This class implements knife pinnings list ['environment_regex'] ['cookbook_regex']
|
18
|
+
class PinningsWipe < Chef::Knife
|
19
|
+
require 'chef/knife/pinnings_mixin'
|
20
|
+
banner "knife pinnings wipe ENVIRONMENT ['cookbook_regex']"
|
21
|
+
|
22
|
+
def run
|
23
|
+
if name_args.length < 1
|
24
|
+
ui.fatal('You must specify an environment to wipe (and optionally a cookbook regex)')
|
25
|
+
exit 255
|
26
|
+
end
|
27
|
+
cookbook_regex = name_args[1] || '.*'
|
28
|
+
|
29
|
+
environment = Environment.load(name_args[0])
|
30
|
+
display_environments([environment], cookbook_regex)
|
31
|
+
ui.msg('')
|
32
|
+
ui.confirm("Do you want to wipe cookbooks in #{environment.name}")
|
33
|
+
ui.msg('')
|
34
|
+
wipe(environment,cookbook_regex)
|
35
|
+
end
|
36
|
+
|
37
|
+
def wipe(environment, cookbook_regex)
|
38
|
+
environment.cookbook_versions.delete_if do |name,version|
|
39
|
+
name =~ /#{cookbook_regex}/
|
40
|
+
end
|
41
|
+
environment.save
|
42
|
+
ui.msg('Done')
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -12,9 +12,10 @@
|
|
12
12
|
# See the License for the specific language governing permissions and
|
13
13
|
# limitations under the License.
|
14
14
|
|
15
|
+
# rubocop:disable Style/Documentation
|
15
16
|
module Knife
|
16
17
|
module Pinnings
|
17
|
-
VERSION =
|
18
|
+
VERSION = '1.1.0'
|
18
19
|
MAJOR, MINOR, TINY = VERSION.split('.')
|
19
20
|
end
|
20
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
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Nixon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef
|
@@ -66,8 +66,64 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '10.0'
|
69
|
-
|
70
|
-
|
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
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-shell
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
description: List, compare, promote or wipe pinnings across chef environments. Some
|
126
|
+
commands use REGEX matches to do bulk pinning work.
|
71
127
|
email:
|
72
128
|
- richard.nixon@btinternet.com
|
73
129
|
executables: []
|
@@ -75,12 +131,19 @@ extensions: []
|
|
75
131
|
extra_rdoc_files: []
|
76
132
|
files:
|
77
133
|
- ".gitignore"
|
134
|
+
- ".rubocop.yml"
|
135
|
+
- CHANGELOG.md
|
78
136
|
- Gemfile
|
137
|
+
- Guardfile
|
79
138
|
- LICENSE.txt
|
80
139
|
- README.md
|
81
140
|
- Rakefile
|
82
141
|
- knife-pinnings.gemspec
|
142
|
+
- lib/chef/knife/pinnings_compare.rb
|
83
143
|
- lib/chef/knife/pinnings_list.rb
|
144
|
+
- lib/chef/knife/pinnings_mixin.rb
|
145
|
+
- lib/chef/knife/pinnings_promote.rb
|
146
|
+
- lib/chef/knife/pinnings_wipe.rb
|
84
147
|
- lib/knife-pinnings/version.rb
|
85
148
|
homepage: https://github.com/trickyearlobe/knife-pinnings
|
86
149
|
licenses:
|
@@ -105,6 +168,7 @@ rubyforge_project:
|
|
105
168
|
rubygems_version: 2.4.1
|
106
169
|
signing_key:
|
107
170
|
specification_version: 4
|
108
|
-
summary:
|
171
|
+
summary: Extend Chef's Knife command to list, compare, promote and wipe pinnings across
|
172
|
+
environments
|
109
173
|
test_files: []
|
110
174
|
has_rdoc:
|