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.
Files changed (132) hide show
  1. data/CHANGES.txt +110 -18
  2. data/README.rdoc +40 -44
  3. data/Rudyfile +35 -50
  4. data/bin/rudy +88 -57
  5. data/bin/rudy-ec2 +2 -16
  6. data/bin/rudy-s3 +0 -10
  7. data/bin/rudy-sdb +11 -12
  8. data/lib/rudy.rb +59 -91
  9. data/lib/rudy/aws.rb +4 -45
  10. data/lib/rudy/aws/ec2.rb +57 -20
  11. data/lib/rudy/aws/ec2/address.rb +10 -11
  12. data/lib/rudy/aws/ec2/group.rb +10 -9
  13. data/lib/rudy/aws/ec2/image.rb +8 -8
  14. data/lib/rudy/aws/ec2/instance.rb +18 -19
  15. data/lib/rudy/aws/ec2/keypair.rb +14 -19
  16. data/lib/rudy/aws/ec2/snapshot.rb +16 -9
  17. data/lib/rudy/aws/ec2/volume.rb +39 -26
  18. data/lib/rudy/aws/ec2/zone.rb +5 -4
  19. data/lib/rudy/aws/s3.rb +2 -1
  20. data/lib/rudy/aws/sdb.rb +35 -86
  21. data/lib/rudy/backups.rb +24 -0
  22. data/lib/rudy/cli.rb +5 -131
  23. data/lib/rudy/cli/aws/ec2/addresses.rb +19 -27
  24. data/lib/rudy/cli/aws/ec2/candy.rb +45 -20
  25. data/lib/rudy/cli/aws/ec2/groups.rb +9 -13
  26. data/lib/rudy/cli/aws/ec2/images.rb +5 -133
  27. data/lib/rudy/cli/aws/ec2/instances.rb +25 -25
  28. data/lib/rudy/cli/aws/ec2/keypairs.rb +7 -11
  29. data/lib/rudy/cli/aws/ec2/snapshots.rb +5 -9
  30. data/lib/rudy/cli/aws/ec2/volumes.rb +22 -23
  31. data/lib/rudy/cli/aws/ec2/zones.rb +2 -3
  32. data/lib/rudy/cli/aws/sdb/domains.rb +5 -6
  33. data/lib/rudy/cli/aws/sdb/objects.rb +33 -0
  34. data/lib/rudy/cli/aws/sdb/select.rb +23 -0
  35. data/lib/rudy/cli/backups.rb +38 -0
  36. data/lib/rudy/cli/base.rb +104 -0
  37. data/lib/rudy/cli/candy.rb +1 -2
  38. data/lib/rudy/cli/config.rb +20 -7
  39. data/lib/rudy/cli/disks.rb +7 -9
  40. data/lib/rudy/cli/execbase.rb +56 -0
  41. data/lib/rudy/cli/machines.rb +242 -45
  42. data/lib/rudy/cli/metadata.rb +24 -10
  43. data/lib/rudy/cli/networks.rb +34 -0
  44. data/lib/rudy/cli/routines.rb +32 -6
  45. data/lib/rudy/cli/status.rb +60 -0
  46. data/lib/rudy/config.rb +55 -32
  47. data/lib/rudy/config/objects.rb +44 -30
  48. data/lib/rudy/disks.rb +25 -0
  49. data/lib/rudy/exceptions.rb +99 -0
  50. data/lib/rudy/global.rb +67 -28
  51. data/lib/rudy/guidelines.rb +3 -2
  52. data/lib/rudy/huxtable.rb +67 -58
  53. data/lib/rudy/machines.rb +41 -263
  54. data/lib/rudy/metadata.rb +212 -38
  55. data/lib/rudy/metadata/backup.rb +123 -78
  56. data/lib/rudy/metadata/disk.rb +153 -170
  57. data/lib/rudy/metadata/machine.rb +179 -0
  58. data/lib/rudy/mixins.rb +2 -1
  59. data/lib/rudy/mixins/hash.rb +3 -1
  60. data/lib/rudy/mixins/symbol.rb +8 -0
  61. data/lib/rudy/routines.rb +127 -344
  62. data/lib/rudy/routines/base.rb +229 -0
  63. data/lib/rudy/routines/handlers/base.rb +48 -0
  64. data/lib/rudy/routines/handlers/depends.rb +49 -0
  65. data/lib/rudy/routines/handlers/disks.rb +249 -0
  66. data/lib/rudy/routines/handlers/group.rb +44 -0
  67. data/lib/rudy/routines/handlers/host.rb +70 -0
  68. data/lib/rudy/routines/handlers/keypair.rb +70 -0
  69. data/lib/rudy/routines/handlers/machines.rb +15 -0
  70. data/lib/rudy/routines/handlers/script.rb +85 -0
  71. data/lib/rudy/routines/handlers/user.rb +45 -0
  72. data/lib/rudy/routines/passthrough.rb +19 -23
  73. data/lib/rudy/routines/reboot.rb +98 -50
  74. data/lib/rudy/routines/shutdown.rb +65 -14
  75. data/lib/rudy/routines/startup.rb +112 -17
  76. data/lib/rudy/utils.rb +35 -68
  77. data/rudy.gemspec +82 -25
  78. data/tryouts/01_mixins/01_hash_tryouts.rb +20 -0
  79. data/tryouts/10_require_time/10_rudy_tryouts.rb +33 -0
  80. data/tryouts/10_require_time/15_global_tryouts.rb +58 -0
  81. data/tryouts/12_config/10_load_config_tryouts.rb +43 -0
  82. data/tryouts/12_config/20_defaults_tryouts.rb +16 -0
  83. data/tryouts/12_config/30_accounts_tryouts.rb +17 -0
  84. data/tryouts/12_config/40_machines_tryouts.rb +53 -0
  85. data/tryouts/12_config/50_commands_tryouts.rb +17 -0
  86. data/tryouts/12_config/60_routines_tryouts.rb +16 -0
  87. data/tryouts/15_huxtable/10_huxtable_tryouts.rb +47 -0
  88. data/tryouts/15_huxtable/20_user_tryouts.rb +47 -0
  89. data/tryouts/20_simpledb/10_domains_tryouts.rb +36 -0
  90. data/tryouts/20_simpledb/20_objects_tryouts.rb +56 -0
  91. data/tryouts/25_ec2/10_keypairs_tryouts.rb +54 -0
  92. data/tryouts/25_ec2/20_groups_tryouts.rb +56 -0
  93. data/tryouts/25_ec2/21_groups_authorize_address_tryouts.rb +53 -0
  94. data/tryouts/25_ec2/22_groups_authorize_account_tryouts.rb +54 -0
  95. data/tryouts/25_ec2/30_addresses_tryouts.rb +42 -0
  96. data/tryouts/25_ec2/40_volumes_tryouts.rb +53 -0
  97. data/tryouts/25_ec2/50_snapshots_tryouts.rb +75 -0
  98. data/tryouts/26_ec2_instances/10_instance_tryouts.rb +107 -0
  99. data/tryouts/26_ec2_instances/50_images_tryouts.rb +7 -0
  100. data/tryouts/30_metadata/10_include_tryouts.rb +45 -0
  101. data/tryouts/30_metadata/13_object_tryouts.rb +19 -0
  102. data/tryouts/30_metadata/50_disk_tryouts.rb +115 -0
  103. data/tryouts/30_metadata/51_disk_digest_tryouts.rb +24 -0
  104. data/tryouts/30_metadata/53_disk_list_tryouts.rb +35 -0
  105. data/tryouts/30_metadata/56_disk_volume_tryouts.rb +68 -0
  106. data/tryouts/30_metadata/60_backup_tryouts.rb +101 -0
  107. data/tryouts/30_metadata/63_backup_list_tryouts.rb +38 -0
  108. data/tryouts/30_metadata/64_backup_disk_tryouts.rb +65 -0
  109. data/tryouts/30_metadata/66_backup_snapshot_tryouts.rb +76 -0
  110. data/tryouts/30_metadata/70_machine_tryouts.rb +85 -0
  111. data/tryouts/30_metadata/73_machine_list_tryouts.rb +58 -0
  112. data/tryouts/30_metadata/76_machine_instance_tryouts.rb +64 -0
  113. data/tryouts/30_metadata/77_machines_tryouts.rb +45 -0
  114. data/tryouts/40_routines/10_keypair_handler_tryouts.rb +52 -0
  115. data/tryouts/40_routines/11_group_handler_tryouts.rb +36 -0
  116. data/tryouts/80_cli/10_rudyec2_tryouts.rb +8 -0
  117. data/tryouts/80_cli/60_rudy_tryouts.rb +41 -0
  118. data/tryouts/exploration/console.rb +91 -0
  119. data/tryouts/exploration/machine.rb +23 -0
  120. data/tryouts/failer +6 -0
  121. metadata +116 -32
  122. data/bin/ird +0 -153
  123. data/lib/rudy/metadata/backups.rb +0 -67
  124. data/lib/rudy/metadata/debug.rb +0 -38
  125. data/lib/rudy/metadata/disks.rb +0 -67
  126. data/lib/rudy/metadata/objectbase.rb +0 -108
  127. data/lib/rudy/routines/helper.rb +0 -76
  128. data/lib/rudy/routines/helpers/dependshelper.rb +0 -34
  129. data/lib/rudy/routines/helpers/diskhelper.rb +0 -403
  130. data/lib/rudy/routines/helpers/scripthelper.rb +0 -197
  131. data/lib/rudy/routines/helpers/userhelper.rb +0 -37
  132. data/support/rudy-ec2-startup +0 -200
