Class: ForemanDebian::Engine
- Inherits:
-
Object
- Object
- ForemanDebian::Engine
- Defined in:
- lib/foreman_debian/engine.rb
Instance Method Summary collapse
-
#initialize(app) ⇒ Engine
constructor
A new instance of Engine.
- #install(jobs, concurrency, user) ⇒ Object
- #job_concurrency(concurrency, name) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
- #uninstall ⇒ Object
Constructor Details
#initialize(app) ⇒ Engine
Returns a new instance of Engine.
4 5 6 |
# File 'lib/foreman_debian/engine.rb', line 4 def initialize(app) @app = app end |
Instance Method Details
#install(jobs, concurrency, user) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/foreman_debian/engine.rb', line 8 def install(jobs, concurrency, user) initd_engine = Initd::Engine.new(@app) monit_engine = Monit::Engine.new(@app) jobs.each do |name, command| if job_concurrency(concurrency, name) > 0 script = initd_engine.create_script(name, command, user) initd_engine.install(script) monit_engine.install(name, script) end end initd_engine.cleanup monit_engine.cleanup end |
#job_concurrency(concurrency, name) ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/foreman_debian/engine.rb', line 36 def job_concurrency(concurrency, name) c = (concurrency['all'] || 0).to_i if concurrency.has_key?(name) c = concurrency[name].to_i end c end |
#start ⇒ Object
28 29 30 |
# File 'lib/foreman_debian/engine.rb', line 28 def start Initd::Engine.new(@app).start end |