summaryrefslogtreecommitdiff
path: root/chef/lib/chef
diff options
context:
space:
mode:
authorDaniel DeLeo <dan@opscode.com>2010-10-07 17:01:46 -0700
committerDaniel DeLeo <dan@opscode.com>2010-10-07 17:01:46 -0700
commitef86c4b7a2fe63a30f6b7859ef509daf041226f3 (patch)
treea7ba4c036e0f0fefbaa68e1cc855fa069721a86f /chef/lib/chef
parent6b8093e07d352e2085504d5fdf281603cbc0ab39 (diff)
downloadchef-ef86c4b7a2fe63a30f6b7859ef509daf041226f3.tar.gz
[CHEF-1746] allow the client to loop when running in foreground
also, provide the --once option to force it to run once and exit with no splay and no run interval
Diffstat (limited to 'chef/lib/chef')
-rw-r--r--chef/lib/chef/application/client.rb9
1 files changed, 8 insertions, 1 deletions
diff --git a/chef/lib/chef/application/client.rb b/chef/lib/chef/application/client.rb
index a20eff84d9..4d8addd9af 100644
--- a/chef/lib/chef/application/client.rb
+++ b/chef/lib/chef/application/client.rb
@@ -89,6 +89,11 @@ class Chef::Application::Client < Chef::Application
:description => "Run chef-client periodically, in seconds",
:proc => lambda { |s| s.to_i }
+ option :once,
+ :long => "--short",
+ :description => "Cancel any interval or splay options, run chef once and exit",
+ :boolean => true
+
option :json_attribs,
:short => "-j JSON_ATTRIBS",
:long => "--json-attributes JSON_ATTRIBS",
@@ -149,7 +154,9 @@ class Chef::Application::Client < Chef::Application
if Chef::Config[:daemonize]
Chef::Config[:interval] ||= 1800
- else
+ end
+
+ if Chef::Config[:once]
Chef::Config[:interval] = nil
Chef::Config[:splay] = nil
end