@@ -2,34 +2,48 @@
2
2
 
3
3
  module Rudy
4
4
  module CLI
5
- class MetaData < Rudy::CLI::CommandBase
5
+ class Metadata < Rudy::CLI::CommandBase
6
6
 
7
+ def metadata_valid?
8
+ @option.rtype ||= 'm'
9
+ @metaobj = Rudy::Metadata.get_rclass @option.rtype
10
+ true
11
+ end
7
12
 
8
13
  def metadata
9
- more, less = [], []
10
- less = [:environment, :role, :zone, :region] if @option.all
11
- more += [:rtype, @option.otype] if @option.otype
14
+ unless @argv.empty?
15
+ h = Rudy::Metadata.get(@argv.first)
16
+ return if h.nil?
17
+ @metaobj = Rudy::Metadata.get_rclass h['rtype'].first
18
+ objlist = Hash[@argv.first => @metaobj.from_hash(h)]
19
+ else
20
+ more, less = {}, []
21
+ less = [:environment, :role, :zone, :region, :position] if @option.all
22
+ objlist = @metaobj.list_as_hash(more, less) || {}
23
+ end
12
24
 
13
- rdebug = Rudy::MetaData::Debug.new
14
- objlist = rdebug.list(more, less) || []
15
- objlist.each do |o|
16
- p o
25
+ objlist.each_pair do |k,o|
26
+ puts "#{k}: " << o.inspect
17
27
  end
