Class: Rancher::Api::Instance
- Inherits:
-
Object
- Object
- Rancher::Api::Instance
- Includes:
- Her::Model, Helpers::Model
- Defined in:
- lib/rancher/api/models/instance.rb,
lib/rancher/api/models/instance/action.rb
Overview
instance usually container
Defined Under Namespace
Classes: Action
Constant Summary
Constants included from Helpers::Model
Instance Method Summary collapse
- #container? ⇒ Boolean
-
#execute(command) ⇒ Object
{ “attachStdin”: true, “attachStdout”: true, “command”: [ “rake”, “db:create”, “db:schema:load”, “db:seed” ], “tty”: true }.
- #logs(lines = 20) ⇒ Object
Methods included from Helpers::Model
#handle_response, #reload, #run, #self_url, #wait_for_state
Instance Method Details
#container? ⇒ Boolean
14 15 16 |
# File 'lib/rancher/api/models/instance.rb', line 14 def container? type == 'container' end |
#execute(command) ⇒ Object
"attachStdin": true,
"attachStdout": true,
"command": [
"rake",
"db:create",
"db:schema:load",
"db:seed"
],
"tty": true
48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/rancher/api/models/instance.rb', line 48 def execute(command) url = actions['execute'] data = { 'attachStdin' => true, 'attachStdout' => true, 'command' => command, 'tty' => true } action = Action.post(url, data) action.run! end |
#logs(lines = 20) ⇒ Object
62 63 64 65 66 67 68 69 70 71 |
# File 'lib/rancher/api/models/instance.rb', line 62 def logs(lines = 20) url = actions['logs'] data = { 'follow' => false, 'lines' => lines } action = Action.post(url, data) action.run! end |