rudy 0.8.5 → 0.9.0
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 +110 -18
- data/README.rdoc +40 -44
- data/Rudyfile +35 -50
- data/bin/rudy +88 -57
- data/bin/rudy-ec2 +2 -16
- data/bin/rudy-s3 +0 -10
- data/bin/rudy-sdb +11 -12
- data/lib/rudy.rb +59 -91
- data/lib/rudy/aws.rb +4 -45
- data/lib/rudy/aws/ec2.rb +57 -20
- data/lib/rudy/aws/ec2/address.rb +10 -11
- data/lib/rudy/aws/ec2/group.rb +10 -9
- data/lib/rudy/aws/ec2/image.rb +8 -8
- data/lib/rudy/aws/ec2/instance.rb +18 -19
- data/lib/rudy/aws/ec2/keypair.rb +14 -19
- data/lib/rudy/aws/ec2/snapshot.rb +16 -9
- data/lib/rudy/aws/ec2/volume.rb +39 -26
- data/lib/rudy/aws/ec2/zone.rb +5 -4
- data/lib/rudy/aws/s3.rb +2 -1
- data/lib/rudy/aws/sdb.rb +35 -86
- data/lib/rudy/backups.rb +24 -0
- data/lib/rudy/cli.rb +5 -131
- data/lib/rudy/cli/aws/ec2/addresses.rb +19 -27
- data/lib/rudy/cli/aws/ec2/candy.rb +45 -20
- data/lib/rudy/cli/aws/ec2/groups.rb +9 -13
- data/lib/rudy/cli/aws/ec2/images.rb +5 -133
- data/lib/rudy/cli/aws/ec2/instances.rb +25 -25
- data/lib/rudy/cli/aws/ec2/keypairs.rb +7 -11
- data/lib/rudy/cli/aws/ec2/snapshots.rb +5 -9
- data/lib/rudy/cli/aws/ec2/volumes.rb +22 -23
- data/lib/rudy/cli/aws/ec2/zones.rb +2 -3
- data/lib/rudy/cli/aws/sdb/domains.rb +5 -6
- data/lib/rudy/cli/aws/sdb/objects.rb +33 -0
- data/lib/rudy/cli/aws/sdb/select.rb +23 -0
- data/lib/rudy/cli/backups.rb +38 -0
- data/lib/rudy/cli/base.rb +104 -0
- data/lib/rudy/cli/candy.rb +1 -2
- data/lib/rudy/cli/config.rb +20 -7
- data/lib/rudy/cli/disks.rb +7 -9
- data/lib/rudy/cli/execbase.rb +56 -0
- data/lib/rudy/cli/machines.rb +242 -45
- data/lib/rudy/cli/metadata.rb +24 -10
- data/lib/rudy/cli/networks.rb +34 -0
- data/lib/rudy/cli/routines.rb +32 -6
- data/lib/rudy/cli/status.rb +60 -0
- data/lib/rudy/config.rb +55 -32
- data/lib/rudy/config/objects.rb +44 -30
- data/lib/rudy/disks.rb +25 -0
- data/lib/rudy/exceptions.rb +99 -0
- data/lib/rudy/global.rb +67 -28
- data/lib/rudy/guidelines.rb +3 -2
- data/lib/rudy/huxtable.rb +67 -58
- data/lib/rudy/machines.rb +41 -263
- data/lib/rudy/metadata.rb +212 -38
- data/lib/rudy/metadata/backup.rb +123 -78
- data/lib/rudy/metadata/disk.rb +153 -170
- data/lib/rudy/metadata/machine.rb +179 -0
- data/lib/rudy/mixins.rb +2 -1
- data/lib/rudy/mixins/hash.rb +3 -1
- data/lib/rudy/mixins/symbol.rb +8 -0
- data/lib/rudy/routines.rb +127 -344
- data/lib/rudy/routines/base.rb +229 -0
- data/lib/rudy/routines/handlers/base.rb +48 -0
- data/lib/rudy/routines/handlers/depends.rb +49 -0
- data/lib/rudy/routines/handlers/disks.rb +249 -0
- data/lib/rudy/routines/handlers/group.rb +44 -0
- data/lib/rudy/routines/handlers/host.rb +70 -0
- data/lib/rudy/routines/handlers/keypair.rb +70 -0
- data/lib/rudy/routines/handlers/machines.rb +15 -0
- data/lib/rudy/routines/handlers/script.rb +85 -0
- data/lib/rudy/routines/handlers/user.rb +45 -0
- data/lib/rudy/routines/passthrough.rb +19 -23
- data/lib/rudy/routines/reboot.rb +98 -50
- data/lib/rudy/routines/shutdown.rb +65 -14
- data/lib/rudy/routines/startup.rb +112 -17
- data/lib/rudy/utils.rb +35 -68
- data/rudy.gemspec +82 -25
- data/tryouts/01_mixins/01_hash_tryouts.rb +20 -0
- data/tryouts/10_require_time/10_rudy_tryouts.rb +33 -0
- data/tryouts/10_require_time/15_global_tryouts.rb +58 -0
- data/tryouts/12_config/10_load_config_tryouts.rb +43 -0
- data/tryouts/12_config/20_defaults_tryouts.rb +16 -0
- data/tryouts/12_config/30_accounts_tryouts.rb +17 -0
- data/tryouts/12_config/40_machines_tryouts.rb +53 -0
- data/tryouts/12_config/50_commands_tryouts.rb +17 -0
- data/tryouts/12_config/60_routines_tryouts.rb +16 -0
- data/tryouts/15_huxtable/10_huxtable_tryouts.rb +47 -0
- data/tryouts/15_huxtable/20_user_tryouts.rb +47 -0
- data/tryouts/20_simpledb/10_domains_tryouts.rb +36 -0
- data/tryouts/20_simpledb/20_objects_tryouts.rb +56 -0
- data/tryouts/25_ec2/10_keypairs_tryouts.rb +54 -0
- data/tryouts/25_ec2/20_groups_tryouts.rb +56 -0
- data/tryouts/25_ec2/21_groups_authorize_address_tryouts.rb +53 -0
- data/tryouts/25_ec2/22_groups_authorize_account_tryouts.rb +54 -0
- data/tryouts/25_ec2/30_addresses_tryouts.rb +42 -0
- data/tryouts/25_ec2/40_volumes_tryouts.rb +53 -0
- data/tryouts/25_ec2/50_snapshots_tryouts.rb +75 -0
- data/tryouts/26_ec2_instances/10_instance_tryouts.rb +107 -0
- data/tryouts/26_ec2_instances/50_images_tryouts.rb +7 -0
- data/tryouts/30_metadata/10_include_tryouts.rb +45 -0
- data/tryouts/30_metadata/13_object_tryouts.rb +19 -0
- data/tryouts/30_metadata/50_disk_tryouts.rb +115 -0
- data/tryouts/30_metadata/51_disk_digest_tryouts.rb +24 -0
- data/tryouts/30_metadata/53_disk_list_tryouts.rb +35 -0
- data/tryouts/30_metadata/56_disk_volume_tryouts.rb +68 -0
- data/tryouts/30_metadata/60_backup_tryouts.rb +101 -0
- data/tryouts/30_metadata/63_backup_list_tryouts.rb +38 -0
- data/tryouts/30_metadata/64_backup_disk_tryouts.rb +65 -0
- data/tryouts/30_metadata/66_backup_snapshot_tryouts.rb +76 -0
- data/tryouts/30_metadata/70_machine_tryouts.rb +85 -0
- data/tryouts/30_metadata/73_machine_list_tryouts.rb +58 -0
- data/tryouts/30_metadata/76_machine_instance_tryouts.rb +64 -0
- data/tryouts/30_metadata/77_machines_tryouts.rb +45 -0
- data/tryouts/40_routines/10_keypair_handler_tryouts.rb +52 -0
- data/tryouts/40_routines/11_group_handler_tryouts.rb +36 -0
- data/tryouts/80_cli/10_rudyec2_tryouts.rb +8 -0
- data/tryouts/80_cli/60_rudy_tryouts.rb +41 -0
- data/tryouts/exploration/console.rb +91 -0
- data/tryouts/exploration/machine.rb +23 -0
- data/tryouts/failer +6 -0
- metadata +116 -32
- data/bin/ird +0 -153
- data/lib/rudy/metadata/backups.rb +0 -67
- data/lib/rudy/metadata/debug.rb +0 -38
- data/lib/rudy/metadata/disks.rb +0 -67
- data/lib/rudy/metadata/objectbase.rb +0 -108
- data/lib/rudy/routines/helper.rb +0 -76
- data/lib/rudy/routines/helpers/dependshelper.rb +0 -34
- data/lib/rudy/routines/helpers/diskhelper.rb +0 -403
- data/lib/rudy/routines/helpers/scripthelper.rb +0 -197
- data/lib/rudy/routines/helpers/userhelper.rb +0 -37
- data/support/rudy-ec2-startup +0 -200
@@ -3,34 +3,85 @@
|
|
3
3
|
module Rudy; module Routines;
|
4
4
|
class Shutdown < Rudy::Routines::Base
|
5
5
|
|
6
|
+
Rudy::Routines.add_routine :shutdown, self
|
7
|
+
|
8
|
+
@@allowed_actions = [:before, :disks, :adduser, :authorize,
|
9
|
+
:local, :remote, :after_local, :after]
|
10
|
+
|
6
11
|
def init(*args)
|
7
|
-
@
|
12
|
+
@machines = Rudy::Machines.list || []
|
13
|
+
@@rset = create_rye_set @machines unless defined?(@@rset)
|
14
|
+
@routine ||= {}
|
8
15
|
end
|
9
16
|
|
17
|
+
# Startup routines run in the following order:
|
18
|
+
# * before dependencies
|
19
|
+
# * all other actions (except after_local)
|
20
|
+
# * Shutdown instances
|
21
|
+
# * after_local (if present)
|
22
|
+
# * after dependencies
|
10
23
|
def execute
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
24
|
+
ld "Executing routine: #{@name}"
|
25
|
+
ld "[this is a generic routine]" if @routine.empty?
|
26
|
+
|
27
|
+
# We need to remove after_local so the runner doesn't see it
|
28
|
+
after_local = @routine.delete(:after_local)
|
29
|
+
|
30
|
+
if run?
|
31
|
+
Rudy::Routines.rescue {
|
32
|
+
Rudy::Routines::Handlers::Group.authorize rescue nil
|
33
|
+
}
|
34
|
+
|
35
|
+
Rudy::Routines::Handlers::Depends.execute_all @before
|
36
|
+
|
37
|
+
# This is the meat of the sandwich
|
38
|
+
Rudy::Routines.runner(@routine, @@rset, @@lbox, @argv)
|
39
|
+
|
40
|
+
@machines.each do |machine|
|
41
|
+
Rudy::Routines.rescue { machine.destroy }
|
42
|
+
end
|
43
|
+
|
44
|
+
if after_local
|
45
|
+
handler = Rudy::Routines.get_handler :local
|
46
|
+
Rudy::Routines.rescue {
|
47
|
+
handler.execute(:local, after_local, nil, @@lbox, @argv)
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
Rudy::Routines::Handlers::Depends.execute_all @after
|
19
52
|
end
|
20
|
-
|
53
|
+
|
54
|
+
@machines
|
21
55
|
end
|
22
|
-
|
56
|
+
|
23
57
|
# Called by generic_machine_runner
|
24
58
|
def raise_early_exceptions
|
25
|
-
|
26
|
-
|
59
|
+
raise NoMachinesConfig unless @@config.machines
|
60
|
+
|
61
|
+
# If this is a test run we don't care if the group is running
|
62
|
+
if run?
|
63
|
+
if @@global.position.nil?
|
64
|
+
raise MachineGroupNotRunning, current_machine_group unless Rudy::Machines.running?
|
65
|
+
else
|
66
|
+
unless Rudy::Machines.running? @@global.position
|
67
|
+
m = Rudy::Machine.new @@global.position
|
68
|
+
raise MachineNotRunning, m.name
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
27
73
|
## NOTE: This check is disabled for now. If the private key doesn't exist
|
28
74
|
## it prevents shutting down.
|
29
75
|
# Check private key after machine group, otherwise we could get an error
|
30
76
|
# about there being no key which doesn't make sense if the group isn't running.
|
31
77
|
##raise Rudy::PrivateKeyNotFound, root_keypairpath unless has_keypair?(:root)
|
78
|
+
if @routine
|
79
|
+
bad = @routine.keys - @@allowed_actions
|
80
|
+
raise UnsupportedActions.new(@name, bad) unless bad.empty?
|
81
|
+
end
|
32
82
|
end
|
33
83
|
|
34
84
|
end
|
35
85
|
|
36
|
-
end; end
|
86
|
+
end; end
|
87
|
+
|
@@ -3,34 +3,129 @@
|
|
3
3
|
module Rudy; module Routines;
|
4
4
|
class Startup < Rudy::Routines::Base
|
5
5
|
|
6
|
+
Rudy::Routines.add_routine :startup, self
|
7
|
+
|
8
|
+
@@allowed_actions = [:before, :before_local, :disks, :adduser,
|
9
|
+
:authorize, :local, :remote, :after]
|
10
|
+
|
6
11
|
def init(*args)
|
7
|
-
@routine
|
12
|
+
@routine ||= {}
|
8
13
|
end
|
9
14
|
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
15
|
+
# Startup routines run in the following order:
|
16
|
+
# * before dependencies
|
17
|
+
# * before_local (if present)
|
18
|
+
# * Startup instances
|
19
|
+
# * Set hostname
|
20
|
+
# * all other actions
|
21
|
+
# * after dependencies
|
22
|
+
def execute
|
23
|
+
ld "Executing routine: #{@name}"
|
24
|
+
ld "[this is a generic routine]" if @routine.empty?
|
25
|
+
|
26
|
+
|
27
|
+
if run?
|
28
|
+
Rudy::Routines::Handlers::Depends.execute_all @before
|
29
|
+
|
30
|
+
if @routine.has_key? :before_local
|
31
|
+
handler = Rudy::Routines.get_handler :local
|
32
|
+
Rudy::Routines.rescue {
|
33
|
+
handler.execute(:local, @routine.delete(:before_local), nil, @@lbox, @argv)
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
Rudy::Routines.rescue {
|
38
|
+
unless Rudy::Routines::Handlers::Group.exists?
|
39
|
+
Rudy::Routines::Handlers::Group.create
|
40
|
+
end
|
41
|
+
# Run this every startup incase the ip address has changed.
|
42
|
+
# If there's an exception it's probably b/c the address is
|
43
|
+
# already authorized for port 22.
|
44
|
+
Rudy::Routines::Handlers::Group.authorize rescue nil
|
45
|
+
}
|
46
|
+
|
47
|
+
Rudy::Routines.rescue {
|
48
|
+
unless Rudy::Routines::Handlers::Keypair.exists?
|
49
|
+
Rudy::Routines::Handlers::Keypair.create
|
50
|
+
end
|
51
|
+
}
|
52
|
+
|
53
|
+
end
|
54
|
+
|
55
|
+
## puts Rudy::Routines.machine_separator(machine.name, machine.awsid)
|
56
|
+
|
57
|
+
# If this is a testrun we won't create new instances
|
58
|
+
# we'll just grab the list of machines in this group.
|
59
|
+
# NOTE: Expect errors if there are no machines.
|
60
|
+
Rudy::Routines.rescue {
|
61
|
+
@machines = run? ? Rudy::Machines.create : Rudy::Machines.list
|
62
|
+
@@rset = create_rye_set @machines unless defined?(@@rset)
|
63
|
+
}
|
64
|
+
|
65
|
+
Rudy::Routines.rescue {
|
66
|
+
if !Rudy::Routines::Handlers::Host.is_running? @@rset
|
67
|
+
a = @@rset.boxes.select { |box| !box.stash.instance_running? }
|
68
|
+
raise GroupNotRunning, a
|
69
|
+
end
|
70
|
+
}
|
71
|
+
|
72
|
+
# This is important b/c the machines will not
|
73
|
+
# have DNS info until after they are running.
|
74
|
+
Rudy::Routines.rescue { Rudy::Routines::Handlers::Host.update_dns @@rset }
|
75
|
+
|
76
|
+
Rudy::Routines.rescue {
|
77
|
+
if !Rudy::Routines::Handlers::Host.is_available? @@rset
|
78
|
+
a = @@rset.boxes.select { |box| !box.stash.instance_available? }
|
79
|
+
raise GroupNotAvailable, a
|
80
|
+
end
|
81
|
+
}
|
82
|
+
Rudy::Routines.rescue {
|
83
|
+
Rudy::Routines::Handlers::Host.set_hostname @@rset
|
84
|
+
}
|
85
|
+
|
86
|
+
if run?
|
87
|
+
# This is the meat of the sandwich
|
88
|
+
Rudy::Routines.runner @routine, @@rset, @@lbox, @argv
|
89
|
+
|
90
|
+
Rudy::Routines.rescue {
|
91
|
+
Rudy::Routines::Handlers::Depends.execute_all @after
|
92
|
+
}
|
93
|
+
|
19
94
|
end
|
20
|
-
|
21
|
-
machines
|
95
|
+
|
96
|
+
@machines
|
22
97
|
end
|
23
98
|
|
24
99
|
# Called by generic_machine_runner
|
25
100
|
def raise_early_exceptions
|
26
|
-
|
101
|
+
raise NoMachinesConfig unless @@config.machines
|
27
102
|
# There's no keypair check here because Rudy::Machines will create one
|
28
103
|
raise MachineGroupNotDefined, current_machine_group unless known_machine_group?
|
29
|
-
|
30
|
-
|
31
|
-
|
104
|
+
|
105
|
+
unless (1..MAX_INSTANCES).member?(current_machine_count)
|
106
|
+
raise "Instance count must be more than 0, less than #{MAX_INSTANCES}"
|
107
|
+
end
|
108
|
+
|
109
|
+
# If this is a testrun, we don't create instances anyway so
|
110
|
+
# it doesn't matter if there are already instances running.
|
111
|
+
if run? && !@@global.force
|
112
|
+
if @@global.position.nil?
|
113
|
+
raise MachineGroupAlreadyRunning, current_machine_group if Rudy::Machines.running?
|
114
|
+
raise MachineGroupMetadataExists, current_machine_group if Rudy::Machines.exists?
|
115
|
+
else
|
116
|
+
if Rudy::Machines.running? @@global.position
|
117
|
+
m = Rudy::Machine.new @@global.position
|
118
|
+
raise MachineAlreadyRunning, m.name
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
if @routine
|
124
|
+
bad = @routine.keys - @@allowed_actions
|
125
|
+
raise UnsupportedActions.new(@name, bad) unless bad.empty?
|
126
|
+
end
|
32
127
|
end
|
33
128
|
|
34
129
|
end
|
35
130
|
|
36
|
-
end; end
|
131
|
+
end; end
|
data/lib/rudy/utils.rb
CHANGED
@@ -25,7 +25,6 @@ module Rudy
|
|
25
25
|
rescue SocketError, Errno::ETIMEDOUT => ex
|
26
26
|
STDERR.puts "Connection Error. Check your internets!"
|
27
27
|
end
|
28
|
-
ip += "/32" if ip
|
29
28
|
ip
|
30
29
|
end
|
31
30
|
|
@@ -36,47 +35,34 @@ module Rudy
|
|
36
35
|
# turn off reverse DNS resolution temporarily
|
37
36
|
orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true
|
38
37
|
ip = UDPSocket.open {|s| s.connect('75.101.137.7', 1); s.addr.last } # Solutious IP
|
39
|
-
ip += "/24" if ip
|
40
38
|
ip
|
41
39
|
ensure
|
42
40
|
Socket.do_not_reverse_lookup = orig
|
43
41
|
end
|
44
42
|
|
45
43
|
# Generates a canonical tag name in the form:
|
46
|
-
#
|
47
|
-
# where
|
48
|
-
|
44
|
+
# 2009-12-31-USER-SUFFIX
|
45
|
+
# where USER is equal to the user executing the Rudy process and
|
46
|
+
# SUFFIX is equal to +suffix+ (optional)
|
47
|
+
def generate_tag(suffix=nil)
|
49
48
|
n = DateTime.now
|
50
|
-
y = n.year.to_s.rjust(4, "20")
|
51
|
-
|
52
|
-
|
53
|
-
|
49
|
+
y, m = n.year.to_s.rjust(4, "20"), n.month.to_s.rjust(2, "0")
|
50
|
+
d, u = n.mday.to_s.rjust(2, "0"), Rudy.sysinfo.user
|
51
|
+
criteria = [y, m, d, u]
|
52
|
+
criteria << suffix unless suffix.nil? || suffix.empty?
|
53
|
+
criteria.join Rudy::DELIM
|
54
54
|
end
|
55
55
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
# Determine if we're running directly on EC2 or
|
60
|
-
# "some other machine". We do this by checking if
|
61
|
-
# the file /etc/ec2/instance-id exists. This
|
62
|
-
# file is written by /etc/init.d/rudy-ec2-startup.
|
63
|
-
# NOTE: Is there a way to know definitively that this is EC2?
|
64
|
-
# We could make a request to the metadata IP addresses.
|
65
|
-
def Rudy.in_situ?
|
66
|
-
File.exists?('/etc/ec2/instance-id')
|
67
|
-
end
|
68
|
-
|
69
|
-
|
70
56
|
# Wait for something to happen.
|
71
57
|
# * +duration+ seconds to wait between tries (default: 2).
|
72
|
-
# * +max+ maximum time to wait (default:
|
58
|
+
# * +max+ maximum time to wait (default: 240). Throws an exception when exceeded.
|
73
59
|
# * +logger+ IO object to print +dot+ to.
|
74
60
|
# * +msg+ the message to print before executing the block.
|
75
61
|
# * +bells+ number of terminal bells to ring. Set to nil or false to keep the waiter silent
|
76
62
|
#
|
77
63
|
# The +check+ block must return false while waiting. Once it returns true
|
78
64
|
# the waiter will return true too.
|
79
|
-
def waiter(duration=2, max=
|
65
|
+
def waiter(duration=2, max=240, logger=STDOUT, msg=nil, bells=0, &check)
|
80
66
|
# TODO: Move to Drydock. [ed-why?]
|
81
67
|
raise "The waiter needs a block!" unless check
|
82
68
|
duration = 1 if duration < 1
|
@@ -100,7 +86,7 @@ module Rudy
|
|
100
86
|
end
|
101
87
|
|
102
88
|
if msg && logger
|
103
|
-
logger.puts
|
89
|
+
logger.puts
|
104
90
|
logger.flush
|
105
91
|
end
|
106
92
|
|
@@ -157,7 +143,7 @@ module Rudy
|
|
157
143
|
Rudy::ID_MAP[key]
|
158
144
|
end
|
159
145
|
|
160
|
-
# Return a string ID without the identifier.
|
146
|
+
# Return a string ID without the identifier. e.g. key-stage-app-root => stage-app-root
|
161
147
|
def noid(str)
|
162
148
|
el = str.split('-')
|
163
149
|
el.shift
|
@@ -214,15 +200,28 @@ module Rudy
|
|
214
200
|
# Errno::EAFNOSUPPORT, Errno::ECONNREFUSED, SocketError, Timeout::Error
|
215
201
|
#
|
216
202
|
def service_available?(host, port, wait=3)
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
socket.connect
|
203
|
+
if Rudy.sysinfo.vm == :java
|
204
|
+
begin
|
205
|
+
iadd = Java::InetSocketAddress.new host, port
|
206
|
+
socket = Java::Socket.new
|
207
|
+
socket.connect iadd, wait * 1000 # milliseconds
|
208
|
+
success = !socket.isClosed && socket.isConnected
|
209
|
+
rescue NativeException => ex
|
210
|
+
puts ex.message, ex.backtrace if Rudy.debug?
|
211
|
+
false
|
212
|
+
end
|
213
|
+
else
|
214
|
+
begin
|
215
|
+
status = Timeout::timeout(wait) do
|
216
|
+
socket = Socket.new( AF_INET, SOCK_STREAM, 0 )
|
217
|
+
sockaddr = Socket.pack_sockaddr_in( port, host )
|
218
|
+
socket.connect( sockaddr )
|
219
|
+
end
|
220
|
+
true
|
221
|
+
rescue Errno::EAFNOSUPPORT, Errno::ECONNREFUSED, SocketError, Timeout::Error => ex
|
222
|
+
puts ex.class, ex.message, ex.backtrace if Rudy.debug?
|
223
|
+
false
|
222
224
|
end
|
223
|
-
true
|
224
|
-
rescue Errno::EAFNOSUPPORT, Errno::ECONNREFUSED, SocketError, Timeout::Error => ex
|
225
|
-
false
|
226
225
|
end
|
227
226
|
end
|
228
227
|
|
@@ -279,42 +278,10 @@ module Rudy
|
|
279
278
|
str.gsub(/^[[:blank:]]{#{indent}}/, '')
|
280
279
|
end
|
281
280
|
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
######### Everything below here is TO BE REMOVED.
|
286
|
-
|
287
|
-
# (TO BE REMOVED)
|
288
|
-
# TODO: This is old and nasty.
|
289
|
-
def scp_command(host, keypair, user, paths, to_path, to_local=false, verbose=false, printonly=false)
|
290
|
-
|
291
|
-
paths = [paths] unless paths.is_a?(Array)
|
292
|
-
from_paths = ""
|
293
|
-
if to_local
|
294
|
-
paths.each do |path|
|
295
|
-
from_paths << "#{user}@#{host}:#{path} "
|
296
|
-
end
|
297
|
-
#puts "Copying FROM remote TO this machine", $/
|
298
|
-
|
299
|
-
else
|
300
|
-
to_path = "#{user}@#{host}:#{to_path}"
|
301
|
-
from_paths = paths.join(' ')
|
302
|
-
#puts "Copying FROM this machine TO remote", $/
|
303
|
-
end
|
304
|
-
|
305
|
-
|
306
|
-
cmd = "scp -r "
|
307
|
-
cmd << "-i #{keypair}" if keypair
|
308
|
-
cmd << " #{from_paths} #{to_path}"
|
309
|
-
|
310
|
-
puts cmd if verbose
|
311
|
-
printonly ? (puts cmd) : system(cmd)
|
312
|
-
end
|
313
|
-
|
314
281
|
end
|
315
282
|
end
|
316
283
|
|
317
|
-
# = RSSReader
|
284
|
+
# = Rudy::Utils::RSSReader
|
318
285
|
#
|
319
286
|
# A rudimentary way to read an RSS feed as a hash.
|
320
287
|
# Adapted from: http://snippets.dzone.com/posts/show/68
|
data/rudy.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
@spec = Gem::Specification.new do |s|
|
2
2
|
s.name = "rudy"
|
3
3
|
s.rubyforge_project = 'rudy'
|
4
|
-
s.version = "0.
|
4
|
+
s.version = "0.9.0"
|
5
5
|
s.summary = "Rudy: Not your grandparents' EC2 deployment tool."
|
6
6
|
s.description = s.summary
|
7
7
|
s.author = "Delano Mandelbaum"
|
@@ -12,26 +12,29 @@
|
|
12
12
|
s.has_rdoc = true
|
13
13
|
s.rdoc_options = ["--line-numbers", "--title", s.summary, "--main", "README.rdoc"]
|
14
14
|
s.require_paths = %w[lib]
|
15
|
-
s.rubygems_version = '1.
|
15
|
+
s.rubygems_version = '1.3.0'
|
16
16
|
|
17
|
-
s.add_dependency '
|
18
|
-
s.add_dependency '
|
19
|
-
s.add_dependency '
|
20
|
-
s.add_dependency '
|
21
|
-
s.add_dependency '
|
22
|
-
s.add_dependency '
|
17
|
+
s.add_dependency 'rye', '>= 0.8.6'
|
18
|
+
s.add_dependency 'attic', '>= 0.4.0'
|
19
|
+
s.add_dependency 'annoy', '>= 0.5.5'
|
20
|
+
s.add_dependency 'drydock', '>= 0.6.6'
|
21
|
+
s.add_dependency 'caesars', '>= 0.7.3'
|
22
|
+
s.add_dependency 'sysinfo', '>= 0.6.3'
|
23
|
+
s.add_dependency 'gibbler', '>= 0.6.0'
|
24
|
+
s.add_dependency 'tryouts', '>= 0.8.4'
|
25
|
+
s.add_dependency 'storable', '>= 0.5.6'
|
23
26
|
|
24
|
-
s.add_dependency '
|
27
|
+
s.add_dependency 'aws-s3', '>= 0.6.1' # Ruby 1.9.1 compatability
|
28
|
+
s.add_dependency 'highline', '>= 1.5.1' # Ruby 1.9.1 compatability
|
25
29
|
s.add_dependency 'amazon-ec2', '>= 0.3.8' # Region fix
|
26
|
-
s.add_dependency 'aws-s3', '>= 0.6.1' # Ruby 1.9.1 compatability
|
27
|
-
s.add_dependency 'highline', '>= 1.5.1'
|
28
30
|
|
29
|
-
# One of the other dependencies needs these gems
|
30
|
-
# to specify them. Why I outta!
|
31
|
+
# One of the other dependencies needs these gems
|
32
|
+
# but doesn't seem to specify them. Why I outta!
|
33
|
+
s.add_dependency 'tenderlove-frex'
|
31
34
|
s.add_dependency 'archive-tar-minitar'
|
32
35
|
s.add_dependency 'nokogiri'
|
36
|
+
s.add_dependency 'echoe'
|
33
37
|
s.add_dependency 'racc'
|
34
|
-
s.add_dependency 'tenderlove-frex'
|
35
38
|
s.add_dependency 'hoe'
|
36
39
|
|
37
40
|
# libxml2 libxml2-dev libxslt-dev
|
@@ -52,7 +55,6 @@
|
|
52
55
|
README.rdoc
|
53
56
|
Rakefile
|
54
57
|
Rudyfile
|
55
|
-
bin/ird
|
56
58
|
bin/rudy
|
57
59
|
bin/rudy-ec2
|
58
60
|
bin/rudy-s3
|
@@ -71,6 +73,7 @@
|
|
71
73
|
lib/rudy/aws/s3.rb
|
72
74
|
lib/rudy/aws/sdb.rb
|
73
75
|
lib/rudy/aws/sdb/error.rb
|
76
|
+
lib/rudy/backups.rb
|
74
77
|
lib/rudy/cli.rb
|
75
78
|
lib/rudy/cli/aws/ec2/addresses.rb
|
76
79
|
lib/rudy/cli/aws/ec2/candy.rb
|
@@ -84,33 +87,45 @@
|
|
84
87
|
lib/rudy/cli/aws/s3/buckets.rb
|
85
88
|
lib/rudy/cli/aws/s3/store.rb
|
86
89
|
lib/rudy/cli/aws/sdb/domains.rb
|
90
|
+
lib/rudy/cli/aws/sdb/objects.rb
|
91
|
+
lib/rudy/cli/aws/sdb/select.rb
|
92
|
+
lib/rudy/cli/backups.rb
|
93
|
+
lib/rudy/cli/base.rb
|
87
94
|
lib/rudy/cli/candy.rb
|
88
95
|
lib/rudy/cli/config.rb
|
89
96
|
lib/rudy/cli/disks.rb
|
97
|
+
lib/rudy/cli/execbase.rb
|
90
98
|
lib/rudy/cli/machines.rb
|
91
99
|
lib/rudy/cli/metadata.rb
|
100
|
+
lib/rudy/cli/networks.rb
|
92
101
|
lib/rudy/cli/routines.rb
|
102
|
+
lib/rudy/cli/status.rb
|
93
103
|
lib/rudy/config.rb
|
94
104
|
lib/rudy/config/objects.rb
|
105
|
+
lib/rudy/disks.rb
|
106
|
+
lib/rudy/exceptions.rb
|
95
107
|
lib/rudy/global.rb
|
96
108
|
lib/rudy/guidelines.rb
|
97
109
|
lib/rudy/huxtable.rb
|
98
110
|
lib/rudy/machines.rb
|
99
111
|
lib/rudy/metadata.rb
|
100
112
|
lib/rudy/metadata/backup.rb
|
101
|
-
lib/rudy/metadata/backups.rb
|
102
|
-
lib/rudy/metadata/debug.rb
|
103
113
|
lib/rudy/metadata/disk.rb
|
104
|
-
lib/rudy/metadata/
|
105
|
-
lib/rudy/metadata/objectbase.rb
|
114
|
+
lib/rudy/metadata/machine.rb
|
106
115
|
lib/rudy/mixins.rb
|
107
116
|
lib/rudy/mixins/hash.rb
|
117
|
+
lib/rudy/mixins/symbol.rb
|
108
118
|
lib/rudy/routines.rb
|
109
|
-
lib/rudy/routines/
|
110
|
-
lib/rudy/routines/
|
111
|
-
lib/rudy/routines/
|
112
|
-
lib/rudy/routines/
|
113
|
-
lib/rudy/routines/
|
119
|
+
lib/rudy/routines/base.rb
|
120
|
+
lib/rudy/routines/handlers/base.rb
|
121
|
+
lib/rudy/routines/handlers/depends.rb
|
122
|
+
lib/rudy/routines/handlers/disks.rb
|
123
|
+
lib/rudy/routines/handlers/group.rb
|
124
|
+
lib/rudy/routines/handlers/host.rb
|
125
|
+
lib/rudy/routines/handlers/keypair.rb
|
126
|
+
lib/rudy/routines/handlers/machines.rb
|
127
|
+
lib/rudy/routines/handlers/script.rb
|
128
|
+
lib/rudy/routines/handlers/user.rb
|
114
129
|
lib/rudy/routines/passthrough.rb
|
115
130
|
lib/rudy/routines/reboot.rb
|
116
131
|
lib/rudy/routines/shutdown.rb
|
@@ -119,8 +134,50 @@
|
|
119
134
|
rudy.gemspec
|
120
135
|
support/mailtest
|
121
136
|
support/randomize-root-password
|
122
|
-
support/rudy-ec2-startup
|
123
137
|
support/update-ec2-ami-tools
|
138
|
+
tryouts/01_mixins/01_hash_tryouts.rb
|
139
|
+
tryouts/10_require_time/10_rudy_tryouts.rb
|
140
|
+
tryouts/10_require_time/15_global_tryouts.rb
|
141
|
+
tryouts/12_config/10_load_config_tryouts.rb
|
142
|
+
tryouts/12_config/20_defaults_tryouts.rb
|
143
|
+
tryouts/12_config/30_accounts_tryouts.rb
|
144
|
+
tryouts/12_config/40_machines_tryouts.rb
|
145
|
+
tryouts/12_config/50_commands_tryouts.rb
|
146
|
+
tryouts/12_config/60_routines_tryouts.rb
|
147
|
+
tryouts/15_huxtable/10_huxtable_tryouts.rb
|
148
|
+
tryouts/15_huxtable/20_user_tryouts.rb
|
149
|
+
tryouts/20_simpledb/10_domains_tryouts.rb
|
150
|
+
tryouts/20_simpledb/20_objects_tryouts.rb
|
151
|
+
tryouts/25_ec2/10_keypairs_tryouts.rb
|
152
|
+
tryouts/25_ec2/20_groups_tryouts.rb
|
153
|
+
tryouts/25_ec2/21_groups_authorize_address_tryouts.rb
|
154
|
+
tryouts/25_ec2/22_groups_authorize_account_tryouts.rb
|
155
|
+
tryouts/25_ec2/30_addresses_tryouts.rb
|
156
|
+
tryouts/25_ec2/40_volumes_tryouts.rb
|
157
|
+
tryouts/25_ec2/50_snapshots_tryouts.rb
|
158
|
+
tryouts/26_ec2_instances/10_instance_tryouts.rb
|
159
|
+
tryouts/26_ec2_instances/50_images_tryouts.rb
|
160
|
+
tryouts/30_metadata/10_include_tryouts.rb
|
161
|
+
tryouts/30_metadata/13_object_tryouts.rb
|
162
|
+
tryouts/30_metadata/50_disk_tryouts.rb
|
163
|
+
tryouts/30_metadata/51_disk_digest_tryouts.rb
|
164
|
+
tryouts/30_metadata/53_disk_list_tryouts.rb
|
165
|
+
tryouts/30_metadata/56_disk_volume_tryouts.rb
|
166
|
+
tryouts/30_metadata/60_backup_tryouts.rb
|
167
|
+
tryouts/30_metadata/63_backup_list_tryouts.rb
|
168
|
+
tryouts/30_metadata/64_backup_disk_tryouts.rb
|
169
|
+
tryouts/30_metadata/66_backup_snapshot_tryouts.rb
|
170
|
+
tryouts/30_metadata/70_machine_tryouts.rb
|
171
|
+
tryouts/30_metadata/73_machine_list_tryouts.rb
|
172
|
+
tryouts/30_metadata/76_machine_instance_tryouts.rb
|
173
|
+
tryouts/30_metadata/77_machines_tryouts.rb
|
174
|
+
tryouts/40_routines/10_keypair_handler_tryouts.rb
|
175
|
+
tryouts/40_routines/11_group_handler_tryouts.rb
|
176
|
+
tryouts/80_cli/10_rudyec2_tryouts.rb
|
177
|
+
tryouts/80_cli/60_rudy_tryouts.rb
|
178
|
+
tryouts/exploration/console.rb
|
179
|
+
tryouts/exploration/machine.rb
|
180
|
+
tryouts/failer
|
124
181
|
)
|
125
182
|
|
126
183
|
|