knife-topo 0.0.6 → 0.0.7

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.
data/README.md CHANGED
@@ -22,8 +22,8 @@ topologies but differences in their configuration details.
22
22
  [Download the latest knife-topo release](http://github.com/christinedraper/knife-topo/releases/latest),
23
23
  unzip and copy `lib/chef/knife` into your plugin directory, e.g.:
24
24
 
25
- $ unzip knife-topo-0.0.6.zip -d ~
26
- $ cd ~/knife-topo-0.0.6
25
+ $ unzip knife-topo-0.0.7.zip -d ~
26
+ $ cd ~/knife-topo-0.0.7
27
27
  $ mkdir -p ~/.chef/plugins/knife
28
28
  $ cp lib/chef/knife/* ~/.chef/plugins/knife
29
29
 
@@ -54,8 +54,7 @@ need to update software versions), import those changes and run one command
54
54
 
55
55
  Try out this plugin using a [test-repo](test-repo) provided in the knife-topo github repository.
56
56
  [Download the latest knife-topo release](http://github.com/christinedraper/knife-topo/releases/latest)
57
- and unzip it, then follow the [Instructions](test-repo/Instructions.md) for a
58
- demo script, explanation, and troubleshooting.
57
+ and unzip it, then follow the [Instructions](test-repo/Instructions.md) for the example.
59
58
 
60
59
  The instructions assume you have [chefDK](http://www.getchef.com/downloads/chef-dk/)
61
60
  or equivalent installed and working with Vagrant and VirtualBox, but
@@ -1,5 +1,5 @@
1
1
  module Knife
2
2
  module Topo
3
- VERSION = "0.0.6"
3
+ VERSION = "0.0.7"
4
4
  end
5
5
  end
@@ -65,7 +65,7 @@ class Chef
65
65
  end
66
66
 
67
67
  # Run cookbook upload command on the topology cookbooks
68
- if topo['cookbook_attributes'].length > 0
68
+ if topo['cookbook_attributes'] && topo['cookbook_attributes'].length > 0
69
69
  argPos = 2
70
70
  topo['cookbook_attributes'].each do |entry|
71
71
  @topo_upload_args[argPos] = entry['cookbook']
@@ -73,7 +73,7 @@ class Chef
73
73
  end
74
74
  run_cmd(Chef::Knife::CookbookUpload, @topo_upload_args)
75
75
  else
76
- ui.info("No cookbooks found for topology #{topo_name}.")
76
+ ui.info("No cookbooks found for topology #{topo_name}")
77
77
  end
78
78
  end
79
79
 
@@ -97,7 +97,7 @@ class Chef
97
97
  nodes = merge_topo_properties(topo_hash['nodes'], topo_hash)
98
98
  config[:disable_editing] = true
99
99
 
100
- if nodes.length > 0
100
+ if nodes && nodes.length > 0
101
101
  nodes.each do |updates|
102
102
  node_name = updates['name']
103
103
  node = update_node(updates)
@@ -105,7 +105,7 @@ class Chef
105
105
  # if bootstrap is specified, run the bootstrap command
106
106
  run_cmd(Chef::Knife::TopoBootstrap, @topo_bootstrap_args) if config[:bootstrap]
107
107
  else
108
- ui.info "No nodes found for topology #{topo_hash.name}"
108
+ ui.info "No nodes found for topology #{topo_hash['name']}"
109
109
  end
110
110
 
111
111
  ui.info("Topology created")
@@ -63,6 +63,11 @@ class Chef
63
63
 
64
64
  topo_name = topo_data['name'] || topo_data['id']
65
65
  topo_data['id'] ||= topo_name
66
+
67
+ if (!topo_name)
68
+ ui.error "Could not find a topology name - #{topo_file} does not appear to be a valid topology JSON file"
69
+ exit(1)
70
+ end
66
71
 
67
72
  # check against specific topology list
68
73
  if topo_names
@@ -110,14 +110,14 @@ class Chef
110
110
  nodes = merge_topo_properties(topo_hash['nodes'], topo_hash)
111
111
  config[:disable_editing] = true
112
112
 
113
- if nodes.length > 0
113
+ if nodes && nodes.length > 0
114
114
  nodes.each do |updates|
115
115
  node_name = updates['name']
116
116
  node = update_node(updates)
117
117
  ui.info "Node #{node_name} does not exist - skipping update" if (!node)
118
118
  end
119
119
  else
120
- ui.info "No nodes found for topology #{topo_hash.name}"
120
+ ui.info "No nodes found for topology #{topo_hash['name']}"
121
121
  end
122
122
  end
123
123
 
@@ -99,7 +99,7 @@ class Chef
99
99
  def merge_topo_properties(nodes, topo_hash)
100
100
 
101
101
  if nodes && nodes.length > 0
102
- merged_nodes = nodes ? nodes.clone : {}
102
+ merged_nodes = nodes ? nodes.clone : []
103
103
  merged_nodes.each do |nodeprops|
104
104
 
105
105
  normal_defaults = topo_hash['normal'] ? topo_hash['normal'].clone : {}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-topo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-07-22 00:00:00.000000000 Z
12
+ date: 2014-08-03 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Knife plugin that to manage topologies of nodes
15
15
  email: