Permalink
Browse files

reformat tabs to spaces

  • Loading branch information...
1 parent 09119be commit 5479114065157708cfa78ad0ac6aeae84188d574 @ryandoyle committed Jul 1, 2013
Showing with 590 additions and 590 deletions.
  1. +25 −25 bin/mcc-add-key
  2. +26 −26 bin/mcc-destroy-instance
  3. +29 −29 bin/mcc-destroy-key
  4. +11 −11 bin/mcc-list-images
  5. +16 −16 bin/mcc-list-instance-types
  6. +31 −31 bin/mcc-list-instances
  7. +14 −14 bin/mcc-list-keys
  8. +38 −38 bin/mcc-run-instances
  9. +14 −14 lib/mcc.rb
  10. +36 −36 lib/mcc/client.rb
  11. +51 −51 lib/mcc/keystore.rb
  12. +235 −235 lib/mcc/openvz.rb
  13. +18 −18 lib/mcc/server.rb
  14. +46 −46 sbin/mcserver
View
@@ -11,36 +11,36 @@ require File.expand_path(
@options = Hash.new
opts = OptionParser.new do |opts|
- opts.banner = "Usage: mcc-add-key -n NAME -p PUBKEY"
- opts.separator "Add a public SSH key to the minicloud keystore"
- opts.separator ""
- opts.separator "Options:"
- opts.on("-n", "--name KEYNAME", "Name assigned to the public key") do |k|
- @options[:keyname] = k
- end
- opts.on("-p", "--public-key PUBKEY", "The full public key string") do |k|
- @options[:pub] = k
- end
- opts.on("-h", "--help", "This help screen") do
- print opts
- exit
- end
- opts.separator ""
- opts.separator "Example:"
- opts.separator ""
- opts.separator "$ mcc-add-key --name my-key --public-key \"ssh-rsa AAAAB3NzaC1yc2.....aQ== me@exmaple.com\""
+ opts.banner = "Usage: mcc-add-key -n NAME -p PUBKEY"
+ opts.separator "Add a public SSH key to the minicloud keystore"
+ opts.separator ""
+ opts.separator "Options:"
+ opts.on("-n", "--name KEYNAME", "Name assigned to the public key") do |k|
+ @options[:keyname] = k
+ end
+ opts.on("-p", "--public-key PUBKEY", "The full public key string") do |k|
+ @options[:pub] = k
+ end
+ opts.on("-h", "--help", "This help screen") do
+ print opts
+ exit
+ end
+ opts.separator ""
+ opts.separator "Example:"
+ opts.separator ""
+ opts.separator "$ mcc-add-key --name my-key --public-key \"ssh-rsa AAAAB3NzaC1yc2.....aQ== me@exmaple.com\""
end
# Parse and check the required arguments
begin
- opts.parse!
- raise OptionParser::MissingArgument if @options[:keyname].nil?
- raise OptionParser::MissingArgument if @options[:pub].nil?
+ opts.parse!
+ raise OptionParser::MissingArgument if @options[:keyname].nil?
+ raise OptionParser::MissingArgument if @options[:pub].nil?
rescue OptionParser::InvalidOption, OptionParser::MissingArgument
- puts $!.to_s
- puts ""
- puts opts
- exit 1
+ puts $!.to_s
+ puts ""
+ puts opts
+ exit 1
end
key = MCC::Keystore.new.add_key(@options[:keyname], @options[:pub])
View
@@ -11,45 +11,45 @@ require File.expand_path(
@options = Hash.new
opts = OptionParser.new do |opts|
- opts.banner = "Usage: mcc-destroy-instance -i INSTANCE"
- opts.separator "Destroy a mcc instance"
- opts.separator ""
- opts.separator "Options:"
- opts.separator ""
- opts.on("-i", "--instance ID", "The instance ID") do |a|
- @options[:id] = a
- end
- opts.on("-h", "--help", "This help screen") do
- print opts
- exit
- end
- opts.separator ""
- opts.separator "Example:"
- opts.separator ""
- opts.separator "$ mcc-destroy-instance -i 500"
+ opts.banner = "Usage: mcc-destroy-instance -i INSTANCE"
+ opts.separator "Destroy a mcc instance"
+ opts.separator ""
+ opts.separator "Options:"
+ opts.separator ""
+ opts.on("-i", "--instance ID", "The instance ID") do |a|
+ @options[:id] = a
+ end
+ opts.on("-h", "--help", "This help screen") do
+ print opts
+ exit
+ end
+ opts.separator ""
+ opts.separator "Example:"
+ opts.separator ""
+ opts.separator "$ mcc-destroy-instance -i 500"
end
# Parse and check the required arguments
begin
- opts.parse!
- raise OptionParser::MissingArgument if @options[:id].nil?
+ opts.parse!
+ raise OptionParser::MissingArgument if @options[:id].nil?
rescue OptionParser::InvalidOption, OptionParser::MissingArgument
- puts $!.to_s
- puts ""
- puts opts
- exit 1
+ puts $!.to_s
+ puts ""
+ puts opts
+ exit 1
end
if ENV['MCC_SERVER'].nil?
- puts "MCC_SERVER environment variable is not defined."
- exit 1
+ puts "MCC_SERVER environment variable is not defined."
+ exit 1
end
begin
- mcc = MCC::Client.new(ENV['MCC_SERVER']).destroy_instance(@options[:id])
+ mcc = MCC::Client.new(ENV['MCC_SERVER']).destroy_instance(@options[:id])
rescue XMLRPC::FaultException # Can't get the exact exception, probably an invalid ID
- puts "Instance ID " + @options[:id] + " not found"
+ puts "Instance ID " + @options[:id] + " not found"
end
View
@@ -13,42 +13,42 @@ require File.expand_path(
@options = Hash.new
opts = OptionParser.new do |opts|
- opts.banner = "Usage: mcc-destroy-key -n KEYNAME"
- opts.separator "Removes an SSH key stored in a MiniCloud keystore"
- opts.separator ""
- opts.separator "Options:"
- opts.on("-n", "--name KEYNAME", "Name of the public key") do |k|
- @options[:keyname] = k
- end
- opts.on("-h", "--help", "This help screen") do
- print opts
- exit
- end
- opts.separator ""
- opts.separator "Example:"
- opts.separator ""
- opts.separator "$ mcc-destroy-key -n my-key"
- opts.separator ""
- opts.separator "Notes:"
- opts.separator ""
- opts.separator "- This does not alter any keys in ~/.ssh. MiniCloud stores it's own copy of"
- opts.separator " keys in ~/.mcc/keys. Destroying keys will only alter ~/.mcc/keys"
+ opts.banner = "Usage: mcc-destroy-key -n KEYNAME"
+ opts.separator "Removes an SSH key stored in a MiniCloud keystore"
+ opts.separator ""
+ opts.separator "Options:"
+ opts.on("-n", "--name KEYNAME", "Name of the public key") do |k|
+ @options[:keyname] = k
+ end
+ opts.on("-h", "--help", "This help screen") do
+ print opts
+ exit
+ end
+ opts.separator ""
+ opts.separator "Example:"
+ opts.separator ""
+ opts.separator "$ mcc-destroy-key -n my-key"
+ opts.separator ""
+ opts.separator "Notes:"
+ opts.separator ""
+ opts.separator "- This does not alter any keys in ~/.ssh. MiniCloud stores it's own copy of"
+ opts.separator " keys in ~/.mcc/keys. Destroying keys will only alter ~/.mcc/keys"
end
# Parse and check the required arguments
begin
- opts.parse!
- raise OptionParser::MissingArgument if @options[:keyname].nil?
+ opts.parse!
+ raise OptionParser::MissingArgument if @options[:keyname].nil?
rescue OptionParser::InvalidOption, OptionParser::MissingArgument
- puts $!.to_s
- puts ""
- puts opts
- exit 1
+ puts $!.to_s
+ puts ""
+ puts opts
+ exit 1
end
begin
- key = MCC::Keystore.new.del_key(@options[:keyname])
+ key = MCC::Keystore.new.del_key(@options[:keyname])
rescue => e
- puts e.message
+ puts e.message
end
-
+
View
@@ -13,20 +13,20 @@ require File.expand_path(
@options = Hash.new
opts = OptionParser.new do |opts|
- opts.banner = "Usage: mcc-list-images"
- opts.separator "List MiniCloud images"
- opts.separator ""
- opts.separator "Options:"
- opts.on("-h", "--help", "This help screen") do
- print opts
- exit
- end
+ opts.banner = "Usage: mcc-list-images"
+ opts.separator "List MiniCloud images"
+ opts.separator ""
+ opts.separator "Options:"
+ opts.on("-h", "--help", "This help screen") do
+ print opts
+ exit
+ end
end
opts.parse!
if ENV['MCC_SERVER'].nil?
- puts "MCC_SERVER environment variable is not defined."
- exit 1
+ puts "MCC_SERVER environment variable is not defined."
+ exit 1
end
@@ -37,5 +37,5 @@ image = mcc.get_images
# Print out a heading and the images
image.each do |img|
- puts "IMAGE \t" + img
+ puts "IMAGE \t" + img
end
@@ -13,28 +13,28 @@ require File.expand_path(
@options = Hash.new
opts = OptionParser.new do |opts|
- opts.banner = "Usage: mcc-list-instance-types"
- opts.separator "List MiniCloud instance types"
- opts.separator ""
- opts.separator "Options:"
- opts.on("-h", "--help", "This help screen") do
- print opts
- exit
- end
+ opts.banner = "Usage: mcc-list-instance-types"
+ opts.separator "List MiniCloud instance types"
+ opts.separator ""
+ opts.separator "Options:"
+ opts.on("-h", "--help", "This help screen") do
+ print opts
+ exit
+ end
end
begin
- opts.parse!
+ opts.parse!
rescue OptionParser::InvalidOption, OptionParser::MissingArgument
- puts $!.to_s
- puts ""
- puts opts
- exit 1
+ puts $!.to_s
+ puts ""
+ puts opts
+ exit 1
end
if ENV['MCC_SERVER'].nil?
- puts "MCC_SERVER environment variable is not defined."
- exit 1
+ puts "MCC_SERVER environment variable is not defined."
+ exit 1
end
@@ -44,5 +44,5 @@ types = mcc.get_instance_types
# Print out a heading and the images
types.each do |type|
- puts "INST_TYPE\t" + type
+ puts "INST_TYPE\t" + type
end
View
@@ -13,57 +13,57 @@ require File.expand_path(
@options = Hash.new
opts = OptionParser.new do |opts|
- opts.banner = "Usage: mcc-list-instances [OPTIONS]"
- opts.separator "List MiniCloud instances"
- opts.separator ""
- opts.separator "Options:"
- opts.separator ""
- opts.on("-a", "--all", "Shows running and stopped instances") do
- @options[:all] = true
- end
- opts.on("-i", "--instance ID", "Only show a specific instance ID") do |a|
- @options[:instance] = a
- end
- opts.on("-h", "--help", "This help screen") do
- print opts
- exit
- end
+ opts.banner = "Usage: mcc-list-instances [OPTIONS]"
+ opts.separator "List MiniCloud instances"
+ opts.separator ""
+ opts.separator "Options:"
+ opts.separator ""
+ opts.on("-a", "--all", "Shows running and stopped instances") do
+ @options[:all] = true
+ end
+ opts.on("-i", "--instance ID", "Only show a specific instance ID") do |a|
+ @options[:instance] = a
+ end
+ opts.on("-h", "--help", "This help screen") do
+ print opts
+ exit
+ end
end
begin
- opts.parse!
+ opts.parse!
rescue OptionParser::InvalidOption, OptionParser::MissingArgument
- puts $!.to_s
- puts ""
- puts opts
- exit 1
+ puts $!.to_s
+ puts ""
+ puts opts
+ exit 1
end
if ENV['MCC_SERVER'].nil?
- puts "MCC_SERVER environment variable is not defined."
- exit 1
+ puts "MCC_SERVER environment variable is not defined."
+ exit 1
end
mcc = MCC::Client.new(ENV['MCC_SERVER'])
if @options[:instance]
- instances = mcc.get_instances(:instance => @options[:instance])
+ instances = mcc.get_instances(:instance => @options[:instance])
elsif @options[:all]
- instances = mcc.get_instances(:all => true)
+ instances = mcc.get_instances(:all => true)
else
- instances = mcc.get_instances
+ instances = mcc.get_instances
end
# Print out a heading and the instances
puts "\t\tID\tIP\t\tSTATUS\t\tTEMPLATE\t\t\tNAME"
instances.each do |inst|
- # Fix the formatting for stopped instances
- if inst['ip'].eql?('-')
- puts "INSTANCE\t" + inst['id'] + "\t" + inst['ip'] + "\t\t" + inst['status'] + "\t\t" + inst['ostemplate'] + "\t\t" + inst['name']
- else
- puts "INSTANCE\t" + inst['id'] + "\t" + inst['ip'] + "\t" + inst['status'] + "\t\t" + inst['ostemplate'] + "\t\t" + inst['name']
- end
+ # Fix the formatting for stopped instances
+ if inst['ip'].eql?('-')
+ puts "INSTANCE\t" + inst['id'] + "\t" + inst['ip'] + "\t\t" + inst['status'] + "\t\t" + inst['ostemplate'] + "\t\t" + inst['name']
+ else
+ puts "INSTANCE\t" + inst['id'] + "\t" + inst['ip'] + "\t" + inst['status'] + "\t\t" + inst['ostemplate'] + "\t\t" + inst['name']
+ end
end
Oops, something went wrong.

0 comments on commit 5479114

Please sign in to comment.