18
28
  end
19
29
 
20
30
  def metadata_delete_valid?
21
31
  raise "Must supply object ID" unless @argv.oid
32
+ raise Rudy::Metadata::UnknownObject, @argv.oid unless Rudy::Metadata.exists? @argv.oid
22
33
  true
23
34
  end
24
35
 
25
36
  def metadata_delete
26
- rdebug = Rudy::MetaData::Debug.new
37
+
27
38
  unless @@global.quiet
28
39
  msg = "NOTE: This will delete only the metadata and "
29
40
  msg << "not the EC2 object (volume, instance, etc...)"
30
41
  puts msg
31
42
  end
32
- p rdebug.get( @argv.oid)
43
+
44
+ execute_check(:medium)
45
+
46
+ Rudy::Metadata.destroy @argv.oid
33
47
  end
34
48
 
35
49
  end
@@ -0,0 +1,34 @@
1
+
2
+
3
+ module Rudy
4
+ module CLI
5
+ class Networks < Rudy::CLI::CommandBase
6
+
7
+ def networks
8
+ name = current_group_name
9
+ Rudy::AWS::EC2::Groups.list(name).each do |group|
10
+ puts @@global.verbose > 0 ? group.inspect : group.dump(@@global.format)
11
+ end
12
+ end
13
+
14
+ def update_networks
15
+ Rudy::Routines::Handlers::Group.authorize rescue nil
16
+ end
17
+
18
+ def local_networks
19
+ ea = Rudy::Utils::external_ip_address || ''
20
+ ia = Rudy::Utils::internal_ip_address || ''
21
+ if @global.quiet
22
+ puts ia unless @option.external && !@option.internal
23
+ puts ea unless @option.internal && !@option.external
24
+ else
25
+ puts "%10s: %s" % ['Internal', ia] unless @option.external && !@option.internal
26
+ puts "%10s: %s" % ['External', ea] unless @option.internal && !@option.external
27
+ end
28
+ @global.quiet = true # don't print elapsed time
29
+ end
30
+
31
+ end
32
+
33
+ end
34
+ end
@@ -3,6 +3,30 @@
3
3
  module Rudy; module CLI;
