hazetug 0.1.2 → 0.1.3
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 +4 -4
- data/lib/hazetug/cli/bootstrap.rb +11 -6
- data/lib/hazetug/haze/linode.rb +2 -1
- data/lib/hazetug/task.rb +2 -2
- data/lib/hazetug/tug/knife.rb +13 -4
- data/lib/hazetug/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 723a5d37ca91b5fde0e80ec539e3d6a94c1acfdf
|
4
|
+
data.tar.gz: 8a73f894d14f9c9a91387e0cde7fa1027d7b5a57
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c3e424bc320a7c7d0fd03fc3ddb882e32b0b265ff682b5960a726c5c079f303d9afd9c67cb810ffe2ce82a8ccdbace8df7de95259c2a6bc2ab896a8cc62ca14
|
7
|
+
data.tar.gz: 7992188b72be3ea5a17224c443ba7ad71806b5736f37ab06c75d56af9c0b9f2749ee781f03c6a37be0287bbad179606d545d9ae86dfda64456c5fc503b7daf43
|
@@ -43,30 +43,35 @@ class Hazetug
|
|
43
43
|
|
44
44
|
def bootstrap_list(&block)
|
45
45
|
return if block.nil?
|
46
|
-
task.hosts_to_bootstrap(
|
47
|
-
|
46
|
+
task.hosts_to_bootstrap(command_variables) do |conf|
|
47
|
+
|
48
48
|
if convert_rand_name(conf[:name]) == conf[:name] && num > 1
|
49
49
|
ui.fatal "Can't bootstrap several hosts with the same name"
|
50
50
|
raise ArgumentError, "%rand(x)% expected"
|
51
51
|
end
|
52
|
+
|
53
|
+
num = conf[:number] || data[:opts][:number].to_i || 1
|
52
54
|
(1..num).each do
|
53
55
|
newconf = conf.dup
|
54
56
|
newconf[:name] = convert_rand_name(conf[:name])
|
57
|
+
|
55
58
|
haze = Hazetug::Haze[data[:compute_name]].new(newconf)
|
56
|
-
|
59
|
+
|
57
60
|
if haze.config[:ssh_password]
|
61
|
+
# Ensure a dynamic password loaded back from haze
|
58
62
|
newconf[:ssh_password] = haze.config[:ssh_password]
|
59
63
|
end
|
64
|
+
|
60
65
|
tug = Hazetug::Tug[data[:tug_name]].new(newconf, haze)
|
61
66
|
block.call(haze, tug)
|
62
67
|
end
|
63
68
|
end
|
64
69
|
end
|
65
70
|
|
66
|
-
def
|
67
|
-
@
|
71
|
+
def command_variables
|
72
|
+
@command_variables ||= begin
|
68
73
|
env = {}
|
69
|
-
arr = data[:opts][:
|
74
|
+
arr = data[:opts][:variables]
|
70
75
|
if arr
|
71
76
|
arr.each do |eq|
|
72
77
|
k, v = eq.split('=')
|
data/lib/hazetug/haze/linode.rb
CHANGED
@@ -19,7 +19,8 @@ class Hazetug
|
|
19
19
|
def create_server_args
|
20
20
|
latest = /^Latest #{config[:bits]} bit/
|
21
21
|
{
|
22
|
-
|
22
|
+
# linode node name can't contain dots
|
23
|
+
:name => config[:name].gsub(/./,'-'),
|
23
24
|
:data_center => lookup(:location),
|
24
25
|
:flavor => lookup(:flavor),
|
25
26
|
:image => lookup(:image),
|
data/lib/hazetug/task.rb
CHANGED
@@ -23,11 +23,11 @@ class Hazetug
|
|
23
23
|
@task[key]
|
24
24
|
end
|
25
25
|
|
26
|
-
def hosts_to_bootstrap(
|
26
|
+
def hosts_to_bootstrap(cmd_vars={}, &block)
|
27
27
|
return if block.nil?
|
28
28
|
base_conf = Mash.new(task)
|
29
29
|
hosts = base_conf.delete(:bootstrap)
|
30
|
-
base_conf = Chef::Mixin::DeepMerge.merge(base_conf,
|
30
|
+
base_conf = Chef::Mixin::DeepMerge.merge(base_conf, cmd_vars)
|
31
31
|
hosts.each do |conf|
|
32
32
|
merged = Chef::Mixin::DeepMerge.merge(base_conf, conf)
|
33
33
|
block.call(merged)
|
data/lib/hazetug/tug/knife.rb
CHANGED
@@ -48,7 +48,9 @@ class Hazetug
|
|
48
48
|
end
|
49
49
|
kb.name_args = [haze.server.ssh_ip_address]
|
50
50
|
kb.run
|
51
|
-
|
51
|
+
rescue Hazetug::Exception => e
|
52
|
+
ui.error(e.message); 1
|
53
|
+
ensure
|
52
54
|
@kb and @kb.ui.stdout.close
|
53
55
|
end
|
54
56
|
|
@@ -65,10 +67,17 @@ class Hazetug
|
|
65
67
|
|
66
68
|
def bootstrap_options
|
67
69
|
@bootstrap_options ||= begin
|
68
|
-
template = options[:opts][:bootstrap]
|
70
|
+
template = options[:opts][:bootstrap] || 'bootstrap.erb'
|
71
|
+
validation = config[:chef_validation_key] || 'validation.pem'
|
72
|
+
|
73
|
+
files = [template, validation].map {|f| File.expand_path(f)}
|
74
|
+
notfound = files.select {|f| !File.exist?(f)}
|
75
|
+
notfound.empty? or
|
76
|
+
raise Hazetug::Exception, "File(s) not found: #{notfound.join(', ')}"
|
77
|
+
|
69
78
|
opts = {}
|
70
|
-
opts[:validation_key] = File.expand_path(
|
71
|
-
opts[:template_file] = File.expand_path(template
|
79
|
+
opts[:validation_key] = File.expand_path(validation)
|
80
|
+
opts[:template_file] = File.expand_path(template)
|
72
81
|
opts[:ssh_user] = config[:ssh_user] || 'root'
|
73
82
|
opts[:ssh_password] = config[:ssh_password]
|
74
83
|
opts[:environment] = config[:chef_environment]
|
data/lib/hazetug/version.rb
CHANGED