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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 488bca625279664d650e93473141dd3d57576865
4
- data.tar.gz: acf17bee83f2a11852645ebb22d9354858b69d40
3
+ metadata.gz: 0be8df712b7387e67c6aba9af7e0433db88a6e56
4
+ data.tar.gz: 4cbd85eb38a152561f1db568868c955010babced
5
5
  SHA512:
6
- metadata.gz: 381ee1dfd7e8a1c762fac1a23ac96fdca69588de951e1222dea8b5626bf3f5c9d28204de5d85737aff054151c638e755f1d567107a5152ef2bf2667f8e0ea111
7
- data.tar.gz: 0c150297a462aae959207a402e448bee908309c3e16b6d0623d8792f47dcbe599135c2d6819fe8892bea4d831bc333e9bb63b07efd092ac78b09342a840d01fa
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 `sudo gem install knife-topo`, depending on your setup.
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 [ TOPOLOGY [ NODE ... ]
353
+ knife topo export [ NODE ... ]
353
354
 
354
- Exports the specified topology as JSON. If the topology does not already exist,
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 topology called 'new_topo':
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 > all_topos.json
386
+ $ knife topo export --all > all_topos.json
381
387
 
382
- The following will create an outline for a new topology called 'christine_test':
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>
@@ -1,5 +1,5 @@
1
1
  module Knife
2
2
  module Topo
3
- VERSION = "1.0.1"
3
+ VERSION = "1.1.0"
4
4
  end
5
5
  end
@@ -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 #{display_name(topo)} already exists - do you want to update it"
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 = @name_args[0]
55
- @node_names = @name_args[1..-1]
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.1
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-03-25 00:00:00.000000000 Z
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