4
4
  class Routines < Rudy::CLI::CommandBase
5
5
 
6
+ def routines_valid?
7
+ raise Rudy::NoRoutinesConfig unless @@config.routines
8
+ true
9
+ end
10
+
11
+ def routines
12
+ if @@config.nil? || @@config.empty?
13
+ return if @@global.quiet
14
+ raise Rudy::NoConfig
15
+ end
16
+
17
+ if @option.all
18
+ routine = @@config.routines
19
+ else
20
+ routine = {}
21
+ routine.merge! @@config.routines.find_deferred(@@global.environment, @@global.role) || {}
22
+ routine.merge! @@config.routines.find(@@global.role) || {}
23
+ end
24
+
25
+ outform = @@global.format == :json ? :to_json : :to_yaml
26
+
27
+ puts routine.to_hash.send(outform)
28
+ end
29
+
6
30
  def startup_valid?
7
31
  @rr = Rudy::Routines::Startup.new(@alias, @option, @argv)
8
32
  @rr.raise_early_exceptions
@@ -12,7 +36,7 @@ module Rudy; module CLI;
12
36
  machines = @rr.execute || []
13
37
  puts $/, "The following machines are now available:" unless machines.empty?
14
38
  machines.each do |machine|
15
- puts @@global.verbose > 2 ? machine.inspect : machine.dump(@@global.format)
39
+ puts machine
16
40
  end
17
41
  end
18
42
 
@@ -25,7 +49,7 @@ module Rudy; module CLI;
25
49
  machines = @rr.execute
26
50
  puts $/, "The following machines have been restarted:"
27
51
  machines.each do |machine|
28
- puts @@global.verbose > 2 ? machine.inspect : machine.dump(@@global.format)
52
+ puts machine
29
53
  end
30
54
  end
31
55
 
@@ -48,12 +72,13 @@ module Rudy; module CLI;
48
72
  # raise an exception.
49
73
  #
50
74
  def passthrough
75
+
51
76
  machines = @rr.execute
52
77
 
53
- unless machines.empty?
78
+ if @global.verbose > 1 && !machines.empty?
54
79
  puts $/, "The following machines were processed:"
55
80
  machines.each do |machine|
56
- puts @@global.verbose > 2 ? machine.inspect : machine.dump(@@global.format)
81
+ puts machine
57
82
  end
58
83
  end
59
84
 
@@ -65,7 +90,7 @@ module Rudy; module CLI;
65
90
  true
66
91
  end
67
92
  def shutdown
68
- routine = fetch_routine_config(:shutdown)
93
+ routine = fetch_routine_config(:shutdown) rescue {}
69
94
 
