knife-dsl 0.0.1 → 0.0.2

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
@@ -57,11 +57,13 @@ require 'pp'
57
57
  require 'json'
58
58
 
59
59
  task :list_nodes do
60
- knife :node_list
60
+ status = knife :node_list
61
+ fail if status > 0
61
62
  end
62
63
 
63
64
  task :show_node, :node_name do |task_name, args|
64
- stdout, stderr = knife_capture :node_show, [args[:node_name], '-F', 'j']
65
+ stdout, stderr, status = knife_capture :node_show, [args[:node_name], '-F', 'j']
66
+ fail if status > 0
65
67
  pp JSON.load(stdout)
66
68
  end
67
69
  ```
@@ -17,6 +17,9 @@ module Chef::Knife::DSL
17
17
 
18
18
  opts = Chef::Application::Knife.new.options
19
19
  Chef::Knife.run(command, opts)
20
+ return 0
21
+ rescue SystemExit => e
22
+ return e.status
20
23
  end
21
24
  end
22
25
 
@@ -36,8 +39,8 @@ module Chef::Knife::DSL
36
39
  Object.const_set("STDIN", input ? StringIO.new(input, 'r') : null)
37
40
  $VERBOSE = warn
38
41
 
39
- Chef::Knife::DSL::Support.run_knife(command, args)
40
- return STDOUT.string, STDERR.string
42
+ status = Chef::Knife::DSL::Support.run_knife(command, args)
43
+ return STDOUT.string, STDERR.string, status
41
44
  ensure
42
45
  warn = $VERBOSE
43
46
  $VERBOSE = nil
@@ -1,7 +1,7 @@
1
1
  class Chef
2
2
  class Knife
3
3
  module DSL
4
- VERSION = "0.0.1"
4
+ VERSION = "0.0.2"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-dsl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
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: 2012-11-07 00:00:00.000000000 Z
12
+ date: 2012-11-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: chef