knife-zero 1.9.2 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/chef/knife/zero_converge.rb +13 -0
- data/lib/knife-zero/bootstrap_ssh.rb +5 -0
- data/lib/knife-zero/helper.rb +15 -0
- data/lib/knife-zero/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f80ea294ea06067b3b8d8983f72592203be44e7
|
4
|
+
data.tar.gz: 77129a118ff5d6b8b803693d2c2cbd476e2ce3e9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b34d72aef351bba43aeb8dc8ac013aa6d7982b5d2017f106797826d50688c05d84b6afc499155005eb41a3f7f4ee9f0d457d0b1d5da746b1c045aca8eb4c4bb0
|
7
|
+
data.tar.gz: 8a002267e5bd8ecc761e32fc24399a5c0beb9721f4f33d96e77d3246695f095bce1685122c5672e0f1f12f50b05f509cbb49361115071573dce5dc8df798f77b
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'chef/knife'
|
2
2
|
require 'chef/knife/zero_base'
|
3
3
|
require 'knife-zero/bootstrap_ssh'
|
4
|
+
require 'knife-zero/helper'
|
4
5
|
|
5
6
|
class Chef
|
6
7
|
class Knife
|
@@ -33,6 +34,18 @@ class Chef
|
|
33
34
|
:default => nil,
|
34
35
|
:proc => lambda { |o| o.to_s }
|
35
36
|
|
37
|
+
option :client_version,
|
38
|
+
:long => "--client-version [latest|VERSION]",
|
39
|
+
:description => "Up or downgrade omnibus chef-client before converge.",
|
40
|
+
:default => nil,
|
41
|
+
:proc => lambda { |o|
|
42
|
+
if ::Knife::Zero::Helper.chef_version_available?(o)
|
43
|
+
o.to_s
|
44
|
+
else
|
45
|
+
ui.error "Client version #{o} is not found."
|
46
|
+
exit 1
|
47
|
+
end
|
48
|
+
}
|
36
49
|
|
37
50
|
def initialize(argv=[])
|
38
51
|
super
|
@@ -11,6 +11,11 @@ class Chef
|
|
11
11
|
|
12
12
|
def ssh_command(command, subsession=nil)
|
13
13
|
begin
|
14
|
+
|
15
|
+
if config[:client_version]
|
16
|
+
super(%Q{/opt/chef/embedded/bin/ruby -ropen-uri -e 'puts open("https://chef.sh").read' | sudo sh -s -- -v #{config[:client_version]}})
|
17
|
+
end
|
18
|
+
|
14
19
|
chef_zero_port = config[:chef_zero_port] ||
|
15
20
|
Chef::Config[:knife][:chef_zero_port] ||
|
16
21
|
URI.parse(Chef::Config.chef_server_url).port
|
data/lib/knife-zero/helper.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'open-uri'
|
2
|
+
|
1
3
|
module Knife
|
2
4
|
module Zero
|
3
5
|
module Helper
|
@@ -8,6 +10,19 @@ module Knife
|
|
8
10
|
8889
|
9
11
|
chef_zero_port + 10000
|
10
12
|
end
|
13
|
+
|
14
|
+
def self.chef_version_available?(version)
|
15
|
+
return true if version == 'latest'
|
16
|
+
chefgem_metaurl = 'https://rubygems.org/api/v1/versions/chef.json'
|
17
|
+
begin
|
18
|
+
c_versions = JSON.parse(open(chefgem_metaurl).read).map {|v| v['number']}
|
19
|
+
c_versions.include?(version)
|
20
|
+
rescue => e
|
21
|
+
puts e.inspect
|
22
|
+
puts "Some Error occurerd while fetching versions from #{chefgem_metaurl}. Please try again later."
|
23
|
+
exit
|
24
|
+
end
|
25
|
+
end
|
11
26
|
end
|
12
27
|
end
|
13
28
|
end
|
data/lib/knife-zero/version.rb
CHANGED
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.
|
4
|
+
version: 1.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sawanoboly
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|