knife-topo 1.0.1 → 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/README.md +16 -10
- data/lib/chef/knife/topo/version.rb +1 -1
- data/lib/chef/knife/topo_create.rb +1 -1
- data/lib/chef/knife/topo_export.rb +13 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0be8df712b7387e67c6aba9af7e0433db88a6e56
|
4
|
+
data.tar.gz: 4cbd85eb38a152561f1db568868c955010babced
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0cff13f858765854b3c791dcf15ce8fafcf054eeb99aab2eb04d1ecedb11a5343962c4c80631b2b2f9ecea8a29b384cde87200e65c2c58b17b12072754fa971d
|
7
|
+
data.tar.gz: 1f5316d287e3e018a03c6cb1f210bd771dc660a02eb5477a2f65396b80160daf37ff2c34445a835c5a580426ac4c5c20e6600e8e7da322c2e29fbc89edf82fce
|
data/README.md
CHANGED
@@ -31,7 +31,8 @@ or install knife-topo as a gem
|
|
31
31
|
|
32
32
|
$ gem install knife-topo
|
33
33
|
|
34
|
-
You may need to use `
|
34
|
+
You may need to use `chef gem install knife-topo` (to install into the
|
35
|
+
embedded chefdk gem path), and you may need `sudo` depending on your setup.
|
35
36
|
|
36
37
|
This plugin has been tested with Chef Version 11.12 and 12.0.3 on Ubuntu 12.04 and 14.04 LTS,
|
37
38
|
and run on Windows and Mac.
|
@@ -349,9 +350,11 @@ which is used by `knife topo search`.
|
|
349
350
|
|
350
351
|
## knife topo export <a name="export"></a>
|
351
352
|
|
352
|
-
knife topo export [
|
353
|
+
knife topo export [ NODE ... ]
|
353
354
|
|
354
|
-
Exports the
|
355
|
+
Exports the nodes into a topology JSON.
|
356
|
+
|
357
|
+
If the topology does not already exist,
|
355
358
|
an outline for a new topology will be exported. The exported JSON
|
356
359
|
can be used as the basis for a new topology definition.
|
357
360
|
|
@@ -366,23 +369,26 @@ The knife topo export subcommand supports the following additional options.
|
|
366
369
|
|
367
370
|
Option | Description
|
368
371
|
------------ | -----------
|
372
|
+
--topo | Name of the topology to export (defaults to 'topo1')
|
373
|
+
--all | Export all topologies
|
369
374
|
--min-priority | Only export attributes with a priority equal or above this priority.
|
370
375
|
|
371
376
|
### Examples:
|
372
377
|
|
373
|
-
The following will export the data for nodes n1 and n2 as part of a
|
378
|
+
The following will export the data for nodes n1 and n2 as part of a
|
379
|
+
topology called 'my_topo':
|
380
|
+
|
381
|
+
$ knife topo export n1 n2 --topo=my_topo > new_topo.json
|
374
382
|
|
375
|
-
$ knife topo export new_topo n1 n2 > new_topo.json
|
376
|
-
|
377
383
|
|
378
384
|
The following will export all topologies to a file called 'all_topos.json'.
|
379
385
|
|
380
|
-
$ knife topo export
|
386
|
+
$ knife topo export --all > all_topos.json
|
381
387
|
|
382
|
-
The following will create an outline for a new topology called
|
383
|
-
|
384
|
-
$ knife topo export christine_test > christine_test.json
|
388
|
+
The following will create an outline for a new topology called
|
389
|
+
'christine_test', or export the current details if it already exists:
|
385
390
|
|
391
|
+
$ knife topo export --topo=christine_test > christine_test.json
|
386
392
|
|
387
393
|
|
388
394
|
## knife topo import <a name="import"></a>
|
@@ -84,7 +84,7 @@ class Chef
|
|
84
84
|
topo.create
|
85
85
|
rescue Net::HTTPServerException => e
|
86
86
|
raise unless e.to_s =~ /^409/
|
87
|
-
msg = "Topology #{
|
87
|
+
msg = "Topology #{topo_name} already exists - do you want to update it"
|
88
88
|
msg = msg + " to version " + format_topo_version(topo) if topo['version']
|
89
89
|
ui.confirm(msg, true, false)
|
90
90
|
topo.save
|
@@ -40,6 +40,17 @@ class Chef
|
|
40
40
|
:long => "--min-priority PRIORITY",
|
41
41
|
:default => "default",
|
42
42
|
:description => "Export attributes with this priority or above"
|
43
|
+
|
44
|
+
option :topo,
|
45
|
+
:long => "--topo TOPOLOGY",
|
46
|
+
:description => "Name to use for the topology",
|
47
|
+
:default => "topo1"
|
48
|
+
|
49
|
+
option :all,
|
50
|
+
:long => "--all",
|
51
|
+
:description => "Export all topologies",
|
52
|
+
:boolean => true,
|
53
|
+
:default => false
|
43
54
|
|
44
55
|
def most_common (vals)
|
45
56
|
vals.group_by do |val|
|
@@ -51,8 +62,8 @@ class Chef
|
|
51
62
|
|
52
63
|
@bag_name = topo_bag_name(config[:data_bag])
|
53
64
|
|
54
|
-
@topo_name =
|
55
|
-
@node_names = @name_args
|
65
|
+
@topo_name = config[:topo] unless config[:all]
|
66
|
+
@node_names = @name_args
|
56
67
|
|
57
68
|
unless ['default', 'normal', 'override'].include?(config[:min_priority])
|
58
69
|
ui.warn("--min-priority should be one of 'default', 'normal' or 'override'")
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-topo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christine Draper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-24 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Knife-topo uses a JSON file to capture a topology of nodes, which can
|
14
14
|
be loaded into Chef and bootstrapped
|