knife-chef-inventory 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/.travis.yml +0 -4
- data/CHANGELOG.md +19 -0
- data/Gemfile +1 -0
- data/README.md +103 -3
- data/Rakefile +5 -0
- data/knife-chef-inventory.gemspec +4 -2
- data/lib/chef/knife/inventory_chef_client.rb +2 -1
- data/lib/chef/knife/inventory_cookbook.rb +3 -2
- data/lib/knife-chef-inventory/version.rb +2 -1
- data/tasks/changelog.rake +15 -0
- metadata +25 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e718e13d67cb2cf5c773b660bee9373be4a3958c
|
4
|
+
data.tar.gz: a42cbab0cd03774bb22c4b1b1062b721b36d1ee2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f1d757fd3a97ed5268e3f16330d96703a7fd299cd6370c4a05a8ab4ca63aca6e2625bea1bd0a7dccce28beabb7f06779f17bd67153a71c1ac9815ea0cac5fe98
|
7
|
+
data.tar.gz: 502be5c618bf9e14138cebccc050da6ff665331e088d4c2be45776b3b9fa889b7e7d1386cf2c265b6dacefb41b4b5edca48bf701a6bd9c7588dae5e43e656a29
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.3.1
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Change Log
|
2
|
+
|
3
|
+
## [v0.1.0](https://github.com/brentm5/knife-chef-inventory/tree/v0.1.0) (2016-08-12)
|
4
|
+
[Full Changelog](https://github.com/brentm5/knife-chef-inventory/compare/v0.0.1...v0.1.0)
|
5
|
+
|
6
|
+
**Merged pull requests:**
|
7
|
+
|
8
|
+
- Update banner for inventory\_cookbook.rb [\#6](https://github.com/brentm5/knife-chef-inventory/pull/6) ([afiune](https://github.com/afiune))
|
9
|
+
- Add more information to readme [\#4](https://github.com/brentm5/knife-chef-inventory/pull/4) ([brentm5](https://github.com/brentm5))
|
10
|
+
- Add more to the readme and fix travis [\#3](https://github.com/brentm5/knife-chef-inventory/pull/3) ([brentm5](https://github.com/brentm5))
|
11
|
+
|
12
|
+
## [v0.0.1](https://github.com/brentm5/knife-chef-inventory/tree/v0.0.1) (2016-05-12)
|
13
|
+
**Merged pull requests:**
|
14
|
+
|
15
|
+
- Update to be called knife-chef-inventory [\#2](https://github.com/brentm5/knife-chef-inventory/pull/2) ([brentm5](https://github.com/brentm5))
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,9 +1,109 @@
|
|
1
|
-
[](https://rubygems.org/gems/knife-chef-inventory)
|
2
|
+
[](https://rubygems.org/gems/knife-chef-inventory)
|
3
|
+
[](https://travis-ci.org/brentm5/knife-chef-inventory)
|
4
|
+
[](https://codeclimate.com/github/brentm5/knife-chef-inventory)
|
5
|
+
[](https://gemnasium.com/github.com/brentm5/knife-chef-inventory)
|
4
6
|
|
5
7
|
Knife Chef Inventory
|
6
8
|
=======================
|
7
9
|
|
8
10
|
The main purpose of this knife plugin is to find objects that are not being used
|
9
11
|
on the chef server so they can be cleaned up
|
12
|
+
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
Installation is easy just as any other knife plugin, just install with the gem
|
16
|
+
command
|
17
|
+
|
18
|
+
```bash
|
19
|
+
# You can install to your chefdk environment
|
20
|
+
chef gem install knife-chef-inventory
|
21
|
+
|
22
|
+
# Or to a regular ruby environment
|
23
|
+
gem install knife-chef-inventory
|
24
|
+
```
|
25
|
+
|
26
|
+
## Usage
|
27
|
+
|
28
|
+
Everything suppose to be organized in an easy to navigate way. Everything is
|
29
|
+
nested under `knife inventory` and the commands should be self documenting.
|
30
|
+
Below are some simple examples
|
31
|
+
|
32
|
+
```bash
|
33
|
+
knife inventory
|
34
|
+
|
35
|
+
** INVENTORY COMMANDS **
|
36
|
+
knife inventory chef_client
|
37
|
+
knife inventory cookbook
|
38
|
+
```
|
39
|
+
|
40
|
+
|
41
|
+
### Cookbooks
|
42
|
+
You can look into a single cookbook below to see what versions are active. Then
|
43
|
+
once you see which ones are active you can dig in by specifying a version number
|
44
|
+
to drill into.
|
45
|
+
|
46
|
+
```bash
|
47
|
+
# Looking into the usage of the apache2 cookbook
|
48
|
+
knife inventory cookbook apache2
|
49
|
+
Total Nodes using Cookbook: 3
|
50
|
+
3.1.0 is used by 1 hosts
|
51
|
+
3.2.1 is used by 1 hosts
|
52
|
+
3.2.2 is used by 1 hosts
|
53
|
+
```
|
54
|
+
|
55
|
+
```bash
|
56
|
+
# Looking into the usage of the apache2 cookbook for version 3.1.0
|
57
|
+
knife inventory cookbook apache2 3.1.0
|
58
|
+
Cookbook Versions being used for apache2
|
59
|
+
server1.domain.com - 12312 Minutes
|
60
|
+
```
|
61
|
+
|
62
|
+
```bash
|
63
|
+
# We can also do wilcard to look at lets say version 3.2.x
|
64
|
+
knife inventory cookbook apache2 3.2.x
|
65
|
+
Cookbook Versions being used for apache2
|
66
|
+
server2.domain.com - 13 Minutes
|
67
|
+
server3.domain.com - 13 Minutes
|
68
|
+
```
|
69
|
+
|
70
|
+
```bash
|
71
|
+
# We can also pass in the "--env-constraints" option to look at any environment constaints that are specified
|
72
|
+
knife inventory cookbook apache2 --env-constraints
|
73
|
+
Total Nodes using Cookbook: 3
|
74
|
+
3.1.0 is used by 1 hosts
|
75
|
+
3.2.1 is used by 1 hosts
|
76
|
+
3.2.2 is used by 1 hosts
|
77
|
+
Environment Version Constraints for apache2
|
78
|
+
staging - ~> 3.2
|
79
|
+
production - = 3.2.1
|
80
|
+
```
|
81
|
+
|
82
|
+
### Chef Clients
|
83
|
+
You can also index chef client versions to see what is being used over all of
|
84
|
+
your infrastructure
|
85
|
+
|
86
|
+
```bash
|
87
|
+
# You can get a list of different client versions
|
88
|
+
knife inventory chef_client
|
89
|
+
11.6.8 is used by 1 hosts
|
90
|
+
11.7.0 is used by 1 hosts
|
91
|
+
12.6.0 is used by 20 hosts
|
92
|
+
12.7.2 is used by 14 hosts
|
93
|
+
12.8.1 is used by 9 hosts
|
94
|
+
12.9.38 is used by 2 hosts
|
95
|
+
12.9.41 is used by 11 hosts
|
96
|
+
```
|
97
|
+
|
98
|
+
```bash
|
99
|
+
# You can then drill into each node with wildcards to see what hosts are using each version
|
100
|
+
knife inventory chef_client 11.*
|
101
|
+
Client Versions being used
|
102
|
+
server2.domain.com - 13 Minutes
|
103
|
+
server3.domain.com - 13 Minutes
|
104
|
+
```
|
105
|
+
|
106
|
+
|
107
|
+
### TODO
|
108
|
+
There are still several things that need to be included, for example
|
109
|
+
environments, clients, users, nodes, and I guess roles.
|
data/Rakefile
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
$LOAD_PATH.push File.expand_path("../lib", __FILE__)
|
2
3
|
require "knife-chef-inventory/version"
|
3
4
|
|
@@ -7,7 +8,7 @@ Gem::Specification.new do |s|
|
|
7
8
|
s.platform = Gem::Platform::RUBY
|
8
9
|
s.authors = "Brent Montague"
|
9
10
|
s.email = "brent@bmontague.com"
|
10
|
-
s.homepage = "https://github.com/
|
11
|
+
s.homepage = "https://github.com/brentm5/knife-chef-inventory"
|
11
12
|
s.summary = "Chef Knife plugin to help cleanup outdated cookbooks"
|
12
13
|
s.description = "A knife plugin to see cookbooks that can be deleted"
|
13
14
|
|
@@ -16,9 +17,10 @@ Gem::Specification.new do |s|
|
|
16
17
|
s.files = `git ls-files`.split("\n")
|
17
18
|
s.require_paths = ["lib"]
|
18
19
|
|
19
|
-
s.add_dependency "chef", "
|
20
|
+
s.add_dependency "chef", "<= 12.11.18"
|
20
21
|
|
21
22
|
s.add_development_dependency "bundler", "~> 1.6"
|
22
23
|
s.add_development_dependency "rake", "~> 11.1"
|
23
24
|
s.add_development_dependency "rubocop", "~> 0.38"
|
25
|
+
s.add_development_dependency "github_changelog_generator", "~> 1.13"
|
24
26
|
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "chef/knife"
|
2
3
|
|
3
4
|
class Chef
|
@@ -57,7 +58,7 @@ class Chef
|
|
57
58
|
client_usage = client_usage_per_version[version]
|
58
59
|
return unless client_usage
|
59
60
|
|
60
|
-
ui.info "#{version} is used by #{client_usage} hosts" if client_usage
|
61
|
+
ui.info "#{version} is used by #{client_usage} hosts" if client_usage.positive?
|
61
62
|
end
|
62
63
|
|
63
64
|
def time_since(timestamp)
|
@@ -1,9 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
1
2
|
require "chef/knife"
|
2
3
|
|
3
4
|
class Chef
|
4
5
|
class Knife
|
5
6
|
class InventoryCookbook < Knife
|
6
|
-
banner "knife inventory cookbook"
|
7
|
+
banner "knife inventory cookbook COOKBOOK [VERSION] (options)"
|
7
8
|
|
8
9
|
deps do
|
9
10
|
require "chef/search/query"
|
@@ -92,7 +93,7 @@ class Chef
|
|
92
93
|
def analyze_version(version)
|
93
94
|
cookbook_usage = cookbook_usage_per_version[version]
|
94
95
|
if cookbook_usage
|
95
|
-
ui.info "#{version} is used by #{cookbook_usage} hosts" if cookbook_usage
|
96
|
+
ui.info "#{version} is used by #{cookbook_usage} hosts" if cookbook_usage.positive?
|
96
97
|
end
|
97
98
|
end
|
98
99
|
|
@@ -0,0 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
begin
|
3
|
+
require "knife-chef-inventory/version"
|
4
|
+
require "github_changelog_generator/task"
|
5
|
+
|
6
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
7
|
+
config.future_release = "v#{Knife::ChefInventory::VERSION}"
|
8
|
+
config.issues = false
|
9
|
+
config.enhancement_labels = %w(enhancement)
|
10
|
+
config.bug_labels = %w(bug)
|
11
|
+
config.exclude_labels = %w(no_changelog)
|
12
|
+
end
|
13
|
+
rescue LoadError
|
14
|
+
puts "Problem loading gems please install chef and github_changelog_generator"
|
15
|
+
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-chef-inventory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brent Montague
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - "<="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 12.11.18
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - "<="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 12.11.18
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0.38'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: github_changelog_generator
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.13'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.13'
|
69
83
|
description: A knife plugin to see cookbooks that can be deleted
|
70
84
|
email: brent@bmontague.com
|
71
85
|
executables: []
|
@@ -75,7 +89,9 @@ files:
|
|
75
89
|
- ".codeclimate.yml"
|
76
90
|
- ".gitignore"
|
77
91
|
- ".rubocop.yml"
|
92
|
+
- ".ruby-version"
|
78
93
|
- ".travis.yml"
|
94
|
+
- CHANGELOG.md
|
79
95
|
- Gemfile
|
80
96
|
- LICENSE
|
81
97
|
- README.md
|
@@ -84,7 +100,8 @@ files:
|
|
84
100
|
- lib/chef/knife/inventory_chef_client.rb
|
85
101
|
- lib/chef/knife/inventory_cookbook.rb
|
86
102
|
- lib/knife-chef-inventory/version.rb
|
87
|
-
|
103
|
+
- tasks/changelog.rake
|
104
|
+
homepage: https://github.com/brentm5/knife-chef-inventory
|
88
105
|
licenses:
|
89
106
|
- Apache License, v2.0
|
90
107
|
metadata: {}
|
@@ -104,7 +121,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
121
|
version: '0'
|
105
122
|
requirements: []
|
106
123
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.
|
124
|
+
rubygems_version: 2.5.1
|
108
125
|
signing_key:
|
109
126
|
specification_version: 4
|
110
127
|
summary: Chef Knife plugin to help cleanup outdated cookbooks
|