rudy 0.9.8.015 → 0.9.8.016
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/CHANGES.txt +19 -12
- data/Rudyfile +7 -0
- data/lib/rudy.rb +1 -1
- data/lib/rudy/cli/machines.rb +4 -4
- data/lib/rudy/config.rb +3 -3
- data/lib/rudy/huxtable.rb +24 -10
- data/lib/rudy/routines/handlers/host.rb +1 -2
- data/lib/rudy/routines/handlers/keypair.rb +16 -8
- data/lib/rudy/routines/handlers/rye.rb +3 -2
- data/lib/rudy/routines/shutdown.rb +1 -1
- data/rudy.gemspec +1 -1
- metadata +4 -4
data/CHANGES.txt
CHANGED
|
@@ -1,16 +1,25 @@
|
|
|
1
1
|
RUDY, CHANGES
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
* TODO: http://github.com/solutious/rudy/issues/#issue/43
|
|
5
|
-
* TODO: Warning in latest Ruby 1.9.1: httpclient/http.rb:367: warning: variable $KCODE
|
|
6
|
-
* rudy create-disks
|
|
7
|
-
Executing routine: create-disks
|
|
8
|
-
disks:
|
|
9
|
-
Timeout (30): execution expired!
|
|
10
|
-
Creating volume...
|
|
11
|
-
NameError: uninitialized constant Rudy::Metadata::UnknownObject
|
|
12
|
-
(S)kip (A)bort:
|
|
3
|
+
#### 0.9.8.016 (2010-10-26) #######################
|
|
13
4
|
|
|
5
|
+
NOTE: If you're using Ubuntu you'll need to update your
|
|
6
|
+
configuration to use this release.
|
|
7
|
+
|
|
8
|
+
* ADDED: new config parameter: 'root'. In previous releases
|
|
9
|
+
Rudy used the default user to determine which account to use
|
|
10
|
+
when launching new instances with EC2. With this release,
|
|
11
|
+
you now need to use "root". Either in the defaults config or
|
|
12
|
+
the machines config for you ubuntu instances:
|
|
13
|
+
|
|
14
|
+
defaults do
|
|
15
|
+
root "ubuntu"
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
machines do
|
|
19
|
+
role :ubuntu
|
|
20
|
+
root "ubuntu"
|
|
21
|
+
end
|
|
22
|
+
end
|
|
14
23
|
|
|
15
24
|
|
|
16
25
|
#### 0.9.8.015 (2010-10-25) #######################
|
|
@@ -482,5 +491,3 @@ NOTE: This is a complete re-write from 0.1
|
|
|
482
491
|
|
|
483
492
|
* Initial public release
|
|
484
493
|
|
|
485
|
-
|
|
486
|
-
|
data/Rudyfile
CHANGED
|
@@ -72,6 +72,12 @@ machines do
|
|
|
72
72
|
#end
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
+
role :ubuntu do
|
|
76
|
+
ami 'ami-1a837773'
|
|
77
|
+
root 'ubuntu'
|
|
78
|
+
user 'ubuntu'
|
|
79
|
+
end
|
|
80
|
+
|
|
75
81
|
end
|
|
76
82
|
|
|
77
83
|
end
|
|
@@ -181,6 +187,7 @@ defaults do
|
|
|
181
187
|
environment :stage
|
|
182
188
|
role :app
|
|
183
189
|
color true # Terminal colors? true/false
|
|
190
|
+
#root 'rootuser' # The "root" account (on Ubuntu, set to "ubuntu")
|
|
184
191
|
#user 'someuser' # The default remote user
|
|
185
192
|
#localhost 'hostname' # A local hostname instead of localhost
|
|
186
193
|
#auto true # Skip interactive confirmation?
|
data/lib/rudy.rb
CHANGED
data/lib/rudy/cli/machines.rb
CHANGED
|
@@ -153,8 +153,8 @@ module Rudy
|
|
|
153
153
|
|
|
154
154
|
def update_machines
|
|
155
155
|
mlist = get_machines
|
|
156
|
-
rset = Rye::Set.new(current_group_name, :parallel => @@global.parallel, :user =>
|
|
157
|
-
rset.add_key user_keypairpath(
|
|
156
|
+
rset = Rye::Set.new(current_group_name, :parallel => @@global.parallel, :user => current_machine_root)
|
|
157
|
+
rset.add_key user_keypairpath(current_machine_root)
|
|
158
158
|
os = current_machine_os
|
|
159
159
|
mlist.each do |m|
|
|
160
160
|
li "Updating #{m.name}"
|
|
@@ -199,7 +199,7 @@ module Rudy
|
|
|
199
199
|
end
|
|
200
200
|
|
|
201
201
|
def ssh
|
|
202
|
-
|
|
202
|
+
|
|
203
203
|
|
|
204
204
|
# TODO: Give this method a good look over
|
|
205
205
|
pkey = current_user_keypairpath
|
|
@@ -275,7 +275,7 @@ module Rudy
|
|
|
275
275
|
|
|
276
276
|
# Make sure we want to run this command on all instances
|
|
277
277
|
if !checked && command != :interactive_ssh
|
|
278
|
-
execute_check(:low) if
|
|
278
|
+
execute_check(:low) if current_machine_user == "root"
|
|
279
279
|
checked = true
|
|
280
280
|
end
|
|
281
281
|
|
data/lib/rudy/config.rb
CHANGED
|
@@ -114,16 +114,16 @@ module Rudy
|
|
|
114
114
|
puts "Creating #{Rudy::CONFIG_FILE}"
|
|
115
115
|
rudy_config = Rudy::Utils.without_indent %Q`
|
|
116
116
|
accounts { # Account Access Indentifiers
|
|
117
|
-
aws { # amazon web services
|
|
117
|
+
aws { # amazon web services
|
|
118
118
|
name "Rudy Default"
|
|
119
119
|
accountnum ""
|
|
120
120
|
accesskey ""
|
|
121
121
|
secretkey ""
|
|
122
|
-
pkey "~/path/2/pk-xxxx.pem"
|
|
122
|
+
pkey "~/path/2/pk-xxxx.pem"
|
|
123
123
|
cert "~/path/2/cert-xxxx.pem"
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
|
-
|
|
126
|
+
`
|
|
127
127
|
Rudy::Utils.write_to_file(Rudy::CONFIG_FILE, rudy_config, 'w', 0600)
|
|
128
128
|
end
|
|
129
129
|
end
|
data/lib/rudy/huxtable.rb
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
module Rudy
|
|
@@ -81,10 +81,23 @@ module Rudy
|
|
|
81
81
|
base_dir
|
|
82
82
|
end
|
|
83
83
|
|
|
84
|
+
def default_root
|
|
85
|
+
(@@config.defaults.root || 'root').to_s
|
|
86
|
+
end
|
|
87
|
+
|
|
84
88
|
def default_user
|
|
85
|
-
@@config.defaults.user
|
|
89
|
+
(@@config.defaults.user || current_machine_root).to_s
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def current_machine_root
|
|
93
|
+
(fetch_machine_param(:root) || default_root).to_s
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
def current_machine_user
|
|
97
|
+
(@@global.user || fetch_machine_param(:user) || default_user || Rudy.sysinfo.user).to_s
|
|
86
98
|
end
|
|
87
99
|
|
|
100
|
+
|
|
88
101
|
# Returns the name of the current keypair for the given user.
|
|
89
102
|
# If there's a private key path in the config this will return
|
|
90
103
|
# the basename (it's assumed the Amazon Keypair has the same
|
|
@@ -97,17 +110,22 @@ module Rudy
|
|
|
97
110
|
if path
|
|
98
111
|
Huxtable.keypair_path_to_name(path)
|
|
99
112
|
else
|
|
100
|
-
n = (user
|
|
113
|
+
n = current_user_is_root?(user) ? '' : "-#{user}"
|
|
101
114
|
"key-%s-%s%s" % [@@global.zone, current_machine_group, n]
|
|
102
115
|
end
|
|
103
116
|
end
|
|
104
117
|
def root_keypairname
|
|
105
|
-
user_keypairname
|
|
118
|
+
user_keypairname current_machine_root
|
|
106
119
|
end
|
|
107
120
|
def current_user_keypairname
|
|
108
121
|
user_keypairname current_machine_user
|
|
109
122
|
end
|
|
110
123
|
|
|
124
|
+
def current_user_is_root?(user=nil)
|
|
125
|
+
user ||= current_machine_user
|
|
126
|
+
user.to_s == current_machine_root
|
|
127
|
+
end
|
|
128
|
+
|
|
111
129
|
def user_keypairpath(name=nil)
|
|
112
130
|
name ||= current_machine_user
|
|
113
131
|
path = defined_keypairpath name
|
|
@@ -123,7 +141,7 @@ module Rudy
|
|
|
123
141
|
path
|
|
124
142
|
end
|
|
125
143
|
def root_keypairpath
|
|
126
|
-
user_keypairpath
|
|
144
|
+
user_keypairpath current_machine_root
|
|
127
145
|
end
|
|
128
146
|
def current_user_keypairpath
|
|
129
147
|
user_keypairpath current_machine_user
|
|
@@ -197,11 +215,7 @@ module Rudy
|
|
|
197
215
|
def current_machine_name
|
|
198
216
|
[@@global.zone, current_machine_group, @@global.position].join(Rudy::DELIM)
|
|
199
217
|
end
|
|
200
|
-
|
|
201
|
-
def current_machine_user
|
|
202
|
-
@@global.user || fetch_machine_param(:user) || default_user || Rudy.sysinfo.user
|
|
203
|
-
end
|
|
204
|
-
|
|
218
|
+
|
|
205
219
|
def current_machine_bucket
|
|
206
220
|
@@global.bucket || fetch_machine_param(:bucket) || nil
|
|
207
221
|
end
|
|
@@ -95,12 +95,11 @@ module Rudy; module Routines; module Handlers;
|
|
|
95
95
|
# NOTE: This will set hostname every time a routine is
|
|
96
96
|
# run so we may want to make this an explicit action.
|
|
97
97
|
hntype = current_machine_hostname || :rudy
|
|
98
|
-
this_default_user = default_user
|
|
99
98
|
return if hntype.to_s.to_sym == :default
|
|
100
99
|
rset.batch do
|
|
101
100
|
unless self.stash.os == :windows
|
|
102
101
|
hn = hntype == :rudy ? self.stash.name : hntype
|
|
103
|
-
if self.user.to_s ==
|
|
102
|
+
if self.user.to_s == 'root' # ubuntu has a root user
|
|
104
103
|
hostname hn
|
|
105
104
|
else
|
|
106
105
|
sudo do
|
|
@@ -7,7 +7,8 @@ module Rudy; module Routines; module Handlers;
|
|
|
7
7
|
##Rudy::Routines.add_handler :machines, self
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
def raise_early_exceptions(name
|
|
10
|
+
def raise_early_exceptions(name=nil)
|
|
11
|
+
name ||= current_machine_root
|
|
11
12
|
keyname = user_keypairname name
|
|
12
13
|
kp_file = pkey name
|
|
13
14
|
if registered? keyname
|
|
@@ -20,7 +21,8 @@ module Rudy; module Routines; module Handlers;
|
|
|
20
21
|
end
|
|
21
22
|
end
|
|
22
23
|
|
|
23
|
-
def create(name
|
|
24
|
+
def create(name=nil)
|
|
25
|
+
name ||= current_machine_root
|
|
24
26
|
keyname = user_keypairname name
|
|
25
27
|
kp_file = pkey name
|
|
26
28
|
|
|
@@ -53,32 +55,38 @@ module Rudy; module Routines; module Handlers;
|
|
|
53
55
|
kp
|
|
54
56
|
end
|
|
55
57
|
|
|
56
|
-
def unregister(name
|
|
58
|
+
def unregister(name=nil)
|
|
59
|
+
name ||= current_machine_root
|
|
57
60
|
keyname = user_keypairname name
|
|
58
61
|
raise "Keypair not registered: #{keyname}" unless registered?(name)
|
|
59
62
|
Rudy::AWS::EC2::Keypairs.destroy keyname
|
|
60
63
|
end
|
|
61
64
|
|
|
62
|
-
def delete_pkey(name
|
|
65
|
+
def delete_pkey(name=nil)
|
|
66
|
+
name ||= current_machine_root
|
|
63
67
|
kp_file = pkey name
|
|
64
68
|
raise PrivateKeyNotFound, kp_file unless pkey?(name)
|
|
65
69
|
File.unlink kp_file
|
|
66
70
|
end
|
|
67
71
|
|
|
68
|
-
def exists?(name
|
|
72
|
+
def exists?(name=nil)
|
|
73
|
+
name ||= current_machine_root
|
|
69
74
|
registered?(name) && pkey?(name)
|
|
70
75
|
end
|
|
71
76
|
|
|
72
|
-
def registered?(name
|
|
77
|
+
def registered?(name=nil)
|
|
78
|
+
name ||= current_machine_root
|
|
73
79
|
keyname = user_keypairname name
|
|
74
80
|
Rudy::AWS::EC2::Keypairs.exists?(keyname)
|
|
75
81
|
end
|
|
76
82
|
|
|
77
|
-
def pkey(name
|
|
83
|
+
def pkey(name=nil)
|
|
84
|
+
name ||= current_machine_root
|
|
78
85
|
user_keypairpath name
|
|
79
86
|
end
|
|
80
87
|
|
|
81
|
-
def pkey?(name
|
|
88
|
+
def pkey?(name=nil)
|
|
89
|
+
name ||= current_machine_root
|
|
82
90
|
File.exists? pkey(name)
|
|
83
91
|
end
|
|
84
92
|
|
|
@@ -17,7 +17,8 @@ module Rudy::Routines::Handlers;
|
|
|
17
17
|
:user => current_machine_user,
|
|
18
18
|
:ostype => current_machine_os || :unix,
|
|
19
19
|
:impltype => :linux,
|
|
20
|
-
:info => STDOUT
|
|
20
|
+
:info => STDOUT,
|
|
21
|
+
:paranoid => false # doesn't get passed through (Rye bug?)
|
|
21
22
|
}.merge opts
|
|
22
23
|
|
|
23
24
|
nickname = hostname
|
|
@@ -80,7 +81,7 @@ module Rudy::Routines::Handlers;
|
|
|
80
81
|
:quiet => Rudy.quiet?
|
|
81
82
|
}.merge(opts)
|
|
82
83
|
set = ::Rye::Set.new current_machine_group, opts
|
|
83
|
-
|
|
84
|
+
|
|
84
85
|
opts.delete(:parallel) # Not used by Rye::Box.new
|
|
85
86
|
|
|
86
87
|
hostnames.each do |m|
|
|
@@ -83,7 +83,7 @@ module Rudy; module Routines;
|
|
|
83
83
|
## it prevents shutting down.
|
|
84
84
|
# Check private key after machine group, otherwise we could get an error
|
|
85
85
|
# about there being no key which doesn't make sense if the group isn't running.
|
|
86
|
-
##raise Rudy::PrivateKeyNotFound, root_keypairpath unless has_keypair?(
|
|
86
|
+
##raise Rudy::PrivateKeyNotFound, root_keypairpath unless has_keypair?(current_machine_root)
|
|
87
87
|
if @routine
|
|
88
88
|
bad = @routine.keys - @@allowed_actions
|
|
89
89
|
raise UnsupportedActions.new(@name, bad) unless bad.empty?
|
data/rudy.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rudy
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 7
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 9
|
|
9
9
|
- 8
|
|
10
|
-
-
|
|
11
|
-
version: 0.9.8.
|
|
10
|
+
- 16
|
|
11
|
+
version: 0.9.8.016
|
|
12
12
|
platform: ruby
|
|
13
13
|
authors:
|
|
14
14
|
- Delano Mandelbaum
|
|
@@ -16,7 +16,7 @@ autorequire:
|
|
|
16
16
|
bindir: bin
|
|
17
17
|
cert_chain: []
|
|
18
18
|
|
|
19
|
-
date: 2010-10-
|
|
19
|
+
date: 2010-10-27 00:00:00 -04:00
|
|
20
20
|
default_executable:
|
|
21
21
|
dependencies:
|
|
22
22
|
- !ruby/object:Gem::Dependency
|