dtk-node-agent 0.5.16 → 0.5.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/dtk-node-agent/installer.rb +3 -0
- data/lib/dtk-node-agent/version.rb +1 -1
- data/mcollective_additions/debian.mcollective.init +85 -0
- data/mcollective_additions/plugins/v2.2/agent/puppet_apply.rb +41 -12
- data/mcollective_additions/redhat.mcollective.init +139 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
YTNhMGI2MjY5NjExZmMyNmIwZjFiYWYwNzFjMWY5ZTgzOTJhNDY1Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
M2E5ZTVhZjM2MjE1M2JhYTA1YjVjMzhjNjdiOTZjNzQzNjI2NDg4ZA==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmY2MWMyZTEyNmQ3ZmIxYzE5MzQyMTFhN2JhYmI4NWRlMmVjYjFjZWE3OTE5
|
10
|
+
ODg5NGZjYWQ3YjBjZTNkYjFhNmNlMWQ0YzAwZGRmMjRiMjU5YjZlYzliZGE5
|
11
|
+
YWE2M2U3OWJkOGEwYmJkZTJmOWVlNGIzOTIyZDRhM2E4ZDcwZjQ=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ODI0ZGY0YjEwYWJlYjkxMGY3YjM5MmQ5MTU3YWYxOTNlMjIyZDFlMjQ4YTdh
|
14
|
+
NmEzYjVlNTczZmY2ZjdiNjZhYjEzMTg0NGRmMzFhN2EwOGJiYzYyMmQyNzZi
|
15
|
+
MzMzZjk4NDA3OTYxYTgzZGExOWExNTdlYzNiZmQ2ZTliNTllZWQ=
|
@@ -133,6 +133,9 @@ module DTK
|
|
133
133
|
|
134
134
|
# copy mcollective config
|
135
135
|
FileUtils.cp_r("#{base_dir}/mcollective_additions/server.cfg", "/etc/mcollective", :remove_destination => true)
|
136
|
+
|
137
|
+
# copy compatible mcollective init script
|
138
|
+
FileUtils.cp_r("#{base_dir}/mcollective_additions/#{Facter.osfamily.downcase}.mcollective.init", "/etc/init.d/mcollective", :remove_destination => true)
|
136
139
|
end
|
137
140
|
|
138
141
|
def self.base_dir
|
@@ -0,0 +1,85 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# mcollective Application Server for STOMP based agents
|
4
|
+
#
|
5
|
+
#
|
6
|
+
# description: mcollective lets you build powerful Stomp compatible middleware clients in ruby without having to worry too
|
7
|
+
# much about all the setup and management of a Stomp connection, it also provides stats, logging and so forth
|
8
|
+
# as a bonus.
|
9
|
+
#
|
10
|
+
### BEGIN INIT INFO
|
11
|
+
# Provides: mcollective
|
12
|
+
# Required-Start: $remote_fs
|
13
|
+
# Required-Stop: $remote_fs
|
14
|
+
# Default-Start: 2 3 4 5
|
15
|
+
# Default-Stop: 0 1 6
|
16
|
+
# Short-Description: Start daemon at boot time
|
17
|
+
# Description: Enable service provided by mcollective.
|
18
|
+
### END INIT INFO
|
19
|
+
|
20
|
+
# check permissions
|
21
|
+
|
22
|
+
uid=`id -u`
|
23
|
+
[ $uid -gt 0 ] && { echo "You need to be root to run file" ; exit 4 ; }
|
24
|
+
|
25
|
+
|
26
|
+
# PID directory
|
27
|
+
pidfile="/var/run/mcollectived.pid"
|
28
|
+
|
29
|
+
name="mcollective"
|
30
|
+
mcollectived=/usr/sbin/mcollectived
|
31
|
+
daemonopts="--pid=${pidfile} --config=/etc/mcollective/server.cfg"
|
32
|
+
|
33
|
+
|
34
|
+
# Source function library.
|
35
|
+
. /lib/lsb/init-functions
|
36
|
+
|
37
|
+
# Check that binary exists
|
38
|
+
if ! [ -f $mcollectived ]
|
39
|
+
then
|
40
|
+
echo "mcollectived binary not found"
|
41
|
+
exit 5
|
42
|
+
fi
|
43
|
+
|
44
|
+
# create pid file if it does not exist
|
45
|
+
[ ! -f ${pidfile} ] && { touch ${pidfile} ; }
|
46
|
+
|
47
|
+
# See how we were called.
|
48
|
+
case "$1" in
|
49
|
+
start)
|
50
|
+
echo "Starting daemon: " $name
|
51
|
+
# start the program
|
52
|
+
start-stop-daemon -S -p ${pidfile} --oknodo -q -a ${mcollectived} -- ${daemonopts}
|
53
|
+
[ $? = 0 ] && { exit 0 ; } || { exit 1 ; }
|
54
|
+
log_success_msg "mcollective started"
|
55
|
+
touch $lock
|
56
|
+
;;
|
57
|
+
stop)
|
58
|
+
echo "Stopping daemon: " $name
|
59
|
+
start-stop-daemon -K -R 5 -s "TERM" --oknodo -q -p ${pidfile}
|
60
|
+
[ $? = 0 ] && { exit 0 ; } || { exit 1 ; }
|
61
|
+
log_success_msg "mcollective stopped"
|
62
|
+
;;
|
63
|
+
restart)
|
64
|
+
echo "Restarting daemon: " $name
|
65
|
+
$0 stop
|
66
|
+
sleep 2
|
67
|
+
$0 start
|
68
|
+
[ $? = 0 ] && { echo "mcollective restarted" ; exit 0 ; }
|
69
|
+
;;
|
70
|
+
condrestart)
|
71
|
+
if [ -f $lock ]; then
|
72
|
+
$0 stop
|
73
|
+
# avoid race
|
74
|
+
sleep 2
|
75
|
+
$0 start
|
76
|
+
fi
|
77
|
+
;;
|
78
|
+
status)
|
79
|
+
status_of_proc -p ${pidfile} ${mcollectived} ${name} && exit 0 || exit $?
|
80
|
+
;;
|
81
|
+
*)
|
82
|
+
echo "Usage: mcollectived {start|stop|restart|condrestart|status}"
|
83
|
+
exit 2
|
84
|
+
;;
|
85
|
+
esac
|
@@ -64,19 +64,26 @@ module MCollective
|
|
64
64
|
remote_repo = "#{git_server}:#{vc[:repo]}"
|
65
65
|
opts = Hash.new
|
66
66
|
opts.merge!(:sha => vc[:sha]) if vc[:sha]
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
67
|
+
|
68
|
+
clean_and_clone = true
|
69
|
+
if File.exists?("#{repo_dir}/.git")
|
70
|
+
pull_err = trap_and_return_error do
|
71
|
+
pull_module(repo_dir,vc[:branch],opts)
|
72
|
+
end
|
73
|
+
# clean_and_clone set so if pull error then try again, this time cleaning dir and freshly cleaning
|
74
|
+
clean_and_clone = pull_err.nil?
|
75
|
+
end
|
76
|
+
|
77
|
+
if clean_and_clone
|
78
|
+
begin
|
79
|
+
clean_and_clone_module(repo_dir,remote_repo,vc[:branch],opts)
|
80
|
+
rescue Exception => e
|
81
|
+
# TODO: not used now
|
82
|
+
error_backtrace = backtrace_subset(e)
|
83
|
+
# to achieve idempotent behavior; fully remove directory if any problems
|
84
|
+
FileUtils.rm_rf repo_dir
|
85
|
+
raise e
|
74
86
|
end
|
75
|
-
rescue Exception => e
|
76
|
-
error_backtrace = backtrace_subset(e)
|
77
|
-
#to achieve idempotent behavior; fully remove directory if any problems
|
78
|
-
FileUtils.rm_rf repo_dir
|
79
|
-
raise e
|
80
87
|
end
|
81
88
|
end
|
82
89
|
ret.set_status_succeeded!()
|
@@ -92,6 +99,28 @@ module MCollective
|
|
92
99
|
ret
|
93
100
|
end
|
94
101
|
|
102
|
+
# returns a trapped error
|
103
|
+
def trap_and_return_error(&body)
|
104
|
+
error = nil
|
105
|
+
begin
|
106
|
+
yield
|
107
|
+
rescue => e
|
108
|
+
error = e
|
109
|
+
end
|
110
|
+
error
|
111
|
+
end
|
112
|
+
|
113
|
+
def pull_module(repo_dir,branch,opts={})
|
114
|
+
git_repo = ::DTK::NodeAgent::GitClient.new(repo_dir)
|
115
|
+
git_repo.pull_and_checkout_branch?(branch,opts)
|
116
|
+
end
|
117
|
+
|
118
|
+
def clean_and_clone_module(repo_dir,remote_repo,branch,opts={})
|
119
|
+
FileUtils.rm_rf repo_dir if File.exists?(repo_dir)
|
120
|
+
git_repo = ::DTK::NodeAgent::GitClient.new(repo_dir,:create=>true)
|
121
|
+
git_repo.clone_branch(remote_repo,branch,opts)
|
122
|
+
end
|
123
|
+
|
95
124
|
def run(request)
|
96
125
|
cmps_with_attrs = request[:components_with_attributes]
|
97
126
|
node_manifest = request[:node_manifest]
|
@@ -0,0 +1,139 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
#
|
3
|
+
# mcollective Application Server for STOMP based agents
|
4
|
+
#
|
5
|
+
# chkconfig: - 24 76
|
6
|
+
#
|
7
|
+
# description: mcollective lets you build powerful Stomp compatible middleware clients in ruby without having to worry too
|
8
|
+
# much about all the setup and management of a Stomp connection, it also provides stats, logging and so forth
|
9
|
+
# as a bonus.
|
10
|
+
#
|
11
|
+
### BEGIN INIT INFO
|
12
|
+
# Provides: mcollective
|
13
|
+
# Required-Start: $remote_fs
|
14
|
+
# Required-Stop: $remote_fs
|
15
|
+
# Short-Description: Start daemon at boot time
|
16
|
+
# Description: Enable service provided by daemon.
|
17
|
+
### END INIT INFO
|
18
|
+
|
19
|
+
mcollectived="/usr/sbin/mcollectived"
|
20
|
+
pidfile="/var/run/mcollectived.pid"
|
21
|
+
if [ -d /var/lock/subsys ]; then
|
22
|
+
# RedHat/CentOS/etc who use subsys
|
23
|
+
lockfile="/var/lock/subsys/mcollective"
|
24
|
+
else
|
25
|
+
# The rest of them
|
26
|
+
lockfile="/var/lock/mcollective"
|
27
|
+
fi
|
28
|
+
|
29
|
+
# Check that binary exists
|
30
|
+
if ! [ -f $mcollectived ]; then
|
31
|
+
echo "mcollectived binary not found"
|
32
|
+
exit 5
|
33
|
+
fi
|
34
|
+
|
35
|
+
# Source function library.
|
36
|
+
. /etc/init.d/functions
|
37
|
+
|
38
|
+
if [ -f /etc/sysconfig/mcollective ]; then
|
39
|
+
. /etc/sysconfig/mcollective
|
40
|
+
fi
|
41
|
+
|
42
|
+
# Determine if we can use the -p option to daemon, killproc, and status.
|
43
|
+
# RHEL < 5 can't.
|
44
|
+
if status | grep -q -- '-p' 2>/dev/null; then
|
45
|
+
daemonopts="--pidfile $pidfile"
|
46
|
+
pidopts="-p $pidfile"
|
47
|
+
fi
|
48
|
+
|
49
|
+
start() {
|
50
|
+
echo -n "Starting mcollective: "
|
51
|
+
# Only try to start if not already started
|
52
|
+
if ! rh_status_q; then
|
53
|
+
daemon ${daemonopts} ${mcollectived} --pid=${pidfile} --config="/etc/mcollective/server.cfg"
|
54
|
+
fi
|
55
|
+
# This will be 0 if mcollective is already running
|
56
|
+
RETVAL=$?
|
57
|
+
echo
|
58
|
+
[ $RETVAL -eq 0 ] && touch ${lockfile}
|
59
|
+
return $RETVAL
|
60
|
+
}
|
61
|
+
|
62
|
+
stop() {
|
63
|
+
echo -n "Shutting down mcollective: "
|
64
|
+
# If running, try to stop it
|
65
|
+
if rh_status_q; then
|
66
|
+
killproc ${pidopts} -d 10 ${mcollectived}
|
67
|
+
else
|
68
|
+
# Non-zero status either means lockfile and pidfile need cleanup (1 and 2)
|
69
|
+
# or the process is already stopped (3), so we can just call true to
|
70
|
+
# trigger the cleanup that happens below.
|
71
|
+
true
|
72
|
+
fi
|
73
|
+
RETVAL=$?
|
74
|
+
echo
|
75
|
+
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
|
76
|
+
return $RETVAL
|
77
|
+
}
|
78
|
+
|
79
|
+
restart() {
|
80
|
+
stop
|
81
|
+
start
|
82
|
+
}
|
83
|
+
|
84
|
+
reload_agents() {
|
85
|
+
echo -n "Reloading mcollective agents: "
|
86
|
+
killproc ${pidopts} ${mcollectived} -USR1
|
87
|
+
RETVAL=$?
|
88
|
+
echo
|
89
|
+
return $RETVAL
|
90
|
+
}
|
91
|
+
|
92
|
+
reload_loglevel() {
|
93
|
+
echo -n "Cycling mcollective logging level: "
|
94
|
+
killproc ${pidopts} ${mcollectived} -USR2
|
95
|
+
RETVAL=$?
|
96
|
+
echo
|
97
|
+
return $RETVAL
|
98
|
+
}
|
99
|
+
|
100
|
+
rh_status() {
|
101
|
+
status ${pidopts} ${mcollectived}
|
102
|
+
RETVAL=$?
|
103
|
+
return $RETVAL
|
104
|
+
}
|
105
|
+
|
106
|
+
rh_status_q() {
|
107
|
+
rh_status >/dev/null 2>&1
|
108
|
+
}
|
109
|
+
|
110
|
+
# See how we were called.
|
111
|
+
case "$1" in
|
112
|
+
start)
|
113
|
+
start
|
114
|
+
;;
|
115
|
+
stop)
|
116
|
+
stop
|
117
|
+
;;
|
118
|
+
restart)
|
119
|
+
restart
|
120
|
+
;;
|
121
|
+
condrestart)
|
122
|
+
rh_status_q || exit 0
|
123
|
+
restart
|
124
|
+
;;
|
125
|
+
reload-agents)
|
126
|
+
reload_agents
|
127
|
+
;;
|
128
|
+
reload-loglevel)
|
129
|
+
reload_loglevel
|
130
|
+
;;
|
131
|
+
status)
|
132
|
+
rh_status
|
133
|
+
;;
|
134
|
+
*)
|
135
|
+
echo "Usage: mcollectived {start|stop|restart|condrestart|reload-agents|reload-loglevel|status}"
|
136
|
+
RETVAL=2
|
137
|
+
;;
|
138
|
+
esac
|
139
|
+
exit $RETVAL
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dtk-node-agent
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rich PELAVIN
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-09-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puppet
|
@@ -126,6 +126,7 @@ files:
|
|
126
126
|
- lib/config/install.config
|
127
127
|
- lib/dtk-node-agent/installer.rb
|
128
128
|
- lib/dtk-node-agent/version.rb
|
129
|
+
- mcollective_additions/debian.mcollective.init
|
129
130
|
- mcollective_additions/plugins/README.md
|
130
131
|
- mcollective_additions/plugins/v1.2/agent/discovery.rb
|
131
132
|
- mcollective_additions/plugins/v1.2/agent/get_log_fragment.ddl
|
@@ -174,6 +175,7 @@ files:
|
|
174
175
|
- mcollective_additions/plugins/v2.2/security/sshkey.ddl
|
175
176
|
- mcollective_additions/plugins/v2.2/security/sshkey.rb
|
176
177
|
- mcollective_additions/plugins/v2.2/util/puppetrunner.rb
|
178
|
+
- mcollective_additions/redhat.mcollective.init
|
177
179
|
- mcollective_additions/server.cfg
|
178
180
|
- puppet_additions/modules/r8/lib/puppet/type/r8_export_file.rb
|
179
181
|
- puppet_additions/modules/r8/manifests/export_variable.rb
|