kafo 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of kafo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +16 -1
- data/lib/kafo/kafo_configure.rb +2 -2
- data/lib/kafo/param.rb +1 -0
- data/lib/kafo/params/hash.rb +31 -0
- data/lib/kafo/version.rb +1 -1
- data/lib/kafo/wizard.rb +1 -1
- data/modules/kafo_configure/lib/puppet/parser/functions/add_progress.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3f998e2006a64519cc5db13a1af9ed98a894766
|
4
|
+
data.tar.gz: 4659343e1af1974cfcd916b77612674b9b168905
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2874a1f991c8a20d00378e220a4f24465641bc7a9586d151a233181f748cee666b7c7ce0bffc26eb87874b0406e9d4f46daa9e8a5b4711fd5767fd91054573a1
|
7
|
+
data.tar.gz: b4059406b9309d066445a46498ccb17f56ee64dbe9546fb833f35bc6596f22eedc5cb093b01f0cc66956881ba8476269fb4fdbb684d27fe360eac93a74c127d8
|
data/README.md
CHANGED
@@ -9,7 +9,7 @@ echo "include some_modules" | puppet apply
|
|
9
9
|
```
|
10
10
|
## Why should I care?
|
11
11
|
|
12
|
-
Suppose you work on
|
12
|
+
Suppose you work on software which you want to distribute to a machine in
|
13
13
|
infrastructure managed by puppet. You write a puppet module for your app.
|
14
14
|
But you also want to be able to distribute this app to a machine outside of
|
15
15
|
puppet infrastructure (e.g. install it to your clients) or you want to install
|
@@ -271,6 +271,21 @@ bin/foreman-installer --puppetmaster-environments=development --puppetmaster-env
|
|
271
271
|
In interactive mode you'll be prompted for another value until you specify
|
272
272
|
blank line.
|
273
273
|
|
274
|
+
## Hash arguments
|
275
|
+
|
276
|
+
You can use Hash value not unlike Arrays. It's also multivalue type but
|
277
|
+
you have to specify a key:value pairs like this.
|
278
|
+
```bash
|
279
|
+
bin/foreman-installer --puppet-server-git-branch-map=master:some --puppet-server-git-branch-map=development:another
|
280
|
+
```
|
281
|
+
|
282
|
+
The same applies in interactive mode, you enter each pair on separate line
|
283
|
+
just like with Array, the only difference is that the line must be formatted
|
284
|
+
as key:value.
|
285
|
+
|
286
|
+
When parsing the value, the first colon divides key and value. All other
|
287
|
+
colons are ignored.
|
288
|
+
|
274
289
|
## Grouping in interactive mode
|
275
290
|
|
276
291
|
If your module has too much parameters you may find useful grouping. Every
|
data/lib/kafo/kafo_configure.rb
CHANGED
@@ -188,7 +188,7 @@ module Kafo
|
|
188
188
|
:default => !!config.app[:colors]
|
189
189
|
self.class.app_option ['-d', '--dont-save-answers'], :flag, 'Skip saving answers to answers.yaml?',
|
190
190
|
:default => !!config.app[:dont_save_answers]
|
191
|
-
self.class.app_option '--ignore-undocumented', :flag, 'Ignore inconsistent
|
191
|
+
self.class.app_option '--ignore-undocumented', :flag, 'Ignore inconsistent parameter documentation',
|
192
192
|
:default => false
|
193
193
|
self.class.app_option ['-i', '--interactive'], :flag, 'Run in interactive mode'
|
194
194
|
self.class.app_option '--log-level', 'LEVEL', 'Log level for log file output',
|
@@ -209,7 +209,7 @@ module Kafo
|
|
209
209
|
modules.each do |mod|
|
210
210
|
self.class.option d("--[no-]enable-#{mod.name}"),
|
211
211
|
:flag,
|
212
|
-
"Enable
|
212
|
+
"Enable '#{mod.name}' puppet module",
|
213
213
|
:default => mod.enabled?
|
214
214
|
end
|
215
215
|
|
data/lib/kafo/param.rb
CHANGED
@@ -0,0 +1,31 @@
|
|
1
|
+
module Kafo
|
2
|
+
module Params
|
3
|
+
class Hash < Param
|
4
|
+
def value=(value)
|
5
|
+
super
|
6
|
+
@value = typecast(@value)
|
7
|
+
end
|
8
|
+
|
9
|
+
def multivalued?
|
10
|
+
true
|
11
|
+
end
|
12
|
+
|
13
|
+
def condition_value
|
14
|
+
value.inspect
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def typecast(value)
|
20
|
+
if value.nil?
|
21
|
+
nil
|
22
|
+
elsif value.is_a?(::Hash)
|
23
|
+
value
|
24
|
+
else
|
25
|
+
value = [value].flatten
|
26
|
+
::Hash[value.map { |v| v.split(':', 2) }]
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/kafo/version.rb
CHANGED
data/lib/kafo/wizard.rb
CHANGED
@@ -131,7 +131,7 @@ END
|
|
131
131
|
end
|
132
132
|
|
133
133
|
def configure_multi(param)
|
134
|
-
say HighLine.color('every line is a separate value, blank line to quit', :info)
|
134
|
+
say HighLine.color('every line is a separate value, blank line to quit, for hash use key:value syntax', :info)
|
135
135
|
say "\ncurrent value: #{HighLine.color(param.value.to_s, :info)} %>"
|
136
136
|
ask("new value:") do |q|
|
137
137
|
q.gather = ""
|
@@ -2,7 +2,7 @@ require 'kafo_configure/lib/kafo/puppet/report_wrapper'
|
|
2
2
|
|
3
3
|
module Puppet::Parser::Functions
|
4
4
|
newfunction(:add_progress) do |args|
|
5
|
-
supported = %w(2.6. 2.7. 3.0. 3.1. 3.2. 3.3.)
|
5
|
+
supported = %w(2.6. 2.7. 3.0. 3.1. 3.2. 3.3. 3.4.)
|
6
6
|
if supported.any? { |version| Puppet::PUPPETVERSION.start_with?(version) }
|
7
7
|
# Monkey patch the transaction to put our wrapper around the report object
|
8
8
|
require 'puppet/transaction'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kafo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marek Hulan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-12-
|
11
|
+
date: 2013-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -197,6 +197,7 @@ files:
|
|
197
197
|
- lib/kafo/params/password.rb
|
198
198
|
- lib/kafo/params/string.rb
|
199
199
|
- lib/kafo/params/boolean.rb
|
200
|
+
- lib/kafo/params/hash.rb
|
200
201
|
- lib/kafo/params/array.rb
|
201
202
|
- lib/kafo/params/integer.rb
|
202
203
|
- lib/kafo/help_builder.rb
|