foreman_debian 0.0.6 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 271ef8aace3bdb0c52d45d7fbb8f6bfde9cac2ec
4
- data.tar.gz: c132607d3f5a018aac3512c51a4bcf60e6b80710
3
+ metadata.gz: 7971faa8f4ca6bfa0014a2109f40dbb6393c9a38
4
+ data.tar.gz: 80659136f7cb9233312455d85953c22c78397277
5
5
  SHA512:
6
- metadata.gz: d0c7fddddba615f3c5df5825400924452776365150bba330b22f60f1ecb9ce2b5f382230ed08531c1d92dc3af335b758283ede6acf8c8d79979b8d5ec7b15025
7
- data.tar.gz: de8c112b23c54344d2335fbe9a240e15ddfd3ebdeb88b1cf8ae6e663d44a793a5b491a53051c36c1698b988c0e52d4611e1158beb2969f259a61a2c083a15fe4
6
+ metadata.gz: d2273945251adfe25774f1da888576d955a88fec40f7b1285c9fd4dfd14e4f64b1715228a9c17f8be5bc83c9e5549c3e876bd63ff7bd2e4ee46ba9c278dd3e19
7
+ data.tar.gz: 5fbeaec424c57cdbaecd14ea06fd331d08ccaba78aed9b23acf9bef10794c0db032b5e098ebb80e2d0ec7c06ea116736e4682a65c71142527034874b01a2a49c
@@ -4,6 +4,10 @@ module ForemanDebian
4
4
  option %w(-f --procfile), '<path>', 'alternative Procfile',
5
5
  :attribute_name => :procfile_path_relative
6
6
 
7
+ option %w(-u --user), '<user>', 'Specify the user the application should be run as',
8
+ :attribute_name => :user,
9
+ :default => 'root'
10
+
7
11
  option %w(-c --concurrency), '<encoded_hash>', 'concurrency (job1=0,job2=1)',
8
12
  :attribute_name => :concurrency_encoded,
9
13
  :default => 'all=1'
@@ -18,7 +22,7 @@ module ForemanDebian
18
22
  jobs[name] = expand_procfile_command(command)
19
23
  end
20
24
  concurrency = decode_concurrency(concurrency_encoded)
21
- get_engine.install(jobs, concurrency)
25
+ get_engine.install(jobs, concurrency, user)
22
26
  end
23
27
 
24
28
  def expand_procfile_command(command)
@@ -4,15 +4,12 @@ module ForemanDebian
4
4
  class Command < Clamp::Command
5
5
 
6
6
  option %w(-a --app), '<name>', 'application name',
7
- :attribute_name => :app_name,
7
+ :attribute_name => :app,
8
8
  :default => 'app'
9
- option %w(-u --user), '<user>', 'Specify the user the application should be run as',
10
- :attribute_name => :app_user,
11
- :default => 'root'
12
9
 
13
10
  # @return [ForemanDebian::Engine]
14
11
  def get_engine
15
- ForemanDebian::Engine.new(app_name, app_user)
12
+ ForemanDebian::Engine.new(app)
16
13
  end
17
14
  end
18
15
  end
@@ -1,35 +1,35 @@
1
1
  module ForemanDebian
2
2
  class Engine
3
3
 
4
- def initialize(app, user)
4
+ def initialize(app)
5
5
  @app = app
6
- @user = user
7
- @initd_engine = Initd::Engine.new(@app, @user)
8
- @monit_engine = Monit::Engine.new(@app, @user)
9
6
  end
10
7
 
11
- def install(jobs, concurrency)
8
+ def install(jobs, concurrency, user)
9
+ initd_engine = Initd::Engine.new(@app)
10
+ monit_engine = Monit::Engine.new(@app)
12
11
  jobs.each do |name, command|
13
12
  if job_concurrency(concurrency, name) > 0
14
- script = @initd_engine.create_script(name, command)
15
- @initd_engine.install(script)
16
- @monit_engine.install(name, script)
13
+ script = @initd_engine.create_script(name, command, user)
14
+ initd_engine.install(script)
15
+ monit_engine.install(name, script)
17
16
  end
18
17
  end
19
- @initd_engine.cleanup
20
- @monit_engine.cleanup
18
+ initd_engine.cleanup
19
+ monit_engine.cleanup
21
20
  end
22
21
 
23
22
  def uninstall
24
- install({}, {})
23
+ Initd::Engine.new(@app).cleanup
24
+ Monit::Engine.new(@app).cleanup
25
25
  end
26
26
 
27
27
  def start
28
- @initd_engine.start
28
+ Initd::Engine.new(@app).start
29
29
  end
30
30
 
31
31
  def stop
32
- @initd_engine.stop
32
+ Initd::Engine.new(@app).stop
33
33
  end
34
34
 
35
35
  def job_concurrency(concurrency, name)
@@ -4,21 +4,20 @@ module ForemanDebian
4
4
 
5
5
  include ForemanDebian::EngineHelper
6
6
 
7
- def initialize(app, user, export_path = nil)
7
+ def initialize(app, export_path = nil)
8
8
  @app = app
9
- @user = user
10
9
  @export_path = Pathname.new(export_path || '/etc/init.d')
11
10
  @system_export_path = Pathname.new('/etc/init.d')
12
11
  setup
13
12
  end
14
13
 
15
- def create_script(name, command)
14
+ def create_script(name, command, user)
16
15
  pidfile = pidfile(name)
17
16
  args = Shellwords.split(command)
18
17
  script = args.shift
19
18
  name = "#{@app}-#{name}"
20
19
  script_path = @export_path.join(name)
21
- Script.new(script_path, name, name, @user, script, args, pidfile)
20
+ Script.new(script_path, name, name, user, script, args, pidfile)
22
21
  end
23
22
 
24
23
  def install(script)
@@ -4,9 +4,8 @@ module ForemanDebian
4
4
 
5
5
  include ForemanDebian::EngineHelper
6
6
 
7
- def initialize(app, user, export_path = nil)
7
+ def initialize(app, export_path = nil)
8
8
  @app = app
9
- @user = user
10
9
  @export_path = Pathname.new(export_path || '/etc/monit/conf.d')
11
10
  setup
12
11
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman_debian
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - cargomedia