70
95
  puts "All machines in #{current_machine_group} will be shutdown".bright
71
96
  if routine && routine.disks
@@ -78,9 +103,10 @@ module Rudy; module CLI;
78
103
  execute_check :medium
79
104
 
80
105
  machines = @rr.execute
106
+
81
107
  puts $/, "The following instances have been destroyed:"
82
108
  machines.each do |machine|
83
- puts '%s %s ' % [machine.name.bright, machine.awsid]
109
+ puts '%s %s ' % [machine.name.bright, machine.instid]
84
110
  end
85
111
 
86
112
 
@@ -0,0 +1,60 @@
1
+
2
+
3
+ module Rudy
4
+ module CLI
5
+ class Status < Rudy::CLI::CommandBase
6
+
7
+ def status
8
+ process_region @@global.region
9
+ oregions = Rudy::AWS::VALID_REGIONS - [@@global.region.to_sym]
10
+ if @option.all
11
+ oregions.each do |region|
12
+ Rudy::AWS::EC2.connect @@global.accesskey, @@global.secretkey, region
13
+ process_region region
14
+ end
15
+ else
16
+ puts $/, "Other regions: " << oregions.join(', ')
17
+ end
18
+ end
19
+
20
+
21
+ private
22
+ def process_region(region)
23
+ puts " Region: %s %30s".att(:reverse) % [region, '']
24
+ puts " Instances".bright
25
+ istatus = @option.all ? :any : :running
26
+ (Rudy::AWS::EC2::Instances.list(istatus) || []).collect do |inst|
27
+ puts " %s (%s): %s; %s; %s" % [inst.awsid, inst.state, inst.dns_public || '[no dns]', inst.size, inst.created]
28
+ end
29
+
30
+ puts " Volumes".bright
31
+ (Rudy::AWS::EC2::Volumes.list || []).collect do |vol|
32
+ puts " %s (%s): %sGB; %s" % [vol.awsid, vol.instid || vol.status, vol.size, vol.created]
33
+ end
34
+
35
+ puts " Snapshots".bright
36
+ (Rudy::AWS::EC2::Snapshots.list || []).collect do |snap|
37
+ puts " %s: %s; %s" % [snap.awsid, snap.volid, snap.created]
38
+ end
39
+
40
+ puts " Addresses".bright
41
+ (Rudy::AWS::EC2::Addresses.list || []).collect do |o|
42
+ puts " %s (%s)" % [o.ipaddress, o.instid || 'available']
43
+ end
44
+
45
+ puts " Groups".bright
46
+ puts (Rudy::AWS::EC2::Groups.list || []).collect { |o| " #{o.name}" }
47
+
48
+ puts " Keypairs".bright
49
+ puts (Rudy::AWS::EC2::Keypairs.list || []).collect { |o| " #{o.name}" }
50
+
51
+ puts " Images".bright
52
+ (Rudy::AWS::EC2::Images.list('self') || []).collect do |o|
53
+ puts " %s: %s; %s; %s" % [o.awsid, o.location, o.arch, o.visibility]
54
+ end
55
+ puts
56
+ end
57
+
58
+ end
59
+ end
60
+ end
data/lib/rudy/config.rb CHANGED
@@ -10,19 +10,13 @@ module Rudy
10
10
  dsl Rudy::Config::Routines::DSL # Organized processes
11
11
  dsl Rudy::Config::Machines::DSL # Organized instances
12
12
  dsl Rudy::Config::Commands::DSL # Custom SSH commands
