motoko 1.0.0 → 1.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/CHANGELOG.md +18 -0
- data/README.md +51 -11
- data/Rakefile +18 -1
- data/lib/motoko/option_parser.rb +5 -1
- data/lib/motoko/version.rb +1 -1
- data/motoko.gemspec +2 -0
- metadata +17 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b655f710fff5c1442d40c441172a62aed7ab6431e094fa6b107e2808e4b19d81
|
4
|
+
data.tar.gz: 3e3c338bf5e18961f12e88531d7b2a110fbd5a961ec205592c250e9f40a3abc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aafac19ff2e1602fc0efc2ad2137065493d39d1320044afc84a349a9366c642dda8eedb0b93395cb6f016a81fab59fcf2e08f996c09845eace00d73c72727dce
|
7
|
+
data.tar.gz: 108d41d8043d3cc3a92cf2f46b666f19a011e305075f6674c67613b45fde176f8bd07e065fa0caed8a640ceb281b3dd2f3fc3df2189d3071b7b35cfc70059405
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [1.1.0](https://github.com/smortex/motoko/tree/1.1.0) (2021-07-26)
|
9
|
+
|
10
|
+
[Full Changelog](https://github.com/smortex/motoko/compare/v1.0.0...1.1.0)
|
11
|
+
|
12
|
+
**Implemented enhancements:**
|
13
|
+
|
14
|
+
- Allow shortcuts to replace the list of columns [\#2](https://github.com/smortex/motoko/pull/2) ([smortex](https://github.com/smortex))
|
15
|
+
|
16
|
+
|
17
|
+
|
18
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/README.md
CHANGED
@@ -2,20 +2,50 @@
|
|
2
2
|
|
3
3
|
A gem to get inventories of nodes in a Puppet / Choria deployment.
|
4
4
|
|
5
|
+
<!-- vim-markdown-toc GFM -->
|
6
|
+
|
7
|
+
* [Installation](#installation)
|
8
|
+
* [Usage](#usage)
|
9
|
+
* [Basic usage](#basic-usage)
|
10
|
+
* [Which nodes are currently up and running](#which-nodes-are-currently-up-and-running)
|
11
|
+
* [Which nodes are known to puppet](#which-nodes-are-known-to-puppet)
|
12
|
+
* [Accessing facts](#accessing-facts)
|
13
|
+
* [Add more facts to the output](#add-more-facts-to-the-output)
|
14
|
+
* [Filtering](#filtering)
|
15
|
+
* [Which nodes have burned in Strasbourg](#which-nodes-have-burned-in-strasbourg)
|
16
|
+
* [Configuration](#configuration)
|
17
|
+
* [Columns](#columns)
|
18
|
+
* [Column Specifications](#column-specifications)
|
19
|
+
* [Shortcuts](#shortcuts)
|
20
|
+
* [Resolvers](#resolvers)
|
21
|
+
* [Extending Motoko with custom resolvers](#extending-motoko-with-custom-resolvers)
|
22
|
+
* [Formatters](#formatters)
|
23
|
+
* [Extending Motoko with custom formatters](#extending-motoko-with-custom-formatters)
|
24
|
+
* [Development](#development)
|
25
|
+
* [Contributing](#contributing)
|
26
|
+
* [License](#license)
|
27
|
+
* [Code of Conduct](#code-of-conduct)
|
28
|
+
|
29
|
+
<!-- vim-markdown-toc -->
|
30
|
+
|
5
31
|
## Installation
|
6
32
|
|
7
|
-
Take care to install this tool in the Puppet
|
33
|
+
Take care to install this tool in the Puppet environment. If you are using the AIO package, you can install with:
|
8
34
|
|
9
35
|
```
|
10
|
-
/opt/puppetlabs/puppet/bin/gem install --bindir /opt/puppetlabs/bin
|
36
|
+
/opt/puppetlabs/puppet/bin/gem install --bindir /opt/puppetlabs/bin motoko
|
11
37
|
```
|
12
38
|
|
13
39
|
Alternatively, you can install using Puppet:
|
14
40
|
|
15
41
|
```puppet
|
16
42
|
package { 'motoko':
|
17
|
-
ensure
|
18
|
-
provider
|
43
|
+
ensure => 'installed',
|
44
|
+
provider => 'puppet_gem',
|
45
|
+
install_options => [
|
46
|
+
'--bindir',
|
47
|
+
'/opt/puppetlabs/bin',
|
48
|
+
],
|
19
49
|
}
|
20
50
|
```
|
21
51
|
|
@@ -58,7 +88,7 @@ The usual filtering knobs are available for the choria inventory script. The pu
|
|
58
88
|
|
59
89
|
#### Which nodes have burned in Strasbourg
|
60
90
|
|
61
|
-
The initial work on querying PuppetDB is due to the fact that you can't ask Choria for information about nodes which are gone. On March 9th 2021, [OVH lost (part of) it's Strasboug datacenter](https://twitter.com/olesovhcom/status/1369478732247932929?ref_src=twsrc%5Etfw) and the frustration of not being able to
|
91
|
+
The initial work on querying PuppetDB is due to the fact that you can't ask Choria for information about nodes which are gone. On March 9th 2021, [OVH lost (part of) it's Strasboug datacenter](https://twitter.com/olesovhcom/status/1369478732247932929?ref_src=twsrc%5Etfw) and the frustration of not being able to conveniently build a list of affected nodes and customers was a pain. With Motoko we can now just query PuppetDB:
|
62
92
|
|
63
93
|
```sh-session
|
64
94
|
romain@zappy ~ % pdb-inventory -F datacenter=/sbg/
|
@@ -123,10 +153,20 @@ shortcuts:
|
|
123
153
|
|
124
154
|
This add a new command switch `--dc` equivalent to `--add-columns datacenter,server_rack,server_id --with-fact virtual=physical`.
|
125
155
|
|
156
|
+
The following settings are available when defining shortcuts:
|
157
|
+
|
158
|
+
| Setting | Description |
|
159
|
+
|---------------|-------------|
|
160
|
+
| `description` | Description of the shortcut (visible in `--help`) |
|
161
|
+
| `columns` | List of columns to display |
|
162
|
+
| `add_columns` | Extra columns to append of the default list |
|
163
|
+
| `with_fact` | Extra filtering of the results based on facts |
|
164
|
+
| `with_class` | Extra filtering of the results based on configured classes |
|
165
|
+
|
126
166
|
## Resolvers
|
127
167
|
|
128
|
-
| Resolver name |
|
129
|
-
|
168
|
+
| Resolver name | Description |
|
169
|
+
|-------------------|-------------|
|
130
170
|
| `cpu` | Aggregate information about the CPU |
|
131
171
|
| `fact` | Gather the value of the fact `fact` (default to the column name if unset) |
|
132
172
|
| `identity` | Gather the node identity |
|
@@ -135,12 +175,12 @@ This add a new command switch `--dc` equivalent to `--add-columns datacenter,ser
|
|
135
175
|
|
136
176
|
### Extending Motoko with custom resolvers
|
137
177
|
|
138
|
-
Custom resolvers can be
|
178
|
+
Custom resolvers can be dropped in the `<motoko-config-directory>/resolvers/` directory. They are automatically loaded on startup.
|
139
179
|
|
140
180
|
## Formatters
|
141
181
|
|
142
|
-
| Formatter name |
|
143
|
-
|
182
|
+
| Formatter name | Description |
|
183
|
+
|-----------------|-------------|
|
144
184
|
| `boolean` | Display a checkmark for things that evaluate to `true` |
|
145
185
|
| `datetime` | Display a date and time in the local time zone |
|
146
186
|
| `datetime_ago` | Display a date and time as a duration |
|
@@ -150,7 +190,7 @@ Custom resolvers can be droped in the `<motoko-config-directory>/resolvers/` dir
|
|
150
190
|
|
151
191
|
### Extending Motoko with custom formatters
|
152
192
|
|
153
|
-
Custom formatters can be
|
193
|
+
Custom formatters can be dropped in the `<motoko-config-directory>/formatters/` directory. They are automatically loaded on startup.
|
154
194
|
|
155
195
|
## Development
|
156
196
|
|
data/Rakefile
CHANGED
@@ -1,8 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'bundler/gem_tasks'
|
4
|
-
require 'rspec/core/rake_task'
|
5
4
|
|
5
|
+
require 'github_changelog_generator/task'
|
6
|
+
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
|
7
|
+
config.future_release = Motoko::VERSION
|
8
|
+
config.header = <<~HEADER.chomp
|
9
|
+
# Changelog
|
10
|
+
|
11
|
+
All notable changes to this project will be documented in this file.
|
12
|
+
|
13
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
|
14
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
15
|
+
HEADER
|
16
|
+
config.exclude_labels = %w[duplicate question invalid wontfix wont-fix skip-changelog ignore]
|
17
|
+
config.user = 'smortex'
|
18
|
+
config.project = 'motoko'
|
19
|
+
config.since_tag = 'v1.0.0'
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'rspec/core/rake_task'
|
6
23
|
RSpec::Core::RakeTask.new(:spec)
|
7
24
|
|
8
25
|
task default: :spec
|
data/lib/motoko/option_parser.rb
CHANGED
@@ -67,7 +67,11 @@ module Motoko
|
|
67
67
|
|
68
68
|
formatter.shortcuts.each do |key, value|
|
69
69
|
parser.on("--#{key}", value.delete('description')) do
|
70
|
-
|
70
|
+
if value.key?('columns')
|
71
|
+
formatter.columns.replace(value.delete('columns'))
|
72
|
+
else
|
73
|
+
formatter.columns.push(*value.delete('add_columns'))
|
74
|
+
end
|
71
75
|
local_options[:with_class] ||= []
|
72
76
|
local_options[:with_class].push(*value.delete('with_class'))
|
73
77
|
local_options[:with_fact] ||= []
|
data/lib/motoko/version.rb
CHANGED
data/motoko.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motoko
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Romain Tartière
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-07-
|
11
|
+
date: 2021-07-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: choria-mcorpc-support
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: github_changelog_generator
|
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'
|
55
69
|
description:
|
56
70
|
email:
|
57
71
|
- romain@blogreen.org
|
@@ -67,6 +81,7 @@ files:
|
|
67
81
|
- ".rubocop.yml"
|
68
82
|
- ".simplecov"
|
69
83
|
- ".travis.yml"
|
84
|
+
- CHANGELOG.md
|
70
85
|
- CODE_OF_CONDUCT.md
|
71
86
|
- Gemfile
|
72
87
|
- LICENSE.txt
|