Skip to content

Commit

Permalink
Merge branch 'feature_override_runlist'
Browse files Browse the repository at this point in the history
  • Loading branch information
sawanoboly committed Dec 18, 2014
2 parents 2048cfb + b08a176 commit 50a0c7b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog of knife-zero

## v1.0.1

- Feature: Support override run-list for zero chef_client.

## v1.0.0

- Code cleanup: use Chef::Knife::SSH framework. HT: @Yasushi
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,10 @@ xxx.xxx.xxx.xxx 08:41:37 up 143 days, 2:32, 4 users, load average: 0.00, 0.0
Search nodes from local chef-repo directory, and run command at remote node.

Supported options are mostly the same as `knife ssh`.
And it supports why-run(`-W, --why-run`).
And it supports below.

- why-run(`-W, --why-run`)
- Override run-list(`-o RunlistItem,RunlistItem, --override-runlist`). It skips save node.json on workstation.

#### Example

Expand Down
10 changes: 10 additions & 0 deletions lib/chef/knife/chef_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ class Knife
class ZeroChefClient < Chef::Knife::BootstrapSsh
include Chef::Knife::ZeroBase
deps do
require 'chef/run_list/run_list_item'
Chef::Knife::BootstrapSsh.load_deps
end

Expand All @@ -30,6 +31,14 @@ class ZeroChefClient < Chef::Knife::BootstrapSsh
:description => "execute the chef-client via sudo",
:boolean => true

option :override_runlist,
:short => "-o RunlistItem,RunlistItem...",
:long => "--override-runlist RunlistItem,RunlistItem...",
:description => "Replace current run list with specified items for a single run. It skips save node.json on local",
:default => nil,
:proc => lambda { |o| o.to_s }


def initialize(argv=[])
super
@name_args = [@name_args[0], start_chef_client]
Expand All @@ -41,6 +50,7 @@ def start_chef_client
s = "#{client_path}"
s << ' -l debug' if @config[:verbosity] and @config[:verbosity] >= 2
s << " -S http://127.0.0.1:8889"
s << " -o #{@config[:override_runlist]}" if @config[:override_runlist]
s << " -W" if @config[:why_run]
s
end
Expand Down
2 changes: 1 addition & 1 deletion lib/knife-zero/version.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module Knife
module Zero
VERSION = "1.0.0"
VERSION = "1.0.1"
MAJOR, MINOR, TINY = VERSION.split('.')
end
end

0 comments on commit 50a0c7b

Please sign in to comment.