13
- #dsl Rudy::Config::Networks::DSL # Network design
14
- #dsl Rudy::Config::Controls::DSL # Network access
15
- #dsl Rudy::Config::Services::DSL # Stuff running on ports
16
-
17
- def accounts?; self.respond_to?(:accounts) && !self[:accounts].nil?; end #a
18
- def defaults?; self.respond_to?(:defaults) && !self[:defaults].nil?; end #u
19
- def machines?; self.respond_to?(:machines) && !self[:machines].nil?; end #t
20
- def commands?; self.respond_to?(:commands) && !self[:commands].nil?; end #o
21
- def routines?; self.respond_to?(:routines) && !self[:routines].nil?; end #g
22
- #def networks?; self.respond_to?(:networks) && !self[:networks].nil?; end #e
23
- #def controls?; self.respond_to?(:controls) && !self[:controls].nil?; end #n
24
- #def services?; self.respond_to?(:services) && !self[:services].nil?; end #!
25
13
 
14
+ def accounts?; self.respond_to?(:accounts) && !self[:accounts].nil?; end
15
+ def defaults?; self.respond_to?(:defaults) && !self[:defaults].nil?; end
16
+ def machines?; self.respond_to?(:machines) && !self[:machines].nil?; end
17
+ def commands?; self.respond_to?(:commands) && !self[:commands].nil?; end
18
+ def routines?; self.respond_to?(:routines) && !self[:routines].nil?; end
19
+
26
20
  # This method is called by Caesars::Config.refresh for every DSL
27
21
  # file that is loaded and parsed. If we want to run processing
28
22
  # for a particular config (machines, @routines, etc...) we can
@@ -50,6 +44,30 @@ module Rudy
50
44
  @defaults = Rudy::Config::Defaults.new if @defaults.nil?
51
45
  end
52
46
 
47
+ # Looks for a loads configuration files from standard locations.
48
+ # ./.rudy/config
49
+ # ~/.rudy/config
50
+ #
51
+ # ~/.rudy/*.rb
52
+ # ./Rudyfile
53
+ # ./machines.rb, ./routines.rb, ./commands.rb
54
+ # ./config/rudy/*.rb
55
+ # ./.rudy/*.rb
56
+ # /etc/rudy/*.rb
57
+ #
58
+ # When multuple files are found, the configuration is NOT OVERRIDDEN,
59
+ # it's ADDED or APPENDED depending on context. This means you can split
60
+ # configuration across as many files as you please.
61
+ #
62
+ # There are five sections: accounts, defaults, machines, commands and routines.
63
+ #
64
+ # By convention, accounts go in ./.rudy/config or ~/.rudy/config
65
+ # machines, commands, routines, and defaults configuration go in ./Rudyfile or
66
+ # into separate files in ./.rudy or ./config/rudy (machines.rb, commands.rb, ...)
67
+ #
68
+ # If +adhoc_path+ is supplied (e.g. rudy -C config/file/path routines), this method
69
+ # will look for ~/.rudy/config or ./.rudy/config but none of the other default file
70
+ # locations other than the supplied path. If it's an Array, all paths will be loaded.
53
71
  def look_and_load(adhoc_path=nil)
54
72
  cwd = Dir.pwd
55
73
  cwd_path = File.join(cwd, '.rudy', 'config')
@@ -58,23 +76,28 @@ module Rudy
58
76
  # The "core" config file can have any or all configuration
59
77
  # but it should generally only contain the access identifiers
60
78
  # and defaults. That's why we only load one of them.
61
- core_config_paths = [adhoc_path, cwd_path, Rudy::CONFIG_FILE]
79
+ core_config_paths = [cwd_path, Rudy::CONFIG_FILE]
62
80
  core_config_paths.each do |path|
63
81
  next unless path && File.exists?(path)
64
82
  @paths << path
65
83
  break
66
84
  end
67
85
 
68
- typelist = self.keys.collect { |g| "#{g}.rb" }.join(',')
86
+ if adhoc_path.nil?
87
+ # self.keys returns the current config types (machines, routines, etc...)
88
+ typelist = self.keys.collect { |g| "#{g}.rb" }.join(',')
69
89
 
