puppet_agent_mgr 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,6 +2,9 @@ require 'puppet_agent_mgr/common'
2
2
 
3
3
  module PuppetAgentMgr
4
4
  def self.manager
5
+ # puppet 2 requires this, 3 probably just ignores it
6
+ $puppet_application_name = :agent
7
+
5
8
  require 'puppet'
6
9
  require 'json'
7
10
 
@@ -10,6 +10,14 @@ module PuppetAgentMgr::V2
10
10
  include Unix
11
11
  end
12
12
 
13
+ def initialize(testing=false)
14
+ unless testing
15
+ $puppet_application_mode = Puppet::Util::RunMode[:agent]
16
+ Puppet.settings.use :main, :agent
17
+ Puppet.parse_config
18
+ end
19
+ end
20
+
13
21
  # enables the puppet agent, it can now start applying catalogs again
14
22
  def enable!
15
23
  raise "Already enabled" if enabled?
@@ -11,11 +11,11 @@ module PuppetAgentMgr::V3
11
11
  include PuppetAgentMgr::Common
12
12
 
13
13
  def initialize(testing=false)
14
- unless Puppet.settings.app_defaults_initialized?
14
+ unless testing || Puppet.settings.app_defaults_initialized?
15
15
  require 'puppet/util/run_mode'
16
16
  Puppet.settings.preferred_run_mode = :agent
17
- run_mode = Puppet::Util::RunMode[ Puppet.settings.preferred_run_mode ]
18
- Puppet.settings.initialize_app_defaults(Puppet::Settings.app_defaults_for_run_mode(run_mode))
17
+ Puppet.settings.initialize_global_settings
18
+ Puppet.settings.initialize_app_defaults(Puppet::Settings.app_defaults_for_run_mode(Puppet.run_mode))
19
19
  end
20
20
  end
21
21
 
@@ -3,8 +3,8 @@ module PuppetAgentMgr::V3
3
3
  extend Unix
4
4
  # is the agent daemon currently in the unix process list?
5
5
  def daemon_present?
6
- if File.exist?(Puppet[:agent_catalog_run_lockfile])
7
- return has_process_for_pid?(File.read(Puppet[:agent_catalog_run_lockfile]))
6
+ if File.exist?(Puppet[:pidfile])
7
+ return has_process_for_pid?(File.read(Puppet[:pidfile]))
8
8
  end
9
9
 
10
10
  return false
@@ -14,8 +14,8 @@ module PuppetAgentMgr::V3
14
14
  def applying?
15
15
  return false if disabled?
16
16
 
17
- if File::Stat.new(Puppet[:pidfile]).size > 0
18
- return has_process_for_pid(File.read(Puppet[:pidfile]))
17
+ if File::Stat.new(Puppet[:agent_catalog_run_lockfile]).size > 0
18
+ return has_process_for_pid(File.read(Puppet[:agent_catalog_run_lockfile]))
19
19
  end
20
20
 
21
21
  return false
@@ -24,7 +24,7 @@ module PuppetAgentMgr::V3
24
24
  end
25
25
 
26
26
  def signal_running_daemon
27
- pid = File.read(Puppet[:agent_catalog_run_lockfile])
27
+ pid = File.read(Puppet[:pidfile])
28
28
 
29
29
  if has_process_for_pid?(pid)
30
30
  begin
@@ -1,3 +1,3 @@
1
1
  module PuppetAgentMgr
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet_agent_mgr
3
3
  version: !ruby/object:Gem::Version
4
- hash: 17
4
+ hash: 15
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 0
9
- - 7
10
- version: 0.0.7
9
+ - 8
10
+ version: 0.0.8
11
11
  platform: ruby
12
12
  authors:
13
13
  - R.I.Pienaar
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-09-29 00:00:00 +01:00
18
+ date: 2012-10-25 00:00:00 +01:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency