knife-push 1.0.1 → 1.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 038f57928247aec7d8738ba995ef7c55c0aad8df
4
- data.tar.gz: c4a210015c78ef8ffb3c744cf0a3e177c5e1ce39
3
+ metadata.gz: 10bd3739e9d8155db578d60947f5149d825c011c
4
+ data.tar.gz: d3d2037fe10e4ce7e31718a72256d9943a0445b7
5
5
  SHA512:
6
- metadata.gz: bab6b08e47fabe72250eb77e928c9ff8da38abb9000553c145c80ac8672d6cc3c6db847edc45f950f7a7c8fab9fe14ac61efedebed44a3cc9e65834adb4756f1
7
- data.tar.gz: d1312745ef63c28bca515568a0d1f19d246bc52ea10e8483c7e14ff1ac5e2361e941435f8040c16ad174227903303b69664a617f2e3ac162b0ffd2ae9f534622
6
+ metadata.gz: 0706958a8cad9e8426edb6049ced027b2ee04369bd1c625b7e57d5acc33adc9cf3ff87cbb9e4c8f2206d7e90bd46a6e8bee4cf03f93b3080e1878a5c9ce7fb57
7
+ data.tar.gz: 065e930d0d88fc8fe5df166aaea51d48a85805011bb5a14e3cfe2bcf1761cfdf6fd802c15edefdde747a25c067bc32e3bb7a0811ff24d017c612e95415fe9eee
@@ -0,0 +1,177 @@
1
+ # Knife Push
2
+
3
+ [![Gem Version](https://badge.fury.io/rb/knife-push.svg)](https://badge.fury.io/rb/knife-push) [![Build Status](https://travis-ci.org/chef/knife-push.svg?branch=master)](https://travis-ci.org/chef/knife-push)
4
+
5
+ The knife push plugin is used by the Chef workstation to interact with the Push API to start jobs, view job status, view job lists, and view node status.
6
+
7
+ ## Requirements
8
+
9
+ - Chef 12.0 higher
10
+ - Ruby 2.2.2 or higher
11
+
12
+ ## Installation:
13
+
14
+ To build and install the plugin, run:
15
+
16
+ ```shell
17
+ rake install
18
+ ```
19
+
20
+ ## Configuration:
21
+
22
+ If push server is running on the same host as the Chef Server, then no reconfiguration is required on the Chef workstation.
23
+
24
+ ## Subcommands:
25
+
26
+ This plugin provides the following Knife subcommands. Specific command options can be found by invoking the subcommand with a `--help` flag.
27
+
28
+ ### job list
29
+
30
+ The `job list` subcommand is used to view a list of Push jobs.
31
+
32
+ #### Syntax $ knife job list
33
+
34
+ ### job start
35
+
36
+ The `job start` subcommand is used to start a Push job.
37
+
38
+ #### Syntax
39
+
40
+ ```shell
41
+ knife job start (options) COMMAND [NODE, NODE, ...]
42
+ ```
43
+
44
+ #### Options
45
+
46
+ This argument has the following options:
47
+
48
+ `--timeout TIMEOUT`
49
+
50
+ The maximum amount of time (in seconds) by which a job must complete, before it will be stopped.
51
+
52
+ `-q QUORUM --quorum QUORUM`
53
+
54
+ The minimum number of nodes that match the search criteria, are available, and acknowledge the job request. This can be expressed as a percentage (e.g. 50%) or as an absolute number of nodes (e.g. 145). Default value: 100%
55
+
56
+ `-b --nowait`
57
+
58
+ Exit immediately after starting a job instead of waiting for it to complete.
59
+
60
+ `--with-env ENVIRONMENT`
61
+
62
+ Accept a json blob of environment variables and use those to set the variables for the client. For example '{"test": "foo"}' will set the push client environment variable "test" to "foo". (Push 2.0 and later)
63
+
64
+ `--in-dir DIR`
65
+
66
+ Execute the remote command in the directory DIR. (Push 2.0 and later)
67
+
68
+ `--file DATAFILE`
69
+
70
+ Send the file to the client. (Push 2.0 and later)
71
+
72
+ `--capture`
73
+
74
+ Capture stdin and stdout for this job. (Push 2.0 and later)
75
+
76
+ #### Examples
77
+
78
+ For example, to search for nodes assigned the role "webapp", and where 90% of those nodes must be available, enter:
79
+
80
+ ```shell
81
+ knife job start -quorum 90% 'chef-client' --search 'role:webapp'
82
+ ```
83
+
84
+ To search for a specific set of nodes (named chico, harpo, groucho, gummo, zeppo), and where 90% of those nodes must be available, enter:
85
+
86
+ ```shell
87
+ knife job start --quorum 90% 'chef-client' chico harpo groucho gummo zeppo
88
+ ```
89
+
90
+ Use the `knife job start` subcommand to run a job with the following syntax:
91
+
92
+ ```shell
93
+ knife job start job_name node_name
94
+ ```
95
+
96
+ For example, to run a job named add-glasses against a node named "ricardosalazar", enter the following:
97
+
98
+ ```shell
99
+ knife job start add-glasses 'ricardosalazar'
100
+ ```
101
+
102
+ ### job output
103
+
104
+ The `job output` command is used to view the output of Push jobs. (Push 2.0 and later). The output capture flag must have been set on job start; see the --capture option.
105
+
106
+ #### Syntax
107
+
108
+ ```shell
109
+ knife job output JOBID
110
+ ```
111
+
112
+ #### Examples
113
+
114
+ ```shell
115
+ knife job output 26e98ba162fa7ba6fb2793125553c7ae test --channel stdout
116
+ ```
117
+
118
+ #### Options
119
+
120
+ --channel [stderr|stdout]
121
+
122
+ The output channel to capture.
123
+
124
+ ### job status
125
+
126
+ The `job status` command is used to view the status of Push jobs.
127
+
128
+ #### Syntax
129
+
130
+ ```shell
131
+ knife job status JOBID
132
+ ```
133
+
134
+ #### Examples
135
+
136
+ For example, to view the status of a job that has the identifier of "235", enter:
137
+
138
+ ```shell
139
+ knife job status 235
140
+ ```
141
+
142
+ ### node status
143
+
144
+ The `node status` argument is used to identify nodes that Push may interact with.
145
+
146
+ #### Syntax
147
+
148
+ ```shell
149
+ knife node status
150
+ ```
151
+
152
+ ## Contributing
153
+
154
+ For information on contributing to this project see <https://github.com/chef/chef/blob/master/CONTRIBUTING.md>
155
+
156
+
157
+ ## License
158
+
159
+ **Author:** John Keiser([jkeiser@chef.io](mailto:jkeiser@chef.io))
160
+
161
+ **Copyright:** Copyright 2008-2016, Chef Software, Inc.
162
+
163
+ **License:** Apache License, Version 2.0
164
+
165
+ ```text
166
+ Licensed under the Apache License, Version 2.0 (the "License");
167
+ you may not use this file except in compliance with the License.
168
+ You may obtain a copy of the License at
169
+
170
+ http://www.apache.org/licenses/LICENSE-2.0
171
+
172
+ Unless required by applicable law or agreed to in writing, software
173
+ distributed under the License is distributed on an "AS IS" BASIS,
174
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
175
+ See the License for the specific language governing permissions and
176
+ limitations under the License.
177
+ ```
data/Rakefile CHANGED
@@ -1,7 +1,6 @@
1
- require 'bundler'
2
- require 'rubygems'
3
- require 'rspec/core/rake_task'
4
- require 'rdoc/task'
1
+ require "bundler"
2
+ require "rubygems"
3
+ require "rspec/core/rake_task"
5
4
 
6
5
  Bundler::GemHelper.install_tasks
7
6
 
@@ -9,14 +8,7 @@ task :default => :spec
9
8
 
10
9
  desc "Run specs"
11
10
  RSpec::Core::RakeTask.new(:spec) do |spec|
12
- spec.pattern = 'spec/**/*_spec.rb'
11
+ spec.pattern = "spec/**/*_spec.rb"
13
12
  end
14
13
 
15
14
  gem_spec = eval(File.read("knife-push.gemspec"))
16
-
17
- RDoc::Task.new do |rdoc|
18
- rdoc.rdoc_dir = 'rdoc'
19
- rdoc.title = "knife-push #{gem_spec.version}"
20
- rdoc.rdoc_files.include('README*')
21
- rdoc.rdoc_files.include('lib/**/*.rb')
22
- end
@@ -27,7 +27,7 @@ class Chef
27
27
  begin
28
28
  nodes = q.search(:node, escaped_query).first
29
29
  rescue Net::HTTPServerException => e
30
- msg Chef::JSONCompat.from_json(e.response.body)['error'].first
30
+ msg Chef::JSONCompat.from_json(e.response.body)["error"].first
31
31
  ui.error("knife search failed: #{msg}")
32
32
  exit 1
33
33
  end
@@ -45,21 +45,21 @@ class Chef
45
45
  end
46
46
 
47
47
  def status_string(job)
48
- case job['status']
49
- when 'new'
50
- [false, 'Initialized.']
51
- when 'voting'
52
- [false, job['status'].capitalize + '.']
48
+ case job["status"]
49
+ when "new"
50
+ [false, "Initialized."]
51
+ when "voting"
52
+ [false, job["status"].capitalize + "."]
53
53
  else
54
- total = job['nodes'].values.inject(0) { |sum,nodes| sum+nodes.length }
55
- in_progress = job['nodes'].keys.inject(0) { |sum,status|
56
- nodes = job['nodes'][status]
57
- sum + (%w(new voting running).include?(status) ? 1 : 0)
58
- }
59
- if job['status'] == 'running'
60
- [false, job['status'].capitalize + " (#{in_progress}/#{total} in progress) ..."]
54
+ total = job["nodes"].values.inject(0) { |sum, nodes| sum + nodes.length }
55
+ in_progress = job["nodes"].keys.inject(0) do |sum, status|
56
+ nodes = job["nodes"][status]
57
+ sum + (%w{new voting running}.include?(status) ? 1 : 0)
58
+ end
59
+ if job["status"] == "running"
60
+ [false, job["status"].capitalize + " (#{in_progress}/#{total} in progress) ..."]
61
61
  else
62
- [true, job['status'].capitalize + '.']
62
+ [true, job["status"].capitalize + "."]
63
63
  end
64
64
  end
65
65
  end
@@ -73,16 +73,16 @@ class Chef
73
73
 
74
74
  case qmatch[2]
75
75
  when "%" then
76
- ((num.to_f/100)*total_nodes).ceil
76
+ ((num.to_f / 100) * total_nodes).ceil
77
77
  else
78
78
  num.to_i
79
79
  end
80
80
  end
81
81
 
82
82
  def status_code(job)
83
- if job['status'] == "complete" && job["nodes"].keys.all? do |key|
84
- key == "succeeded" || key == "nacked" || key == "unavailable"
85
- end
83
+ if job["status"] == "complete" && job["nodes"].keys.all? do |key|
84
+ key == "succeeded" || key == "nacked" || key == "unavailable"
85
+ end
86
86
  0
87
87
  else
88
88
  1
@@ -90,11 +90,11 @@ class Chef
90
90
  end
91
91
 
92
92
  def run_helper(config, job_json)
93
- job_json['run_timeout'] ||= config[:run_timeout].to_i if config[:run_timeout]
93
+ job_json["run_timeout"] ||= config[:run_timeout].to_i if config[:run_timeout]
94
94
 
95
- result = rest.post_rest('pushy/jobs', job_json)
96
- job_uri = result['uri']
97
- puts "Started. Job ID: #{job_uri[-32,32]}"
95
+ result = rest.post_rest("pushy/jobs", job_json)
96
+ job_uri = result["uri"]
97
+ puts "Started. Job ID: #{job_uri[-32, 32]}"
98
98
  exit(0) if config[:nowait]
99
99
  previous_state = "Initialized."
100
100
  begin
@@ -133,7 +133,7 @@ class Chef
133
133
  begin
134
134
  env = config[:with_env] ? JSON.parse(config[:with_env]) : {}
135
135
  rescue Exception => e
136
- Chef::Log.info("Can't parse environment as JSON")
136
+ Chef::Log.info("Can't parse environment as JSON")
137
137
  end
138
138
  end
139
139
  end
@@ -27,4 +27,3 @@ class Chef
27
27
  end
28
28
  end
29
29
  end
30
-
@@ -21,8 +21,8 @@ class Chef
21
21
  banner "knife job output <job id> <node> [<node> ...]"
22
22
 
23
23
  option :channel,
24
- :long => '--channel stdout|stderr',
25
- :default => 'stdout',
24
+ :long => "--channel stdout|stderr",
25
+ :default => "stdout",
26
26
  :description => "Which output channel to fetch (default stdout)."
27
27
 
28
28
  def run
@@ -32,7 +32,7 @@ class Chef
32
32
 
33
33
  uri = "pushy/jobs/#{job_id}/output/#{node}/#{channel}"
34
34
 
35
- job = rest.get_rest(uri, false, {"Accept"=>"application/octet-stream"})
35
+ job = rest.get_rest(uri, { "Accept" => "application/octet-stream" })
36
36
 
37
37
  output(job)
38
38
  end
@@ -52,4 +52,3 @@ class Chef
52
52
  end
53
53
  end
54
54
  end
55
-
@@ -15,7 +15,7 @@
15
15
  # under the License.
16
16
  #
17
17
 
18
- require 'chef/knife/job_helpers'
18
+ require "chef/knife/job_helpers"
19
19
 
20
20
  class Chef
21
21
  class Knife
@@ -24,64 +24,64 @@ class Chef
24
24
  include JobHelpers
25
25
 
26
26
  deps do
27
- require 'chef/rest'
28
- require 'chef/node'
29
- require 'chef/search/query'
27
+ require "chef/rest"
28
+ require "chef/node"
29
+ require "chef/search/query"
30
30
  end
31
31
 
32
32
  banner "knife job start <command> [<node> <node> ...]"
33
33
 
34
34
  option :run_timeout,
35
- :long => '--timeout TIMEOUT',
35
+ :long => "--timeout TIMEOUT",
36
36
  :description => "Maximum time the job will be allowed to run (in seconds)."
37
37
 
38
38
  option :quorum,
39
- :short => '-q QUORUM',
40
- :long => '--quorum QUORUM',
41
- :default => '100%',
42
- :description => 'Pushy job quorum. Percentage (-q 50%) or Count (-q 145).'
39
+ :short => "-q QUORUM",
40
+ :long => "--quorum QUORUM",
41
+ :default => "100%",
42
+ :description => "Pushy job quorum. Percentage (-q 50%) or Count (-q 145)."
43
43
 
44
44
  option :search,
45
- :short => '-s QUERY',
46
- :long => '--search QUERY',
45
+ :short => "-s QUERY",
46
+ :long => "--search QUERY",
47
47
  :required => false,
48
- :description => 'Solr query for list of job candidates.'
48
+ :description => "Solr query for list of job candidates."
49
49
 
50
50
  option :send_file,
51
- :long => '--file FILE',
51
+ :long => "--file FILE",
52
52
  :default => nil,
53
- :description => 'File to send to job.'
53
+ :description => "File to send to job."
54
54
 
55
55
  option :capture_output,
56
- :long => '--capture',
56
+ :long => "--capture",
57
57
  :boolean => true,
58
58
  :default => false,
59
- :description => 'Capture job output.'
59
+ :description => "Capture job output."
60
60
 
61
61
  option :with_env,
62
62
  :long => "--with-env ENV",
63
63
  :default => nil,
64
- :description => 'JSON blob of environment variables to set.'
64
+ :description => "JSON blob of environment variables to set."
65
65
 
66
66
  option :as_user,
67
67
  :long => "--as-user USER",
68
68
  :default => nil,
69
- :description => 'User id to run as.'
69
+ :description => "User id to run as."
70
70
 
71
71
  option :in_dir,
72
72
  :long => "--in-dir DIR",
73
73
  :default => nil,
74
- :description => 'Directory to execute the command in.'
74
+ :description => "Directory to execute the command in."
75
75
 
76
76
  option :nowait,
77
- :long => '--nowait',
78
- :short => '-b',
77
+ :long => "--nowait",
78
+ :short => "-b",
79
79
  :boolean => true,
80
80
  :default => false,
81
81
  :description => "Rather than waiting for each job to complete, exit immediately after starting the job."
82
82
 
83
83
  option :poll_interval,
84
- :long => '--poll-interval RATE',
84
+ :long => "--poll-interval RATE",
85
85
  :default => 1.0,
86
86
  :description => "Repeat interval for job status update (in seconds)."
87
87
 
@@ -93,24 +93,24 @@ class Chef
93
93
  exit 1
94
94
  end
95
95
 
96
- @node_names = process_search(config[:search], name_args[1,@name_args.length-1])
96
+ @node_names = process_search(config[:search], name_args[1, @name_args.length - 1])
97
97
 
98
98
  job_json = {
99
- 'command' => job_name,
100
- 'nodes' => @node_names,
99
+ "command" => job_name,
100
+ "nodes" => @node_names,
101
101
  }
102
102
 
103
- job_json['quorum'] = get_quorum(config[:quorum], @node_names.length)
103
+ job_json["quorum"] = get_quorum(config[:quorum], @node_names.length)
104
104
 
105
105
  v2_json = job_json.dup
106
106
 
107
- v2_json['file'] = "raw:" + file_helper(config[:send_file]) if config[:send_file]
107
+ v2_json["file"] = "raw:" + file_helper(config[:send_file]) if config[:send_file]
108
108
 
109
- v2_json['capture_output'] = config[:capture_output]
109
+ v2_json["capture_output"] = config[:capture_output]
110
110
  env = get_env(config)
111
- v2_json['env'] = env if env
112
- v2_json['dir'] = config[:in_dir] if config[:in_dir]
113
- v2_json['user'] = config[:as_user] if config[:as_user]
111
+ v2_json["env"] = env if env
112
+ v2_json["dir"] = config[:in_dir] if config[:in_dir]
113
+ v2_json["user"] = config[:as_user] if config[:as_user]
114
114
 
115
115
  begin
116
116
  job = run_helper(config, v2_json)
@@ -126,7 +126,7 @@ class Chef
126
126
 
127
127
  %i{ send_file dir user }.each do |feature|
128
128
  if config[feature]
129
- ui.error "Can't use a 2.0 feature (#{feature.to_s}) with a 1.0 server"
129
+ ui.error "Can't use a 2.0 feature (#{feature}) with a 1.0 server"
130
130
  exit 1
131
131
  end
132
132
  end
@@ -137,7 +137,6 @@ class Chef
137
137
  output(job)
138
138
 
139
139
  exit(status_code(job))
140
-
141
140
  end
142
141
 
143
142
  private
@@ -27,4 +27,3 @@ class Chef
27
27
  end
28
28
  end
29
29
  end
30
-
@@ -28,13 +28,13 @@ class Chef
28
28
 
29
29
  private
30
30
 
31
- def get_node_statuses(name_args=[])
31
+ def get_node_statuses(name_args = [])
32
32
  if name_args.length == 0
33
33
  rest.get_rest("pushy/node_states")
34
34
  else
35
35
  results = []
36
36
  name_args.each do |arg|
37
- if arg.index(':')
37
+ if arg.index(":")
38
38
  search(:node, arg).each do |node|
39
39
  results << rest.get_rest("pushy/node_states/#{node.node_name}")
40
40
  end
@@ -49,5 +49,3 @@ class Chef
49
49
  end
50
50
  end
51
51
  end
52
-
53
-
@@ -1,7 +1,7 @@
1
1
 
2
2
  module Knife
3
3
  module Push
4
- VERSION = '1.0.1'
5
- MAJOR, MINOR, TINY = VERSION.split('.')
4
+ VERSION = "1.0.2"
5
+ MAJOR, MINOR, TINY = VERSION.split(".")
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-push
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-05 00:00:00.000000000 Z
11
+ date: 2016-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef
@@ -16,52 +16,24 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 11.10.4
19
+ version: 12.7.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 11.10.4
27
- - !ruby/object:Gem::Dependency
28
- name: rspec
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- description: Knife plugin for chef push
56
- email: jkeiser@opscode.com
26
+ version: 12.7.2
27
+ description: Knife plugin for Chef push
28
+ email: jkeiser@chef.io
57
29
  executables: []
58
30
  extensions: []
59
31
  extra_rdoc_files:
60
- - README.rdoc
32
+ - README.md
61
33
  - LICENSE
62
34
  files:
63
35
  - LICENSE
64
- - README.rdoc
36
+ - README.md
65
37
  - Rakefile
66
38
  - lib/chef/knife/job_helpers.rb
67
39
  - lib/chef/knife/job_list.rb
@@ -70,8 +42,9 @@ files:
70
42
  - lib/chef/knife/job_status.rb
71
43
  - lib/chef/knife/node_status.rb
72
44
  - lib/knife-push/version.rb
73
- homepage: http://www.chef.io
74
- licenses: []
45
+ homepage: https://www.chef.io
46
+ licenses:
47
+ - Apache-2.0
75
48
  metadata: {}
76
49
  post_install_message:
77
50
  rdoc_options: []
@@ -81,7 +54,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
54
  requirements:
82
55
  - - ">="
83
56
  - !ruby/object:Gem::Version
84
- version: '0'
57
+ version: 2.2.2
85
58
  required_rubygems_version: !ruby/object:Gem::Requirement
86
59
  requirements:
87
60
  - - ">="
@@ -89,8 +62,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
62
  version: '0'
90
63
  requirements: []
91
64
  rubyforge_project:
92
- rubygems_version: 2.4.5.1
65
+ rubygems_version: 2.5.1
93
66
  signing_key:
94
67
  specification_version: 4
95
- summary: Knife plugin for chef push
68
+ summary: Knife plugin for Chef push
96
69
  test_files: []
@@ -1,147 +0,0 @@
1
- = Knife Push
2
-
3
- = DESCRIPTION:
4
-
5
- The knife push plugin is used by the Chef workstation to interact with the Push API to start jobs, view job status, view job lists, and view node status.
6
-
7
- = INSTALLATION:
8
-
9
- To build and install the plugin, run:
10
-
11
- rake install
12
-
13
- = CONFIGURATION:
14
-
15
- If push server is running on the same host as the OPC, then no reconfiguration is required on the Chef workstation.
16
-
17
- = SUBCOMMANDS:
18
-
19
- This plugin provides the following Knife subcommands. Specific command options can be found by invoking the subcommand with a <tt>--help</tt> flag.
20
-
21
- == job list
22
-
23
- The <tt>job list</tt> subcommand is used to view a list of Push jobs.
24
-
25
- === Syntax
26
- $ knife job list
27
-
28
- == job start
29
-
30
- The <tt>job start</tt> subcommand is used to start a Push job.
31
-
32
- === Syntax
33
- $ knife job start (options) COMMAND [NODE, NODE, ...]
34
-
35
- === Options
36
- This argument has the following options:
37
-
38
- --timeout TIMEOUT
39
-
40
- The maximum amount of time (in seconds) by which a job must complete, before it will be stopped.
41
-
42
- -q QUORUM --quorum QUORUM
43
-
44
- The minimum number of nodes that match the search criteria, are available, and acknowledge the job request. This can be expressed as a
45
- percentage (e.g. 50%) or as an absolute number of nodes (e.g. 145). Default value: 100%
46
-
47
- -b --nowait
48
-
49
- Exit immediately after starting a job instead of waiting for it to complete.
50
-
51
- --with-env ENVIRONMENT
52
-
53
- Accept a json blob of environment variables and use those to set the
54
- variables for the client. For example '{"test": "foo"}' will set the
55
- push client environment variable "test" to "foo". (Push 2.0 and later)
56
-
57
- --in-dir DIR
58
-
59
- Execute the remote command in the directory DIR. (Push 2.0 and later)
60
-
61
- --file DATAFILE
62
-
63
- Send the file to the client. (Push 2.0 and later)
64
-
65
- --capture
66
-
67
- Capture stdin and stdout for this job. (Push 2.0 and later)
68
-
69
-
70
- === Examples
71
- For example, to search for nodes assigned the role “webapp”, and where 90% of those nodes must be available, enter:
72
-
73
- $ knife job start -quorum 90% 'chef-client' --search 'role:webapp'
74
-
75
- To search for a specific set of nodes (named chico, harpo, groucho, gummo, zeppo), and where 90% of those nodes must be available, enter:
76
-
77
- $ knife job start --quorum 90% 'chef-client' chico harpo groucho gummo zeppo
78
-
79
- Use the <tt>knife job start</tt> subcommand to run a job with the following syntax:
80
-
81
- $ knife job start job_name node_name
82
-
83
- For example, to run a job named add-glasses against a node named “ricardosalazar”, enter the following:
84
-
85
- $ knife job start add-glasses 'ricardosalazar'
86
-
87
- == job output
88
-
89
- The <tt>job output </tt> command is used to view the output of Push
90
- jobs. (Push 2.0 and later). The output capture flag must have been set
91
- on job start; see the --capture option.
92
-
93
- === Syntax
94
-
95
- $ knife job output JOBID
96
-
97
- === Examples
98
-
99
- $ knife job output 26e98ba162fa7ba6fb2793125553c7ae test --channel stdout
100
-
101
- === Options
102
-
103
- --channel [stderr|stdout]
104
-
105
- The output channel to capture.
106
-
107
-
108
- == job status
109
-
110
- The <tt>job status</tt> command is used to view the status of Push jobs.
111
-
112
- === Syntax
113
- $ knife job status JOBID
114
-
115
- === Examples
116
- For example, to view the status of a job that has the identifier of “235”, enter:
117
-
118
- $ knife job status 235
119
-
120
- == node status
121
-
122
- The <tt>node status</tt> argument is used to identify nodes that Push may interact with.
123
-
124
- === Syntax
125
- $ knife node status
126
-
127
-
128
-
129
-
130
- == License
131
-
132
- Push - The push jobs component for chef
133
-
134
- **Copyright:** Copyright (c) 2008-2014 Chef Software, Inc.
135
- **License:** Apache License, Version 2.0
136
-
137
- Licensed under the Apache License, Version 2.0 (the "License");
138
- you may not use this file except in compliance with the License.
139
- You may obtain a copy of the License at
140
-
141
- http://www.apache.org/licenses/LICENSE-2.0
142
-
143
- Unless required by applicable law or agreed to in writing, software
144
- distributed under the License is distributed on an "AS IS" BASIS,
145
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
146
- See the License for the specific language governing permissions and
147
- limitations under the License.