70
- # Rudy then looks for the rest of the config in these locations
71
- @paths += Dir.glob(File.join(Rudy.sysinfo.home, '.rudy', '*.rb')) || []
72
- @paths += Dir.glob(File.join(cwd, 'Rudyfile')) || []
73
- @paths += Dir.glob(File.join(cwd, 'config', 'rudy', '*.rb')) || []
74
- @paths += Dir.glob(File.join(cwd, '.rudy', '*.rb')) || []
75
- @paths += Dir.glob(File.join(cwd, "{#{typelist}}")) || []
76
- @paths += Dir.glob(File.join('/etc', 'rudy', '*.rb')) || []
77
- @paths &&= @paths.uniq
90
+ # Rudy then looks for the rest of the config in these locations
91
+ @paths += Dir.glob(File.join(Rudy.sysinfo.home, '.rudy', '*.rb')) || []
92
+ @paths += Dir.glob(File.join(cwd, 'Rudyfile')) || []
93
+ @paths += Dir.glob(File.join(cwd, 'config', 'rudy', '*.rb')) || []
94
+ @paths += Dir.glob(File.join(cwd, '.rudy', '*.rb')) || []
95
+ @paths += Dir.glob(File.join(cwd, "{#{typelist}}")) || []
96
+ @paths += Dir.glob(File.join('/etc', 'rudy', '*.rb')) || []
97
+ @paths &&= @paths.uniq
98
+ else
99
+ @paths += [adhoc_path].flatten
100
+ end
78
101
 
79
102
  refresh
80
103
  end
@@ -89,18 +112,18 @@ module Rudy
89
112
 
90
113
  unless File.exists?(Rudy::CONFIG_FILE)
91
114
  puts "Creating #{Rudy::CONFIG_FILE}"
