knife-zero 1.11.1 → 1.12.0.rc1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: acd069912d8b815db4d447a3d19dc88af0d6bdcc
4
- data.tar.gz: 455e737d9d4554952467e27d9bbc746fbdece401
3
+ metadata.gz: c640b8403785ff85ed323af235521b984e2487d1
4
+ data.tar.gz: 129585a3b31aa6c0733cc12679187732e5e0cef4
5
5
  SHA512:
6
- metadata.gz: 11a07ff246595ed09b7888e9dd00005c33c491f83bd79429803554afeaff1e295d8aff5ac5434dcb3ef353f55187495642e1fb4ada68b802856324e98119780c
7
- data.tar.gz: e3279e6fb9437b96eb9238f749e2ce6edab7a0c49917794ecb6c2ad63ffd9da61a87b90983560cadc466a4b46fae45527bdd27abba45065b5825e4662826b975
6
+ metadata.gz: cd82c47ede1ffe8805d70ac20674407d2b7401d2f7a8ea1efe41aedd44fed444e9b4823ac459985b7f133db12c7a2240c56c8d9519f61d6121c5ce1e90e0516e
7
+ data.tar.gz: c67a894054dedd240f30beaaeeb6bc75bcefb64aca59319da644cda0e71508e3e94105e68ccf1a8e3d4a244b200bbedb66806ae45453d0653742d2fdb9928588
data/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## v1.12.0
6
+
7
+ - Feature: New subcommand `zero apply`
8
+
5
9
  ## v1.11.1
6
10
 
7
11
  - Feature: add before_hook
data/README.md CHANGED
@@ -32,6 +32,7 @@ Relocated: [Installation | Knife-Zero Document](http://knife-zero.github.io/10_i
32
32
 
33
33
  ```
34
34
  ** ZERO COMMANDS **
35
+ knife zero apply QUERY (options)
35
36
  knife zero bootstrap [SSH_USER@]FQDN (options)
36
37
  knife zero chef_client QUERY (options) | It's same as converge
37
38
  knife zero converge QUERY (options)
@@ -0,0 +1,64 @@
1
+ require 'chef/knife'
2
+ require 'chef/knife/zero_base'
3
+ require 'chef/knife/zero_converge'
4
+ require 'knife-zero/bootstrap_ssh'
5
+ require 'knife-zero/helper'
6
+ require 'shellwords'
7
+
8
+ class Chef
9
+ class Knife
10
+ class ZeroApply < Chef::Knife::BootstrapSsh
11
+ include Chef::Knife::ZeroBase
12
+ deps do
13
+ Chef::Knife::BootstrapSsh.load_deps
14
+ Chef::Knife::ZeroConverge.load_deps
15
+ require "knife-zero/helper"
16
+ end
17
+
18
+ banner "knife zero apply QUERY (options)"
19
+
20
+ self.options = Ssh.options.merge(self.options)
21
+ self.options = ZeroConverge.options.merge(self.options)
22
+ self.options[:use_sudo_password] = Bootstrap.options[:use_sudo_password]
23
+
24
+ option :recipe,
25
+ :short => "-r Recipe String or @filename",
26
+ :long => "--recipe Recipe String or @filename",
27
+ :description => "Recipe for execute by chef-apply",
28
+ :default => "",
29
+ :proc => lambda { |o| o.start_with?('@') ? File.read(o[1..-1]).shellescape : (o.to_s).shellescape }
30
+
31
+ option :minimal_ohai,
32
+ :long => "--[no-]minimal-ohai",
33
+ :description => "Only run the bare minimum ohai plugins chef needs to function (false by default)",
34
+ :boolean => true,
35
+ :default => false,
36
+ :proc => lambda { |o| o.to_s }
37
+
38
+ def initialize(argv=[])
39
+ super
40
+ self.configure_chef
41
+
42
+ @name_args = [@name_args[0], start_chef_appy]
43
+ end
44
+
45
+ def start_chef_appy
46
+ if @config[:verbosity] and @config[:verbosity] >= 2
47
+ log_level = 'debug'
48
+ else
49
+ log_level = 'info'
50
+ end
51
+
52
+ client_path = @config[:use_sudo] || Chef::Config[:knife][:use_sudo] ? 'sudo ' : ''
53
+ client_path = @config[:chef_client_path] ? "#{client_path}#{@config[:chef_client_path]}" : "#{client_path}chef-apply"
54
+ s = String.new("echo #{@config[:recipe]} | #{client_path}")
55
+ s << " -l #{log_level}"
56
+ s << " -s"
57
+ s << " --minimal-ohai" if @config[:minimal_ohai]
58
+ s << " -W" if @config[:why_run]
59
+ Chef::Log.info "Remote command: " + s
60
+ s
61
+ end
62
+ end
63
+ end
64
+ end
@@ -1,6 +1,6 @@
1
1
  module Knife
2
2
  module Zero
3
- VERSION = "1.11.1"
3
+ VERSION = "1.12.0.rc1"
4
4
  MAJOR, MINOR, TINY = VERSION.split('.')
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-zero
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.11.1
4
+ version: 1.12.0.rc1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sawanoboly
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-01-01 00:00:00.000000000 Z
11
+ date: 2016-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -161,6 +161,7 @@ files:
161
161
  - CHANGELOG.md
162
162
  - README.md
163
163
  - knife-zero.gemspec
164
+ - lib/chef/knife/zero_apply.rb
164
165
  - lib/chef/knife/zero_base.rb
165
166
  - lib/chef/knife/zero_bootstrap.rb
166
167
  - lib/chef/knife/zero_chef_client.rb
@@ -186,9 +187,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
186
187
  version: '0'
187
188
  required_rubygems_version: !ruby/object:Gem::Requirement
188
189
  requirements:
189
- - - ">="
190
+ - - ">"
190
191
  - !ruby/object:Gem::Version
191
- version: '0'
192
+ version: 1.3.1
192
193
  requirements: []
193
194
  rubyforge_project:
194
195
  rubygems_version: 2.4.8