Module: Charmkit::Plugins::HookEnv::InstanceMethods
- Defined in:
- lib/charmkit/plugins/hookenv.rb
Instance Method Summary collapse
- #action(item) ⇒ Object
- #action=(item) ⇒ Object
- #config(item) ⇒ Object
- #log(msg) ⇒ Object
- #resource(item) ⇒ Object
-
#status(level = :maintenance, msg = "") ⇒ Object
calls status-set in juju environment.
- #unit(item) ⇒ Object
Instance Method Details
#action(item) ⇒ Object
27 28 29 30 |
# File 'lib/charmkit/plugins/hookenv.rb', line 27 def action(item) out, err = run "action-get '#{item}'" return out.chomp end |
#action=(item) ⇒ Object
32 33 34 35 |
# File 'lib/charmkit/plugins/hookenv.rb', line 32 def action=(item) out, err = run "action-set '#{item}'" return out.chomp end |
#config(item) ⇒ Object
12 13 14 15 |
# File 'lib/charmkit/plugins/hookenv.rb', line 12 def config(item) out, err = run "config-get '#{item}'" return out.chomp end |
#log(msg) ⇒ Object
37 38 39 |
# File 'lib/charmkit/plugins/hookenv.rb', line 37 def log(msg) run "juju-log #{msg}" end |
#resource(item) ⇒ Object
17 18 19 20 |
# File 'lib/charmkit/plugins/hookenv.rb', line 17 def resource(item) out, err = run "resource-get '#{item}'" return out.chomp end |
#status(level = :maintenance, msg = "") ⇒ Object
calls status-set in juju environment
6 7 8 9 10 |
# File 'lib/charmkit/plugins/hookenv.rb', line 6 def status(level=:maintenance, msg="") levels = [:maintenance, :active, :blocked, :waiting] raise unless levels.include?(level) run "status-set #{level.to_s} '#{msg}'" end |
#unit(item) ⇒ Object
22 23 24 25 |
# File 'lib/charmkit/plugins/hookenv.rb', line 22 def unit(item) out, err = run "unit-get '#{item}'" return out.chomp end |