Class: Sfp::Module::Shell
- Inherits:
-
Object
- Object
- Sfp::Module::Shell
- Includes:
- Resource
- Defined in:
- lib/sfpagent/module.rb
Instance Attribute Summary collapse
-
#home ⇒ Object
readonly
Returns the value of attribute home.
-
#main ⇒ Object
readonly
Returns the value of attribute main.
Attributes included from Resource
#model, #parent, #path, #state, #synchronized
Instance Method Summary collapse
- #execute(name, parameters = {}) ⇒ Object
-
#initialize(metadata) ⇒ Shell
constructor
A new instance of Shell.
- #update_state ⇒ Object
Methods included from Resource
#init, resolve, #use_http_proxy?
Constructor Details
#initialize(metadata) ⇒ Shell
Returns a new instance of Shell.
173 174 175 176 177 178 179 |
# File 'lib/sfpagent/module.rb', line 173 def initialize() ### set module's home directory @home = [:home] ### set main shell command @main = @home + '/main' end |
Instance Attribute Details
#home ⇒ Object (readonly)
Returns the value of attribute home.
171 172 173 |
# File 'lib/sfpagent/module.rb', line 171 def home @home end |
#main ⇒ Object (readonly)
Returns the value of attribute main.
171 172 173 |
# File 'lib/sfpagent/module.rb', line 171 def main @main end |
Instance Method Details
#execute(name, parameters = {}) ⇒ Object
189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 |
# File 'lib/sfpagent/module.rb', line 189 def execute(name, parameters={}) result = invoke({ :command => :execute, :procedure => name.split('.').last, :parameters => parameters, :model => @model, :path => @path }) if result['status'] != 'ok' log.error "Error in executing #{name} - description: #{result['description']}" false else true end end |
#update_state ⇒ Object
181 182 183 184 185 186 187 |
# File 'lib/sfpagent/module.rb', line 181 def update_state @state = invoke({ :command => :state, :model => @model, :path => @path }) end |