Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: lib/brightbox-cli/vendor/fog/lib/fog/compute/models/brightbox/account.rb
- Loading branch information
Showing
1,222 changed files
with
9,854 additions
and
1,936 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module Brightbox | ||
desc 'update Cloud IPs' | ||
arg_name 'cloudip-id' | ||
command [:update] do |c| | ||
c.desc "Set reverse DNS for this cloud ip" | ||
c.flag [:r, "reverse-dns"] | ||
|
||
c.desc "Delete the reverse dns for this cloud ip" | ||
c.switch ["delete-reverse-dns"] | ||
|
||
c.action do |global_options,options,args| | ||
cip_id = args.shift | ||
raise "You must specify the cloud ip id as the first argument" unless cip_id =~ /^cip-/ | ||
|
||
if options[:r] && options[:r] != "" && options[:"delete-reverse-dns"] | ||
raise "You must either specify a reverse dns record or --delete-reverse-dns" | ||
end | ||
|
||
cip = CloudIP.find cip_id | ||
|
||
params = {} | ||
if options[:r] | ||
params[:reverse_dns] = options[:r] | ||
end | ||
|
||
if options[:"delete-reverse-dns"] | ||
params[:reverse_dns] = "" | ||
end | ||
|
||
cip.update(params) | ||
cip.reload | ||
|
||
render_table([cip], global_options) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
module Brightbox | ||
desc 'Update an image' | ||
arg_name 'img-id' | ||
command [:update] do |c| | ||
|
||
c.desc "Name to give the image" | ||
c.flag [:n, "name"] | ||
|
||
c.desc "Architecture of the image (i686 or x86_64)" | ||
c.flag [:a, "arch"] | ||
|
||
c.desc "Set image mode to be either 'virtio' or 'compatibility'" | ||
c.flag [:m, "mode"] | ||
|
||
c.desc "Set image to be publically visible (true or false)" | ||
c.flag [:p, "public"] | ||
|
||
c.desc "Image description" | ||
c.flag [:d, "description"] | ||
|
||
c.action do |global_options,options,args| | ||
img_id = args.shift | ||
raise "You must specify the image to update as the first argument" unless img_id =~ /^img-/ | ||
if options[:m] | ||
raise "Mode must be 'virtio' or 'compatibility'" unless options[:m] == "virtio" || options[:m] == "compatibility" | ||
end | ||
if options[:p] | ||
raise "Public must be true or false" unless options[:p] == "true" || options[:p] == "false" | ||
end | ||
|
||
params = {} | ||
params[:name] = options[:n] if options[:n] | ||
params[:arch] = options[:a] if options[:a] | ||
params[:source] = options[:s] if options[:s] | ||
params[:description] = options[:d] if options[:d] | ||
|
||
params[:compatibility_mode] = true if options[:m] == "compatibility" | ||
params[:compatibility_mode] = false if options[:m] == "virtio" | ||
|
||
params[:public] = true if options[:p] == "true" | ||
params[:public] = false if options[:p] == "false" | ||
|
||
image = Image.find img_id | ||
|
||
info "Updating image #{image}" | ||
image.update params | ||
image.reload | ||
render_table([image], global_options) | ||
end | ||
|
||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
module Brightbox | ||
desc 'Update a server' | ||
arg_name 'srv-id' | ||
command [:update] do |c| | ||
c.desc "Friendly name of server" | ||
c.flag [:n, :name] | ||
|
||
c.desc "Specify user data" | ||
c.flag [:m, "user-data"] | ||
|
||
c.desc "Specify the user data from a local file" | ||
c.flag [:f, "user-data-file"] | ||
|
||
c.desc "Don't base64 encode the user data" | ||
c.switch [:e, :no_base64] | ||
|
||
c.action do |global_options, options, args| | ||
srv_id = args.shift | ||
raise "You must specify a valid server id as the first argument" unless srv_id =~ /^srv-/ | ||
|
||
server = Server.find srv_id | ||
|
||
user_data = options[:m] | ||
user_data_file = options[:f] | ||
|
||
if user_data_file | ||
raise "Cannot specify user data on command line and in file at same time" if user_data | ||
# Wot we use to read the data, be it from stdin or a file on disk | ||
file_handler = lambda do |fh| | ||
raise "User data file too big (>16k)" if fh.stat.size > 16 * 1024 | ||
user_data = fh.read | ||
end | ||
# Figure out how to invoke file_handler, and then invoke it | ||
if user_data_file == "-" | ||
file_handler[$stdin] | ||
else | ||
File.open user_data_file, "r", &file_handler | ||
end | ||
end | ||
|
||
if user_data | ||
unless options[:e] | ||
require 'base64' | ||
user_data = Base64.encode64(user_data) | ||
end | ||
raise "User data too big (>16k)" if user_data.size > 16 * 1024 | ||
end | ||
|
||
params = {} | ||
params[:name] = options[:n] if options[:n] | ||
params[:user_data] = user_data if user_data | ||
|
||
info "Updating server #{server}#{" with %.2fk of user data" % (user_data.size / 1024.0) if user_data}" | ||
server.update params | ||
server.reload | ||
render_table([server], global_options) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,3 @@ | ||
# Hack to force persistent connections in fog | ||
module Fog | ||
class Connection | ||
def initialize(url, persistent=false) | ||
@excon = Excon.new(url) | ||
@persistent = true | ||
end | ||
end | ||
end | ||
|
||
Fog::Compute::Brightbox::Real.class_eval do |klass| | ||
klass.send(:attr_accessor, :oauth_token) | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.