puppet_agent_mgr 0.0.7 → 0.0.8
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.
data/lib/puppet_agent_mgr.rb
CHANGED
@@ -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
|
-
|
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[:
|
7
|
-
return has_process_for_pid?(File.read(Puppet[:
|
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[:
|
18
|
-
return has_process_for_pid(File.read(Puppet[:
|
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[:
|
27
|
+
pid = File.read(Puppet[:pidfile])
|
28
28
|
|
29
29
|
if has_process_for_pid?(pid)
|
30
30
|
begin
|
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:
|
4
|
+
hash: 15
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
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-
|
18
|
+
date: 2012-10-25 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|