knife-solo 0.0.13 → 0.0.14
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.
- data/lib/chef/knife/cook.rb +29 -11
- data/lib/chef/knife/prepare.rb +8 -0
- data/lib/knife-solo/bootstraps.rb +7 -6
- data/lib/knife-solo/info.rb +1 -1
- data/lib/knife-solo/kitchen_command.rb +1 -1
- metadata +4 -4
data/lib/chef/knife/cook.rb
CHANGED
@@ -45,15 +45,17 @@ class Chef
|
|
45
45
|
:description => "Only run syntax checks - do not run Chef"
|
46
46
|
|
47
47
|
def run
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
48
|
+
time('Run') do
|
49
|
+
validate_params!
|
50
|
+
super
|
51
|
+
check_syntax unless config[:skip_syntax_check]
|
52
|
+
return if config[:syntax_check_only]
|
53
|
+
Chef::Config.from_file('solo.rb')
|
54
|
+
check_chef_version unless config[:skip_chef_check]
|
55
|
+
rsync_kitchen
|
56
|
+
add_patches
|
57
|
+
cook unless config[:sync_only]
|
58
|
+
end
|
57
59
|
end
|
58
60
|
|
59
61
|
def check_syntax
|
@@ -101,18 +103,34 @@ class Chef
|
|
101
103
|
(%w{revision-deploys tmp '.*'} + chefignore.ignores).uniq
|
102
104
|
end
|
103
105
|
|
106
|
+
# Time a command
|
107
|
+
def time(msg)
|
108
|
+
return yield if config[:verbosity] == 0
|
109
|
+
puts "Starting #{msg}"
|
110
|
+
start = Time.now
|
111
|
+
yield
|
112
|
+
puts "#{msg} finished in #{Time.now - start} seconds"
|
113
|
+
end
|
114
|
+
|
104
115
|
def rsync_kitchen
|
105
|
-
|
116
|
+
time('Rsync kitchen') do
|
117
|
+
cmd = %Q{rsync -rl --rsh="ssh #{ssh_args}" --delete #{rsync_exclude.collect{ |ignore| "--exclude #{ignore} " }.join} ./ :#{adjust_rsync_path(chef_path)}}
|
118
|
+
puts cmd unless config[:verbosity] == 0
|
119
|
+
system! cmd
|
120
|
+
end
|
106
121
|
end
|
107
122
|
|
108
123
|
def add_patches
|
109
124
|
run_portable_mkdir_p(patch_path)
|
110
125
|
Dir[Pathname.new(__FILE__).dirname.join("patches", "*.rb")].each do |patch|
|
111
|
-
|
126
|
+
time(patch) do
|
127
|
+
system! %Q{rsync -rl --rsh="ssh #{ssh_args}" #{patch} :#{adjust_rsync_path(patch_path)}}
|
128
|
+
end
|
112
129
|
end
|
113
130
|
end
|
114
131
|
|
115
132
|
def check_chef_version
|
133
|
+
ui.msg('Checking Chef version')
|
116
134
|
result = run_command <<-BASH
|
117
135
|
export PATH="#{OMNIBUS_EMBEDDED_PATHS.join(":")}:$PATH"
|
118
136
|
ruby -rubygems -e "gem 'chef', '#{CHEF_VERSION_CONSTRAINT}'"
|
data/lib/chef/knife/prepare.rb
CHANGED
@@ -22,6 +22,14 @@ class Chef
|
|
22
22
|
:long => "--omnibus-version VERSION",
|
23
23
|
:description => "The version of Omnibus to install"
|
24
24
|
|
25
|
+
option :omnibus_url,
|
26
|
+
:long => "--omnibus-url URL",
|
27
|
+
:description => "URL to download install.sh from"
|
28
|
+
|
29
|
+
option :omnibus_options,
|
30
|
+
:long => "--omnibus-options \"-r -n\"",
|
31
|
+
:description => "Pass options to the install.sh script"
|
32
|
+
|
25
33
|
def run
|
26
34
|
validate_params!
|
27
35
|
super
|
@@ -55,8 +55,7 @@ module KnifeSolo
|
|
55
55
|
raise "implement gem packages for #{self.class.name}"
|
56
56
|
end
|
57
57
|
|
58
|
-
def http_client_get_url(url)
|
59
|
-
file = File.basename(url)
|
58
|
+
def http_client_get_url(url, file)
|
60
59
|
stream_command <<-BASH
|
61
60
|
if which curl 2>/dev/null; then
|
62
61
|
curl -L -o #{file} #{url}
|
@@ -67,12 +66,14 @@ module KnifeSolo
|
|
67
66
|
end
|
68
67
|
|
69
68
|
def omnibus_install
|
70
|
-
|
71
|
-
|
69
|
+
url = prepare.config[:omnibus_url] || "http://opscode.com/chef/install.sh"
|
70
|
+
file = File.basename(url)
|
71
|
+
http_client_get_url(url, file)
|
72
72
|
# `release_version` within install.sh will be installed if
|
73
73
|
# `omnibus_version` is not provided.
|
74
|
-
install_command = "sudo bash
|
74
|
+
install_command = "sudo bash #{file}"
|
75
75
|
install_command << " -v #{prepare.config[:omnibus_version]}" if prepare.config[:omnibus_version]
|
76
|
+
install_command << " #{prepare.config[:options]}" if prepare.config[:options]
|
76
77
|
|
77
78
|
stream_command(install_command)
|
78
79
|
end
|
@@ -91,7 +92,7 @@ module KnifeSolo
|
|
91
92
|
release = "rubygems-1.8.10"
|
92
93
|
file = "#{release}.tgz"
|
93
94
|
url = "http://production.cf.rubygems.org/rubygems/#{file}"
|
94
|
-
http_client_get_url(url)
|
95
|
+
http_client_get_url(url, file)
|
95
96
|
run_command("tar zxf #{file}")
|
96
97
|
run_command("cd #{release} && sudo ruby setup.rb --no-format-executable")
|
97
98
|
run_command("sudo rm -rf #{release} #{file}")
|
data/lib/knife-solo/info.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: knife-solo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.14
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-22 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -133,7 +133,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
segments:
|
135
135
|
- 0
|
136
|
-
hash:
|
136
|
+
hash: 3414347062334937427
|
137
137
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
138
|
none: false
|
139
139
|
requirements:
|
@@ -142,7 +142,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
142
142
|
version: '0'
|
143
143
|
segments:
|
144
144
|
- 0
|
145
|
-
hash:
|
145
|
+
hash: 3414347062334937427
|
146
146
|
requirements: []
|
147
147
|
rubyforge_project: nowarning
|
148
148
|
rubygems_version: 1.8.24
|