solutious-rudy 0.7.3 → 0.7.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.txt +28 -5
- data/README.rdoc +1 -1
- data/Rudyfile +51 -19
- data/bin/ird +153 -0
- data/bin/rudy +18 -23
- data/bin/rudy-ec2 +5 -10
- data/bin/rudy-s3 +1 -3
- data/bin/rudy-sdb +0 -2
- data/examples/README.md +10 -0
- data/examples/debian-sinatra-passenger/commands.rb +19 -0
- data/examples/debian-sinatra-passenger/machines.rb +32 -0
- data/examples/debian-sinatra-passenger/routines.rb +30 -0
- data/examples/debian-sinatra-thin/commands.rb +17 -0
- data/examples/debian-sinatra-thin/machines.rb +35 -0
- data/examples/debian-sinatra-thin/routines.rb +72 -0
- data/lib/rudy.rb +8 -17
- data/lib/rudy/aws.rb +1 -2
- data/lib/rudy/aws/ec2/address.rb +0 -1
- data/lib/rudy/aws/ec2/snapshot.rb +11 -0
- data/lib/rudy/aws/s3.rb +6 -3
- data/lib/rudy/cli.rb +12 -2
- data/lib/rudy/cli/aws/ec2/candy.rb +19 -48
- data/lib/rudy/cli/aws/ec2/images.rb +109 -122
- data/lib/rudy/cli/aws/s3/buckets.rb +1 -2
- data/lib/rudy/cli/config.rb +13 -0
- data/lib/rudy/cli/disks.rb +24 -1
- data/lib/rudy/cli/routines.rb +10 -11
- data/lib/rudy/config.rb +6 -9
- data/lib/rudy/config/objects.rb +4 -0
- data/lib/rudy/global.rb +4 -5
- data/lib/rudy/huxtable.rb +23 -8
- data/lib/rudy/machines.rb +11 -4
- data/lib/rudy/metadata.rb +8 -94
- data/lib/rudy/metadata/backup.rb +113 -0
- data/lib/rudy/metadata/backups.rb +65 -0
- data/lib/rudy/{disks.rb → metadata/disk.rb} +36 -69
- data/lib/rudy/metadata/disks.rb +67 -0
- data/lib/rudy/metadata/objectbase.rb +104 -0
- data/lib/rudy/mixins.rb +2 -0
- data/lib/rudy/routines.rb +173 -88
- data/lib/rudy/routines/helpers/dependshelper.rb +34 -0
- data/lib/rudy/routines/helpers/diskhelper.rb +174 -5
- data/lib/rudy/routines/helpers/scmhelper.rb +2 -2
- data/lib/rudy/routines/helpers/scripthelper.rb +11 -4
- data/lib/rudy/routines/passthrough.rb +3 -1
- data/lib/rudy/routines/reboot.rb +75 -0
- data/lib/rudy/routines/startup.rb +3 -3
- data/lib/rudy/scm/git.rb +17 -17
- data/lib/rudy/scm/svn.rb +46 -5
- data/lib/rudy/utils.rb +3 -2
- data/rudy.gemspec +24 -46
- data/test/30_sdb_metadata/10_disks_test.rb +5 -5
- metadata +35 -67
- data/lib/annoy.rb +0 -298
- data/lib/console.rb +0 -404
- data/lib/escape.rb +0 -305
- data/lib/rudy/backup.rb +0 -135
- data/lib/storable.rb +0 -292
- data/lib/sysinfo.rb +0 -285
- data/lib/tryouts.rb +0 -33
- data/vendor/highline-1.5.1/CHANGELOG +0 -222
- data/vendor/highline-1.5.1/INSTALL +0 -35
- data/vendor/highline-1.5.1/LICENSE +0 -7
- data/vendor/highline-1.5.1/README +0 -63
- data/vendor/highline-1.5.1/Rakefile +0 -82
- data/vendor/highline-1.5.1/TODO +0 -6
- data/vendor/highline-1.5.1/examples/ansi_colors.rb +0 -38
- data/vendor/highline-1.5.1/examples/asking_for_arrays.rb +0 -18
- data/vendor/highline-1.5.1/examples/basic_usage.rb +0 -75
- data/vendor/highline-1.5.1/examples/color_scheme.rb +0 -32
- data/vendor/highline-1.5.1/examples/limit.rb +0 -12
- data/vendor/highline-1.5.1/examples/menus.rb +0 -65
- data/vendor/highline-1.5.1/examples/overwrite.rb +0 -19
- data/vendor/highline-1.5.1/examples/page_and_wrap.rb +0 -322
- data/vendor/highline-1.5.1/examples/password.rb +0 -7
- data/vendor/highline-1.5.1/examples/trapping_eof.rb +0 -22
- data/vendor/highline-1.5.1/examples/using_readline.rb +0 -17
- data/vendor/highline-1.5.1/lib/highline.rb +0 -758
- data/vendor/highline-1.5.1/lib/highline/color_scheme.rb +0 -120
- data/vendor/highline-1.5.1/lib/highline/compatibility.rb +0 -17
- data/vendor/highline-1.5.1/lib/highline/import.rb +0 -43
- data/vendor/highline-1.5.1/lib/highline/menu.rb +0 -395
- data/vendor/highline-1.5.1/lib/highline/question.rb +0 -463
- data/vendor/highline-1.5.1/lib/highline/system_extensions.rb +0 -193
- data/vendor/highline-1.5.1/setup.rb +0 -1360
- data/vendor/highline-1.5.1/test/tc_color_scheme.rb +0 -56
- data/vendor/highline-1.5.1/test/tc_highline.rb +0 -823
- data/vendor/highline-1.5.1/test/tc_import.rb +0 -54
- data/vendor/highline-1.5.1/test/tc_menu.rb +0 -429
- data/vendor/highline-1.5.1/test/ts_all.rb +0 -15
data/CHANGES.txt
CHANGED
@@ -7,30 +7,53 @@ RUDY, CHANGES
|
|
7
7
|
* TODO: Support for product codes
|
8
8
|
* TODO: Tests for AWS HTTPS
|
9
9
|
|
10
|
+
#### 0.7.4 (2009-05-10) ###############################
|
10
11
|
|
11
|
-
|
12
|
+
* CHANGE: Keypairs now include zone. This was necessary to allow US and EU keypairs to
|
13
|
+
be stored in the same directory.
|
14
|
+
* CHANGE: Moved non-rudy specific modules to separate projects (storable, sysinfo, annoy, console -> Drydock, escape -> Rye, tryouts -> tryouts/).
|
15
|
+
* CHANGE: Renamed restart routine to reboot to make it clear it's about the machine
|
16
|
+
* CHANGE: Renamed Rudy::Disk to Rudy::MetaData::Disk
|
17
|
+
* CHANGE: Short alias for rudy-ec2 snapshot is now 's' (instead of 't')
|
18
|
+
* CHANGE: Removed highline-1.5.1 from vendor (it's now available as a gem)
|
19
|
+
* FIXED: Bug in Huxtable when loading global. Wasn't reloaded after config was updated.
|
20
|
+
* FIXED: Closed gh-12 (thanks sabat)
|
21
|
+
* ADDED: Routines now support dependencies
|
22
|
+
* ADDED: Disk routines now support mount, umount, snapshot, and restore
|
23
|
+
* ADDED: rudy disk command now displays backups with -b switch
|
24
|
+
* ADDED: RE-added basic support for creating Linux images (with security warning)
|
25
|
+
* ADDED: Routines with underscores can now be called with dashes (a_routine vs a-routine)
|
26
|
+
|
27
|
+
|
28
|
+
#### 0.7.3 (2009-05-05) ###############################
|
29
|
+
|
30
|
+
* FIXED: Corrected a few minor interface errors in rudy-ec2
|
31
|
+
* ADDED: rudy-ec2 console can now display the decoded admin password for Windows instances.
|
32
|
+
|
33
|
+
|
34
|
+
#### 0.7.2 (2009-05-04) ###############################
|
12
35
|
|
13
36
|
* FIXED: cli/routine.rb release method wasn't sending command alias (which broke rerelease)
|
14
37
|
* ADDED: global.offline for being cool when Internet is down
|
15
38
|
* ADDED: Better handling in aws/sdb when call returns nil (Internet is down)
|
16
39
|
|
17
40
|
|
18
|
-
#### 0.7.1 (2009-
|
41
|
+
#### 0.7.1 (2009-05-04) ###############################
|
19
42
|
|
20
43
|
* FIXED: rudy wasn't honouring -C option for specifying a config file
|
21
44
|
* FIXED: Was disabling, but not enabling colour
|
22
45
|
* FIXED: Symbol errors in 1.8
|
23
46
|
* FIXED: Command blocks for root user are always run first now in Routines config.
|
24
|
-
* ADDED: "script" keyword to routines config.
|
25
47
|
* CHANGE: routines before, after, and script blocks are now processed by Rye::Box.batch as Procs.
|
26
48
|
* CHANGE: deny was removed from commands config (it will come back later).
|
27
|
-
* ADDED: examples/
|
28
49
|
* CHANGE: Rudy now checks the current working directory for machines, commands, etc... configs
|
50
|
+
* ADDED: examples/
|
51
|
+
* ADDED: "script" keyword to routines config.
|
29
52
|
* ADDED: script_local
|
30
53
|
* ADDED: Routine now checks whether there are any remote tasks. If not, it doesn't loop through machines.
|
31
54
|
|
32
55
|
|
33
|
-
#### 0.7.0 (2009-
|
56
|
+
#### 0.7.0 (2009-05-02) ###############################
|
34
57
|
|
35
58
|
* CHANGE: Upgrade to Drydock 0.6, Caesars 0.6, and Rye 0.6
|
36
59
|
* CHANGE: Updated Routines configuration syntax for specifying shell commands
|
data/README.rdoc
CHANGED
@@ -87,6 +87,7 @@ NOTE: <em>If you are not installing via RubyGems, you need to make sure the depe
|
|
87
87
|
* Jamis Buck for Net::SSH and friends
|
88
88
|
* Glenn Rempe for amazon-ec2
|
89
89
|
* Marcel Molina Jr. for aws-s3
|
90
|
+
* sabat[http://github.com/sabat]
|
90
91
|
* Keshia Knight Pulliam
|
91
92
|
|
92
93
|
|
@@ -102,7 +103,6 @@ I'm very open to contributions!
|
|
102
103
|
|
103
104
|
* Delano Mandelbaum (delano@solutious.com)
|
104
105
|
* Rudy::AWS::SDB adapted from aws_sdb by Tim Dysinger (http://dysinger.net)
|
105
|
-
* Escape, Copyright (C) 2006,2007 Tanaka Akira <akr@fsij.org>
|
106
106
|
|
107
107
|
|
108
108
|
== License
|
data/Rudyfile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# = Rudy --
|
1
|
+
# = Rudy -- Skeleton configuration
|
2
2
|
#
|
3
3
|
# Rudy automatically looks for configuration files in the following
|
4
4
|
# locations (in this order):
|
@@ -7,6 +7,7 @@
|
|
7
7
|
# ~/.rudy/config
|
8
8
|
#
|
9
9
|
# ./Rudyfile
|
10
|
+
# ./machines.rb, ./routines.rb, ./commands.rb
|
10
11
|
# ./config/rudy/*.rb
|
11
12
|
# ./.rudy/*.rb
|
12
13
|
# /etc/rudy/*.rb
|
@@ -23,15 +24,14 @@
|
|
23
24
|
#
|
24
25
|
|
25
26
|
# --------------------------------------------------------- MACHINES --------
|
26
|
-
# The machines block describes the "physical" characteristics
|
27
|
-
# of your environments.
|
27
|
+
# The machines block describes the "physical" characteristics of your machines.
|
28
28
|
machines do
|
29
29
|
|
30
30
|
zone :"us-east-1b" do
|
31
|
-
ami 'ami-
|
31
|
+
ami 'ami-e348af8a' # Alestic Debian 5.0, 32-bit (US)
|
32
32
|
end
|
33
33
|
zone :"eu-west-1b" do
|
34
|
-
ami 'ami-
|
34
|
+
ami 'ami-6ecde51a' # Alestic Debian 5.0, 32-bit (EU)
|
35
35
|
end
|
36
36
|
|
37
37
|
hostname :rudy # One of: :default, :rudy, "your-name"
|
@@ -40,8 +40,7 @@ machines do
|
|
40
40
|
# The configuration inside the env block is available to all its
|
41
41
|
# roles. The configuration inside the role blocks is available only
|
42
42
|
# to machines in that specific role.
|
43
|
-
env :stage do
|
44
|
-
ami "ami-e348af8a" # Debian 5.0, 32-bit (Alestic)
|
43
|
+
env :stage, :prod do
|
45
44
|
size 'm1.small' # EC2 machine type for all machines
|
46
45
|
# in the "stage" environment
|
47
46
|
role :app do
|
@@ -103,17 +102,17 @@ end
|
|
103
102
|
# To run a routine, specify its name on the command-line: rudy startup
|
104
103
|
routines do
|
105
104
|
|
106
|
-
env :stage do
|
107
|
-
role :app do #
|
105
|
+
env :stage, :prod do # We'll define routines for the stage-app
|
106
|
+
role :app do # and prod-app machine groups
|
108
107
|
|
109
108
|
startup do # $ rudy startup
|
110
109
|
adduser :rudy # Create a user called "rudy"
|
111
110
|
authorize :rudy # Enable passwordless logins as rudy
|
112
|
-
|
111
|
+
#
|
113
112
|
disks do # Define EBS volume routines
|
114
113
|
create "/rudy/disk1" # Create an EBS volume, attach it, give
|
115
114
|
end # it a filesystem, and mount it.
|
116
|
-
|
115
|
+
#
|
117
116
|
after :rudy do # Run remote SSH commands after startup
|
118
117
|
mkdir :p, "great" # $ mkdir -p great
|
119
118
|
touch "great/scott" # $ touch great/scott
|
@@ -123,30 +122,63 @@ routines do
|
|
123
122
|
|
124
123
|
shutdown do # $ rudy shutdown
|
125
124
|
before :root do # Run remote SSH commands before shutdown
|
126
|
-
|
127
|
-
end
|
128
|
-
|
125
|
+
uptime
|
126
|
+
end
|
129
127
|
disks do
|
130
128
|
destroy "/rudy/disk1" # Unmount and destroy the EBS volume
|
131
129
|
end
|
132
130
|
end
|
133
|
-
|
131
|
+
|
132
|
+
reboot do # $ rudy reboot
|
133
|
+
before :root do # Run any pre-reboot tasks like stopping
|
134
|
+
uptime # web servers and databases.
|
135
|
+
end #
|
136
|
+
after :root do # Run any startup tasks like starting
|
137
|
+
uptime # processes or initializing the filesystem
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
backup do # $ rudy backup
|
142
|
+
disks do # A simple routine that creates an EBS
|
143
|
+
snapshot "/rudy/disk1" # snapshot of the specified volume.
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
restore_example do # $ rudy restore_example
|
148
|
+
disks do # A contrived example of restoring a
|
149
|
+
destroy "/rudy/disk1" # disk from a backup. NOTE: You'll need
|
150
|
+
restore "/rudy/disk1" # to run "rudy backup" at least once
|
151
|
+
end # before otherise there are no backups
|
152
|
+
end # to restore from.
|
153
|
+
|
134
154
|
end
|
135
155
|
end
|
136
156
|
|
137
|
-
# Define global routines available
|
138
|
-
#
|
157
|
+
# Define global routines available to all machine groups
|
158
|
+
# This routine will update a basic Debian machine and
|
159
|
+
# install essential libraries.
|
160
|
+
# See examples/ for more.
|
139
161
|
sysupdate do # $ rudy sysupdate
|
140
162
|
before :root do
|
141
163
|
apt_get "update" # Update debian / ubuntu
|
142
|
-
apt_get "install", "apache2-prefork-dev", "libapr1-dev"
|
143
164
|
apt_get "install", "build-essential", "sqlite3", "libsqlite3-dev"
|
165
|
+
apt_get "install", "apache2-prefork-dev", "libapr1-dev"
|
144
166
|
gem_install 'rudy'
|
145
167
|
end
|
146
168
|
end
|
147
169
|
|
148
|
-
# Define your own routines
|
149
170
|
anything do # $ rudy anything
|
171
|
+
before :display_uptime # Specify a dependency
|
172
|
+
script Rudy.sysinfo.user do # This is Ruby, so any valid syntax
|
173
|
+
ls :l, Rudy.sysinfo.home # can be used in the definitions.
|
174
|
+
end # See: SysInfo gem for more info.
|
150
175
|
end
|
176
|
+
|
177
|
+
display_uptime do # $ rudy display-uptime
|
178
|
+
script Rudy.sysinfo.user do # NOTE: You can use 'dashes' on the
|
179
|
+
uptime # command-line instead of underscores
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
151
183
|
end
|
152
184
|
|
data/bin/ird
ADDED
@@ -0,0 +1,153 @@
|
|
1
|
+
#!/usr/bin/ruby
|
2
|
+
|
3
|
+
# = Interactive Rudy (experimental)
|
4
|
+
#
|
5
|
+
# === Not your granparent's deployment tool
|
6
|
+
#
|
7
|
+
# See ird -h for usage
|
8
|
+
#
|
9
|
+
|
10
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') # Put our local lib in first place
|
11
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', 'vendor', 'highline-1.5.1', 'lib')
|
12
|
+
%w{drydock caesars rye}.each { |dir| $:.unshift File.join(File.dirname(__FILE__), '..', '..', dir, 'lib') }
|
13
|
+
require 'rubygems'
|
14
|
+
|
15
|
+
# SEE: http://github.com/rubyspec/matzruby/blob/a34130eb7c4ecc164115a59aa1b76c643bd98202/lib/irb/xmp.rb
|
16
|
+
# SEE: http://github.com/blackwinter/wirble/tree/master
|
17
|
+
require "irb"
|
18
|
+
require 'irb/completion'
|
19
|
+
|
20
|
+
require 'rudy'
|
21
|
+
require 'drydock'
|
22
|
+
require 'rudy/cli'
|
23
|
+
|
24
|
+
|
25
|
+
class RudyCLI_Interactive < Rudy::CLI::Base # :nodoc:all
|
26
|
+
|
27
|
+
include Readline
|
28
|
+
|
29
|
+
default :interactive
|
30
|
+
debug :off
|
31
|
+
about "An interactive REPL for Rudy."
|
32
|
+
usage "#{$0} [global options]"
|
33
|
+
command :interactive do |obj|
|
34
|
+
|
35
|
+
@@rmach = Rudy::Machines.new(:global => obj.global)
|
36
|
+
@@rkey = Rudy::KeyPairs.new(:global => obj.global)
|
37
|
+
@@rgrp = Rudy::Groups.new(:global => obj.global)
|
38
|
+
@@rvol = Rudy::Volumes.new(:global => obj.global)
|
39
|
+
@@radd = Rudy::Addresses.new(:global => obj.global)
|
40
|
+
|
41
|
+
puts Rudy::CLI.generate_header(@@rmach.global, @@rmach.config)
|
42
|
+
puts Rudy::Utils.without_indent(%Q`
|
43
|
+
------------------------------------------------------------
|
44
|
+
Welcome Interactive Rudy! (EXPERIMENTAL)
|
45
|
+
------------------------------------------------------------
|
46
|
+
|
47
|
+
`)
|
48
|
+
h
|
49
|
+
|
50
|
+
# What's the deal with this error message when defining a help method?
|
51
|
+
# => rb: warn: can't alias help from irb_help
|
52
|
+
if __FILE__ == $0
|
53
|
+
IRB.start(__FILE__)
|
54
|
+
else
|
55
|
+
# check -e option
|
56
|
+
if /^-e$/ =~ $0
|
57
|
+
IRB.start(__FILE__)
|
58
|
+
else
|
59
|
+
IRB.start(__FILE__)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
def h;
|
69
|
+
puts (%Q`
|
70
|
+
HELP
|
71
|
+
|
72
|
+
h Help (this screen)
|
73
|
+
m Rudy::Machines instance
|
74
|
+
g Rudy::Groups instance
|
75
|
+
k Rudy::KeyPairs instance
|
76
|
+
v Rudy::Volumes instance
|
77
|
+
a Rudy::Addresses instance
|
78
|
+
ssh [GROUP] Connect to a machine
|
79
|
+
example Start an EC2 instance from scratch.
|
80
|
+
`)
|
81
|
+
end
|
82
|
+
def example
|
83
|
+
puts (%Q`
|
84
|
+
EXAMPLE
|
85
|
+
Start an EC2 instance from scratch.
|
86
|
+
|
87
|
+
# Create a security group
|
88
|
+
>> g.create
|
89
|
+
=> #<Rudy::AWS::EC2::Group @name="stage-app" ...>
|
90
|
+
|
91
|
+
# Create a keypair (used to login as root)
|
92
|
+
>> k.create
|
93
|
+
=> #<Rudy::AWS::EC2::KeyPair @name="key-stage-app" ...>
|
94
|
+
|
95
|
+
# Start an EC2 machine instance:
|
96
|
+
>> m.create
|
97
|
+
Instance: i-228def51
|
98
|
+
Waiting for the instance to startup
|
99
|
+
........It's up!
|
100
|
+
|
101
|
+
# Login to the new instance
|
102
|
+
>> ssh
|
103
|
+
|
104
|
+
All commands in Rudy refer to the global defaults unless
|
105
|
+
otherwise specified. "stage" is the default environment and
|
106
|
+
"app" is the default role. You can change these with command
|
107
|
+
line arguments or by modifying the defaults in your Rudy
|
108
|
+
config file: #{@@rmach.config_dirname}
|
109
|
+
|
110
|
+
You can also specify your own names by providing
|
111
|
+
one as the first argument: g.create 'group5000'.
|
112
|
+
|
113
|
+
# List instances in stage-app
|
114
|
+
>> m.list :running
|
115
|
+
=> [#<Rudy::AWS::EC2::Instance:0x18c5888 ...>]
|
116
|
+
|
117
|
+
# Print the instance in a human readable way
|
118
|
+
>> puts m.list.first.to_s
|
119
|
+
|
120
|
+
# Print instance system console output
|
121
|
+
>> puts m.console
|
122
|
+
|
123
|
+
# Destroy ALL INSTANCES in stage-app
|
124
|
+
>> m.destroy
|
125
|
+
`)
|
126
|
+
end
|
127
|
+
|
128
|
+
def m; @@rmach; end
|
129
|
+
def k; @@rkey; end
|
130
|
+
def g; @@rgrp; end
|
131
|
+
def v; @@rvol; end
|
132
|
+
def a; @@radd; end
|
133
|
+
|
134
|
+
# Change Group
|
135
|
+
#def cg(name); end
|
136
|
+
|
137
|
+
def ssh(*args)
|
138
|
+
@@rmach.switch_user :root
|
139
|
+
@@rmach.connect(*args)
|
140
|
+
@@rmach.switch_user # back to previous user
|
141
|
+
nil
|
142
|
+
end
|
143
|
+
|
144
|
+
|
145
|
+
end
|
146
|
+
|
147
|
+
#include RudyCLI_Interactive # So we don't have to say CLI.example in the REPL.
|
148
|
+
|
149
|
+
|
150
|
+
__END__
|
151
|
+
#@rbox = Rye::Box.new('ec2-174-129-173-3.compute-1.amazonaws.com', 'root')
|
152
|
+
#@rbox2 = Rye::Box.new('ec2-174-129-173-3.compute-1.amazonaws.com', 'root')
|
153
|
+
#@rbox.add_keys('/Users/delano/Projects/git/rudy/.rudy/key-test-app.private')
|
data/bin/rudy
CHANGED
@@ -9,8 +9,7 @@
|
|
9
9
|
#
|
10
10
|
|
11
11
|
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') # Put our local lib in first place
|
12
|
-
$:.unshift File.join(File.dirname(__FILE__), '..', '
|
13
|
-
#%w{net-ssh amazon-ec2 caesars drydock rye}.each { |dir| $:.unshift File.join(File.dirname(__FILE__), '..', '..', dir, 'lib') }
|
12
|
+
$:.unshift File.join(File.dirname(__FILE__), '..', '..', 'drydock', 'lib')
|
14
13
|
#require 'rubygems'
|
15
14
|
|
16
15
|
#$SAFE = 1 # require is unsafe in Ruby 1.9??
|
@@ -19,7 +18,6 @@ require 'drydock'
|
|
19
18
|
require 'rudy'
|
20
19
|
require 'rudy/cli'
|
21
20
|
|
22
|
-
|
23
21
|
# Command-line interface for /bin/rudy
|
24
22
|
class RudyCLI < Rudy::CLI::Base
|
25
23
|
|
@@ -37,26 +35,17 @@ class RudyCLI < Rudy::CLI::Base
|
|
37
35
|
|
38
36
|
# ------------------------------------------ RUDY OBJECTS --------
|
39
37
|
# ------------------------------------------------------------------
|
40
|
-
|
41
|
-
|
42
|
-
#about "Manage Backups"
|
43
|
-
#option :s, :snapshot, String, "Create a backup entry from an existing snapshot"
|
44
|
-
#action :Z, :sync, "Check for and delete backup metadata with no snapshot. DOES NOT delete snapshots."
|
45
|
-
##action :T, :tidy, "Tidy existing backups"
|
46
|
-
#action :D, :destroy, "Destroy a backup and DELETE its snapshots."
|
47
|
-
#action :C, :create, "Create a backup"
|
48
|
-
#argv :disk
|
49
|
-
#command :'backup' => Rudy::CLI::Backups
|
50
|
-
#command_alias :backup, :bu
|
51
|
-
|
52
|
-
about "Manage Machines"
|
38
|
+
|
39
|
+
about "View Machines"
|
53
40
|
option :l, :all, "Display all machines"
|
54
41
|
action :W, :wash, "Wash machine metadata."
|
55
42
|
command :machines => Rudy::CLI::Machines
|
56
43
|
command_alias :machines, :m
|
57
44
|
|
58
|
-
about "
|
45
|
+
about "View Disks"
|
59
46
|
action :W, :wash, "Wash disk metadata."
|
47
|
+
option :b, :backups, "Display backups"
|
48
|
+
option :l, :all, "Display all disks"
|
60
49
|
command :disks => Rudy::CLI::Disks
|
61
50
|
command_alias :disks, :d
|
62
51
|
|
@@ -80,20 +69,18 @@ class RudyCLI < Rudy::CLI::Base
|
|
80
69
|
about "Startup a machine group"
|
81
70
|
usage "rudy startup"
|
82
71
|
command :startup => Rudy::CLI::Routines
|
83
|
-
command_alias :startup, :s
|
84
72
|
|
85
73
|
about "Shutdown a machine group"
|
86
74
|
usage "rudy shutdown"
|
87
75
|
command :shutdown => Rudy::CLI::Routines
|
88
76
|
|
89
|
-
|
90
|
-
|
91
|
-
|
77
|
+
about "Reboot a machine group"
|
78
|
+
usage "rudy reboot"
|
79
|
+
command :reboot => Rudy::CLI::Routines
|
92
80
|
|
93
81
|
about "Create a release"
|
94
82
|
usage "rudy release"
|
95
83
|
command :release => Rudy::CLI::Routines
|
96
|
-
command_alias :release, :r
|
97
84
|
command_alias :release, :rerelease
|
98
85
|
|
99
86
|
#about "Update the release currently running in a machine group"
|
@@ -122,10 +109,14 @@ class RudyCLI < Rudy::CLI::Base
|
|
122
109
|
argv :name
|
123
110
|
command :config => Rudy::CLI::Config
|
124
111
|
|
112
|
+
command :print_global => Rudy::CLI::Config
|
113
|
+
command_alias :print_global, :global
|
125
114
|
|
126
115
|
about "Initialize Rudy configuration"
|
127
116
|
command :init do |obj|
|
128
|
-
|
117
|
+
|
118
|
+
Rudy::Huxtable.update_config
|
119
|
+
|
129
120
|
unless File.exists?(Rudy::CONFIG_FILE)
|
130
121
|
Rudy::Config.init_config_dir
|
131
122
|
end
|
@@ -209,6 +200,10 @@ class RudyCLI < Rudy::CLI::Base
|
|
209
200
|
end
|
210
201
|
end
|
211
202
|
|
203
|
+
|
204
|
+
command :sysinfo do
|
205
|
+
puts Rudy.sysinfo.to_yaml
|
206
|
+
end
|
212
207
|
end
|
213
208
|
|
214
209
|
# We call Drydock specifically otherwise it will run at_exit. Rye also
|