Class: ForemanDebian::Engine
- Inherits:
-
Object
- Object
- ForemanDebian::Engine
- Defined in:
- lib/foreman_debian/engine.rb
Instance Method Summary collapse
-
#initialize(app, user) ⇒ Engine
constructor
A new instance of Engine.
- #install(jobs, concurrency) ⇒ Object
- #job_concurrency(concurrency, name) ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
- #uninstall ⇒ Object
Constructor Details
#initialize(app, user) ⇒ Engine
Returns a new instance of Engine.
4 5 6 7 8 9 |
# File 'lib/foreman_debian/engine.rb', line 4 def initialize(app, user) @app = app @user = user @initd_engine = Initd::Engine.new(@app, @user) @monit_engine = Monit::Engine.new(@app, @user) end |
Instance Method Details
#install(jobs, concurrency) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/foreman_debian/engine.rb', line 11 def install(jobs, concurrency) jobs.each do |name, command| if job_concurrency(concurrency, name) > 0 script = @initd_engine.create_script(name, command) @initd_engine.install(script) @monit_engine.install(name, script) end end @initd_engine.cleanup @monit_engine.cleanup end |
#job_concurrency(concurrency, name) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/foreman_debian/engine.rb', line 35 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
27 28 29 |
# File 'lib/foreman_debian/engine.rb', line 27 def start @initd_engine.start end |
#stop ⇒ Object
31 32 33 |
# File 'lib/foreman_debian/engine.rb', line 31 def stop @initd_engine.stop end |
#uninstall ⇒ Object
23 24 25 |
# File 'lib/foreman_debian/engine.rb', line 23 def uninstall install({}, {}) end |