92
- rudy_config = Rudy::Utils.without_indent %Q{
93
- accounts do # Account Access Indentifiers
94
- aws do # amazon web services
115
+ rudy_config = Rudy::Utils.without_indent %Q`
116
+ accounts { # Account Access Indentifiers
117
+ aws { # amazon web services
95
118
  name "Rudy Default"
96
- accountnum ""
97
- accesskey ""
98
- secretkey ""
99
- privatekey "~/path/2/pk-xxxx.pem"
119
+ accountnum "012345678912"
120
+ accesskey "ACCESSACCESS"
121
+ secretkey "SECRETSECRET"
122
+ pkey "~/path/2/pk-xxxx.pem"
100
123
  cert "~/path/2/cert-xxxx.pem"
101
- end
102
- end
103
- }
124
+ }
125
+ }
126
+ `
104
127
  Rudy::Utils.write_to_file(Rudy::CONFIG_FILE, rudy_config, 'w', 0600)
105
128
  end
106
129
  end
@@ -9,6 +9,8 @@ class Rudy::Config
9
9
  end
10
10
 
11
11
  class Accounts < Caesars
12
+ include Gibbler::Complex
13
+
12
14
  def valid?
13
15
  (!aws.nil? && !aws.accesskey.nil? && !aws.secretkey.nil?) &&
14
16
  (!aws.account.empty? && !aws.accesskey.empty? && !aws.secretkey.empty?)
@@ -18,6 +20,8 @@ class Rudy::Config
18
20
  # Default configuration. All of the defaults can be overridden
19
21
  # on the command line with global options.
20
22
  class Defaults < Caesars
23
+ include Gibbler::Complex
24
+
21
25
  class DoubleDefined < Rudy::Config::Error
22
26
  def message; "Check your defaults config. '#{@obj}' has been defined twice"; end
23
27
  end
@@ -29,10 +33,14 @@ class Rudy::Config
29
33
  next unless self[k].is_a?(Array)
30
34
  raise Defaults::DoubleDefined.new(:defaults, k)
31
35
  end
36
+ self.keydir &&= File.expand_path(self.keydir)
32
37
  end
33
38
  end
34
39
 
35
- class Machines < Caesars; end
40
+ class Machines < Caesars
41
+ include Gibbler::Complex
42
+
43
+ end
36
44
 
37
45
  # Modify the SSH command available in routines. The default
38
46
  # set of commands is defined by Rye::Cmd (Rudy executes all
@@ -42,6 +50,8 @@ class Rudy::Config
42
50
  # important that new keywords do not conflict with existing
43
51
  # Rudy keywords. Strange things may happen!
44
52
  class Commands < Caesars
53
+ include Gibbler::Complex
54
+
45
55
  class AlreadyDefined < Rudy::Config::Error
46
56
  def message; "The command '#{@obj}' has already been defined for this project"; end
47
57
  end
@@ -102,12 +112,12 @@ class Rudy::Config
102
112
  # We can allow existing commands to be overridden but we
103
113
  # print a message to STDERR so the user knows what's up.
104
114
  if Rye::Cmd.can?(cmd)
105
- STDERR.puts "Redefining #{cmd}" #if @@global.verbose > 0
115
+ STDERR.puts "Redefining #{cmd}" if Rudy::Huxtable.global.verbose > 2
106
116
  end
107
117
 
108
118
  if args.last.is_a?(Proc)
109
119
  block = args.pop
110
- Rye::Cmd.add_command(cmd, nil, args, &block)
120
+ Rye::Cmd.add_command(cmd, nil, *args, &block)
111
121
  else
112
122
  # If no path was specified, we can assume cmd is in the remote path so
113
123
  # when we add the method to Rye::Cmd, we'll it the path is "cmd".
@@ -115,7 +125,7 @@ class Rudy::Config
115
125
 
116
126
  raise PathNotString.new(:commands, cmd) if path && !path.is_a?(String)
117
127
 
118
- Rye::Cmd.add_command cmd, path, args
128
+ Rye::Cmd.add_command cmd, path, *args
119
129
 
120
130
  end
121
131
 
@@ -137,6 +147,11 @@ class Rudy::Config
137
147
  end
138
148
 
139
149
  class Routines < Caesars
150
+ include Gibbler::Complex
151
+
152
+ # All routines
153
+ forced_array :before
154
+ forced_array :after
140
155
 
141
156
  # Disk routines
142
157
  forced_hash :create
@@ -147,37 +162,36 @@ class Rudy::Config
147
162
  forced_hash :mount
148
163
  forced_hash :attach
149
164
  forced_hash :detach
150
- forced_hash :snapshot
165
+ forced_hash :archive
151
166
  forced_hash :restore
167
+ forced_hash :format
152
168
 
153
- # Script blocks
154
- forced_hash :before
155
- forced_hash :after
156
- forced_hash :script_local
157
- forced_hash :before_local
158
- forced_hash :after_local # We force hash the script keywords b/c
159
- forced_hash :script # we want them to store the usernames
160
- chill :before # as hash keys.
161
- chill :after # We also chill them b/c we want to execute
162
- chill :before_local # the command blocks with an instance_eval
163
- chill :after_local # inside a Rye::Box object.
164
- chill :script
165
- chill :script_local
166
-
167
- # Version control systems
168
- forced_hash :git
169
- forced_hash :svn
170
-
169
+ # Passthrough routines
170
+ forced_hash :local # Force hash b/c we want to
171
+ forced_hash :remote # store the usernames.
172
+ chill :local # Chill b/c we want to execute
173
+ chill :remote # the blocks with Rye::Box#batch
174
+ forced_hash :xlocal
175
+ forced_hash :xremote
176
+ chill :xlocal
177
+ chill :xremote
178
+
179
+ forced_hash :network
180
+ chill :network
181
+
182
+ # Startup, Shutdown, Reboot routines
183
+ forced_hash :before_local
184
+ forced_hash :before_remote
185
+ forced_hash :after_local
186
+ forced_hash :after_remote
187
+ chill :before_local
188
+ chill :before_remote
189
+ chill :after_local
190
+ chill :after_remote
191
+
171
192
  def init
172
193
  end
173
194
 
174
195
  end
175
196
 
176
-
177
- class Networks < Caesars #:nodoc:all
178
- end
179
- class Controls < Caesars #:nodoc:all
180
- end
181
- class Services < Caesars #:nodoc:all
182
- end
183
197
  end