Class: VagrantSubutai::Command
- Inherits:
-
Object
- Object
- VagrantSubutai::Command
- Defined in:
- lib/vagrant-subutai/command.rb
Instance Attribute Summary collapse
-
#box ⇒ Object
Returns the value of attribute box.
Class Method Summary collapse
-
.synopsis ⇒ Object
shows description when ‘vagrant list-commands` is triggered.
Instance Method Summary collapse
Instance Attribute Details
#box ⇒ Object
Returns the value of attribute box.
9 10 11 |
# File 'lib/vagrant-subutai/command.rb', line 9 def box @box end |
Class Method Details
.synopsis ⇒ Object
shows description when ‘vagrant list-commands` is triggered
11 12 13 |
# File 'lib/vagrant-subutai/command.rb', line 11 def self.synopsis 'Vagrant Subutai Plugin - executes Subutai scripts in target hosts' end |
Instance Method Details
#check_subutai_console_url(subutai_cli) ⇒ Object
59 60 61 62 63 64 65 66 67 |
# File 'lib/vagrant-subutai/command.rb', line 59 def check_subutai_console_url(subutai_cli) ip = subutai_cli.info(Configs::VagrantCommand::ARG_IP_ADDR) if ip.nil? STDOUT.puts 'We can\'t detect your PeerOS ip address!' exit end "https://#{ip}:#{Configs::SubutaiConsoleAPI::PORT}" end |
#cli_info ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/vagrant-subutai/command.rb', line 69 def cli_info commands = <<-EOF Usage: vagrant subutai command [command options] [arguments...] COMMANDS: help [<command>...] Show help. daemon Run subutai agent daemon list containers List containers list templates List templates list all List all list info List containers info attach <name> [<command>] Attach to Subutai container clone [<flags>] <template> <container> Create Subutai container cleanup <vlan> Cleanup environment prune Prune templates with no child containers destroy <name> Destroy Subutai container/template export --token=TOKEN [<flags>] <container> Export container as a template import [<flags>] <template> Import Subutai template info id [<container>] host/container id info system Host info info os Host os info ipaddr Host ip address info ports Host used ports info du <container> Container disk usage info qu <container> Container quota usage hostname rh <hostname> Set RH hostname hostname con <container> <hostname> Set container hostname map add --protocol=PROTOCOL --external port=EXTERNAL PORT --internal server=INTERNAL SERVER [<flags>] Add port mapping map rm --protocol=PROTOCOL --external port=EXTERNAL PORT [<flags>] Remove port mapping map list [<flags>] List mapped ports metrics --start=START --end=END <name> Print host/container metrics proxy create --protocol=PROTOCOL --port=PORT --tag=TAG [<flags>] Create proxy proxy list [<flags>] List proxies proxy remove --tag=TAG Remove proxy proxy server add --tag=TAG --server=SERVER Add proxied server proxy server remove --tag=TAG --server=SERVER Remove proxied server proxy server list --tag=TAG List servers for proxy quota get --resource=RESOURCE --container=CONTAINER Print container resource quota quota set --resource=RESOURCE --container=CONTAINER <limit> Set container resource quota start <name(s)>... Start Subutai container stop <name(s)>... Stop Subutai container restart <name(s)>... Restart Subutai container update [<flags>] <component> Update peer components tunnel add [<flags>] <socket> [<ttl>] Create ssh tunnel tunnel del <socket> Delete ssh tunnel tunnel list List ssh tunnels vxlan add --remoteip=REMOTEIP --vni=VNI --vlan=VLAN <name> Add vxlan tunnel vxlan del <name> Delete vxlan tunnel vxlan list List vxlan tunnels batch <commands> Execute a batch of commands register Register Subutai PeerOS to Bazaar unregister Unregister Subutai PeerOS from Bazaar fingerprint Shows fingerprint Subutai Console open Open the Subutai PeerOS in browser blueprint Run blueprint provisioning GLOBAL OPTIONS: -h, --help Show help EOF commands end |
#execute ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/vagrant-subutai/command.rb', line 16 def execute cli_info # Gets Subutai console url and box name from Vagrantfile with_target_vms(nil, single_target: true) do |machine| @box = machine.config.vm.box end subutai_cli = Commands.new(ARGV, @env) case ARGV[1] when 'register' subutai_cli.register(nil, nil, check_subutai_console_url(subutai_cli)) when 'deregister' subutai_cli.deregister(nil, nil, check_subutai_console_url(subutai_cli)) when 'unregister' subutai_cli.deregister(nil, nil, check_subutai_console_url(subutai_cli)) when 'fingerprint' subutai_cli.fingerprint(check_subutai_console_url(subutai_cli)) when 'open' subutai_cli.open(check_subutai_console_url(subutai_cli)) when 'blueprint' subutai_cli.blueprint(check_subutai_console_url(subutai_cli), 1) when 'finger' subutai_cli.finger(check_subutai_console_url(subutai_cli)) when '-h' STDOUT.puts cli_info when '--help' STDOUT.puts cli_info else # All Agent CLI commands implemented here command = ARGV command.shift if command.empty? STDOUT.puts cli_info else subutai_cli.ssh("#{subutai_cli.base} #{command.join(' ')}") end end end |