class SSC::Client
Public Class Methods
help(*args)
click to toggle source
# File lib/ssc.rb, line 122 def help(*args) message= <<HELP_MESSAGE Tasks: ssc checkout # checkout the latest changes to an appliance ssc commit # commit changes to studio ssc status # show status of the appliance ssc appliance # manage appliances ssc build # manage builds ssc file # manage files ssc package # manage packages ssc repository # manage repositories ssc template # manage templates ssc help [TASK] # Describe available tasks or one specific task HELP_MESSAGE puts message end
Public Instance Methods
checkout()
click to toggle source
# File lib/ssc.rb, line 61 def checkout params= {:appliance_id => options.appliance_id, :username => options.username, :password => options.password} require_appliance_directory do |appliance, files| options= params.merge(:remote => true) invoke "s_s_c:handler:package:list", ["installed"], options invoke "s_s_c:handler:repository:list", [], options invoke "s_s_c:handler:overlay_file:list", [], options end rescue ApplianceDirectoryError require_appliance do |appliance| ApplianceDirectory.new(appliance.name, params).create Dir.chdir(appliance.name) options= params.merge(:remote => true) invoke "s_s_c:handler:package:list", ["installed"], options invoke "s_s_c:handler:repository:list", [], options invoke "s_s_c:handler:overlay_file:list", [], options end end
commit()
click to toggle source
# File lib/ssc.rb, line 84 def commit params= {:remote => true, :appliance_id => options.appliance_id, :username => options.username, :password => options.password} # Add or Remove Repositories repository_file= RepositoryFile.new ["add", "remove"].each do |action| while repository= repository_file.pop(action) invoke "s_s_c:handler:repository:#{action}", [repository], params end end repository_file.save # Add, Remove, Ban and Unban Packages package_file= PackageFile.new ["add", "remove", "ban", "unban"].each do |action| while package= package_file.pop(action) invoke "s_s_c:handler:package:#{action}", [package], params end end package_file.save # Add Overlay Files file_list = FileListFile.new while file= file_list.pop("add") params= params.merge(file[:params]) invoke "s_s_c:handler:overlay_file:add", [file[:full_path]], params end # Remove Overlay Files while file= file_list.pop("remove") invoke "s_s_c:handler:overlay_file:remove", [file[:name]], params end file_list.save end
status()
click to toggle source
# File lib/ssc.rb, line 24 def status require_appliance_directory do |appliance, files| # Show appliance status say "Appliance: id: #{appliance.id} | name: #{appliance.name}" say "Status: #{appliance.status.state}" say appliance.status.issues # Show additions say "\nAdditions : \n" say "\nPackages : \n" say_array files[:package]["add"] say "\nRepositories : \n" say_array files[:repository]["add"] say "\nOverlay Files : \n" say_array(files[:file_list]["add"]) {|i| i.keys[0]} # Show removals say "\nRemovals : \n" say "\nPackages : \n" say_array files[:package]["remove"] say "\nRepositories : \n" say_array files[:repository]["remove"] say "\nOverlay Files :\n " say_array(files[:file_list]["remove"]) {|i| i.keys[0]} # Show banned say "\nBanned Packages : \n" say_array files[:package]["ban"] # Show unbanned say "\nUnBanned Packages : \n" say_array files[:package]["unban"] end end