bolt 0.20.5 → 0.20.6
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of bolt might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/bolt-modules/boltlib/lib/puppet/datatypes/target.rb +1 -1
- data/lib/bolt/analytics.rb +160 -0
- data/lib/bolt/cli.rb +14 -4
- data/lib/bolt/executor.rb +15 -2
- data/lib/bolt/pal.rb +3 -1
- data/lib/bolt/puppetdb/config.rb +9 -4
- data/lib/bolt/transport/local.rb +3 -2
- data/lib/bolt/transport/orch.rb +1 -1
- data/lib/bolt/transport/orch/connection.rb +1 -0
- data/lib/bolt/transport/ssh.rb +7 -2
- data/lib/bolt/transport/ssh/connection.rb +39 -19
- data/lib/bolt/transport/winrm.rb +1 -0
- data/lib/bolt/transport/winrm/connection.rb +3 -0
- data/lib/bolt/util.rb +5 -0
- data/lib/bolt/version.rb +1 -1
- data/lib/bolt_ext/puppetdb_inventory.rb +2 -1
- data/vendored/puppet/lib/puppet/defaults.rb +15 -1
- data/vendored/puppet/lib/puppet/pops/loader/static_loader.rb +0 -14
- data/vendored/puppet/lib/puppet/pops/pcore.rb +1 -1
- data/vendored/puppet/lib/puppet/type/file/mode.rb +1 -1
- data/vendored/require_vendored.rb +0 -2
- metadata +3 -21
- data/vendored/puppet/lib/puppet/external/nagios.rb +0 -46
- data/vendored/puppet/lib/puppet/external/nagios/base.rb +0 -472
- data/vendored/puppet/lib/puppet/external/nagios/parser.rb +0 -400
- data/vendored/puppet/lib/puppet/provider/naginator.rb +0 -63
- data/vendored/puppet/lib/puppet/type/nagios_command.rb +0 -3
- data/vendored/puppet/lib/puppet/type/nagios_contact.rb +0 -3
- data/vendored/puppet/lib/puppet/type/nagios_contactgroup.rb +0 -3
- data/vendored/puppet/lib/puppet/type/nagios_host.rb +0 -3
- data/vendored/puppet/lib/puppet/type/nagios_hostdependency.rb +0 -3
- data/vendored/puppet/lib/puppet/type/nagios_hostescalation.rb +0 -3
- data/vendored/puppet/lib/puppet/type/nagios_hostextinfo.rb +0 -3
- data/vendored/puppet/lib/puppet/type/nagios_hostgroup.rb +0 -3
- data/vendored/puppet/lib/puppet/type/nagios_service.rb +0 -3
- data/vendored/puppet/lib/puppet/type/nagios_servicedependency.rb +0 -3
- data/vendored/puppet/lib/puppet/type/nagios_serviceescalation.rb +0 -3
- data/vendored/puppet/lib/puppet/type/nagios_serviceextinfo.rb +0 -3
- data/vendored/puppet/lib/puppet/type/nagios_servicegroup.rb +0 -3
- data/vendored/puppet/lib/puppet/type/nagios_timeperiod.rb +0 -3
- data/vendored/puppet/lib/puppet/util/nagios_maker.rb +0 -85
data/lib/bolt/transport/winrm.rb
CHANGED
@@ -104,6 +104,7 @@ catch
|
|
104
104
|
raise "No suitable implementation of #{task.name} for #{target.name}" unless executable
|
105
105
|
|
106
106
|
input_method = task.input_method
|
107
|
+
input_method ||= powershell_file?(executable) ? 'powershell' : 'both'
|
107
108
|
with_connection(target) do |conn|
|
108
109
|
if STDIN_METHODS.include?(input_method)
|
109
110
|
stdin = JSON.dump(arguments)
|
data/lib/bolt/util.rb
CHANGED
data/lib/bolt/version.rb
CHANGED
@@ -37,7 +37,8 @@ module Bolt
|
|
37
37
|
end
|
38
38
|
opts.on('--config CONFIG',
|
39
39
|
"The puppetdb.conf file to read configuration from",
|
40
|
-
"
|
40
|
+
"Defaults: #{Bolt::PuppetDB::Config::DEFAULT_CONFIG[:user]} or",
|
41
|
+
"#{Bolt::PuppetDB::Config::DEFAULT_CONFIG[:global]} if present") do |file|
|
41
42
|
@config_file = File.expand_path(file)
|
42
43
|
end
|
43
44
|
opts.on('--output FILE', '-o FILE',
|
@@ -32,6 +32,20 @@ module Puppet
|
|
32
32
|
%w[md5 md5lite sha256 sha256lite sha384 sha512 sha224 sha1 sha1lite mtime ctime]
|
33
33
|
end
|
34
34
|
|
35
|
+
def self.default_basemodulepath
|
36
|
+
if Puppet::Util::Platform.windows?
|
37
|
+
path = ['$codedir/modules']
|
38
|
+
installdir = Facter.value(:env_windows_installdir)
|
39
|
+
if installdir
|
40
|
+
path << "#{installdir}/puppet/modules"
|
41
|
+
path << "#{installdir}/puppet/vendor_modules"
|
42
|
+
end
|
43
|
+
path.join(File::PATH_SEPARATOR)
|
44
|
+
else
|
45
|
+
'$codedir/modules:/opt/puppetlabs/puppet/modules:/opt/puppetlabs/puppet/vendor_modules'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
35
49
|
############################################################################################
|
36
50
|
# NOTE: For information about the available values for the ":type" property of settings,
|
37
51
|
# see the docs for Settings.define_settings
|
@@ -1287,7 +1301,7 @@ EOT
|
|
1287
1301
|
:desc => "File that provides mapping between custom SSL oids and user-friendly names"
|
1288
1302
|
},
|
1289
1303
|
:basemodulepath => {
|
1290
|
-
:default =>
|
1304
|
+
:default => lambda { default_basemodulepath },
|
1291
1305
|
:type => :path,
|
1292
1306
|
:desc => "The search path for **global** modules. Should be specified as a
|
1293
1307
|
list of directories separated by the system path separator character. (The
|
@@ -22,20 +22,6 @@ class StaticLoader < Loader
|
|
22
22
|
Maillist
|
23
23
|
Mcx
|
24
24
|
Mount
|
25
|
-
Nagios_command
|
26
|
-
Nagios_contact
|
27
|
-
Nagios_contactgroup
|
28
|
-
Nagios_host
|
29
|
-
Nagios_hostdependency
|
30
|
-
Nagios_hostescalation
|
31
|
-
Nagios_hostgroup
|
32
|
-
Nagios_hostextinfo
|
33
|
-
Nagios_service
|
34
|
-
Nagios_servicedependency
|
35
|
-
Nagios_serviceescalation
|
36
|
-
Nagios_serviceextinfo
|
37
|
-
Nagios_servicegroup
|
38
|
-
Nagios_timeperiod
|
39
25
|
Node
|
40
26
|
Notify
|
41
27
|
Package
|
@@ -40,7 +40,7 @@ module Puppet
|
|
40
40
|
Symbolic modes should be represented as a string of comma-separated
|
41
41
|
permission clauses, in the form `<WHO><OP><PERM>`:
|
42
42
|
|
43
|
-
* "Who" should be u (user), g (group), o (other),
|
43
|
+
* "Who" should be any combination of u (user), g (group), and o (other), or a (all)
|
44
44
|
* "Op" should be = (set exact permissions), + (add select permissions),
|
45
45
|
or - (remove select permissions)
|
46
46
|
* "Perm" should be one or more of:
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bolt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.20.
|
4
|
+
version: 0.20.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: addressable
|
@@ -350,6 +350,7 @@ files:
|
|
350
350
|
- exe/bolt
|
351
351
|
- exe/bolt-inventory-pdb
|
352
352
|
- lib/bolt.rb
|
353
|
+
- lib/bolt/analytics.rb
|
353
354
|
- lib/bolt/cli.rb
|
354
355
|
- lib/bolt/config.rb
|
355
356
|
- lib/bolt/error.rb
|
@@ -626,9 +627,6 @@ files:
|
|
626
627
|
- vendored/puppet/lib/puppet/error.rb
|
627
628
|
- vendored/puppet/lib/puppet/etc.rb
|
628
629
|
- vendored/puppet/lib/puppet/external/dot.rb
|
629
|
-
- vendored/puppet/lib/puppet/external/nagios.rb
|
630
|
-
- vendored/puppet/lib/puppet/external/nagios/base.rb
|
631
|
-
- vendored/puppet/lib/puppet/external/nagios/parser.rb
|
632
630
|
- vendored/puppet/lib/puppet/external/pson/common.rb
|
633
631
|
- vendored/puppet/lib/puppet/external/pson/pure.rb
|
634
632
|
- vendored/puppet/lib/puppet/external/pson/pure/generator.rb
|
@@ -1269,7 +1267,6 @@ files:
|
|
1269
1267
|
- vendored/puppet/lib/puppet/provider/mcx/mcxcontent.rb
|
1270
1268
|
- vendored/puppet/lib/puppet/provider/mount.rb
|
1271
1269
|
- vendored/puppet/lib/puppet/provider/mount/parsed.rb
|
1272
|
-
- vendored/puppet/lib/puppet/provider/naginator.rb
|
1273
1270
|
- vendored/puppet/lib/puppet/provider/nameservice.rb
|
1274
1271
|
- vendored/puppet/lib/puppet/provider/nameservice/directoryservice.rb
|
1275
1272
|
- vendored/puppet/lib/puppet/provider/nameservice/objectadd.rb
|
@@ -1471,20 +1468,6 @@ files:
|
|
1471
1468
|
- vendored/puppet/lib/puppet/type/maillist.rb
|
1472
1469
|
- vendored/puppet/lib/puppet/type/mcx.rb
|
1473
1470
|
- vendored/puppet/lib/puppet/type/mount.rb
|
1474
|
-
- vendored/puppet/lib/puppet/type/nagios_command.rb
|
1475
|
-
- vendored/puppet/lib/puppet/type/nagios_contact.rb
|
1476
|
-
- vendored/puppet/lib/puppet/type/nagios_contactgroup.rb
|
1477
|
-
- vendored/puppet/lib/puppet/type/nagios_host.rb
|
1478
|
-
- vendored/puppet/lib/puppet/type/nagios_hostdependency.rb
|
1479
|
-
- vendored/puppet/lib/puppet/type/nagios_hostescalation.rb
|
1480
|
-
- vendored/puppet/lib/puppet/type/nagios_hostextinfo.rb
|
1481
|
-
- vendored/puppet/lib/puppet/type/nagios_hostgroup.rb
|
1482
|
-
- vendored/puppet/lib/puppet/type/nagios_service.rb
|
1483
|
-
- vendored/puppet/lib/puppet/type/nagios_servicedependency.rb
|
1484
|
-
- vendored/puppet/lib/puppet/type/nagios_serviceescalation.rb
|
1485
|
-
- vendored/puppet/lib/puppet/type/nagios_serviceextinfo.rb
|
1486
|
-
- vendored/puppet/lib/puppet/type/nagios_servicegroup.rb
|
1487
|
-
- vendored/puppet/lib/puppet/type/nagios_timeperiod.rb
|
1488
1471
|
- vendored/puppet/lib/puppet/type/notify.rb
|
1489
1472
|
- vendored/puppet/lib/puppet/type/package.rb
|
1490
1473
|
- vendored/puppet/lib/puppet/type/resources.rb
|
@@ -1548,7 +1531,6 @@ files:
|
|
1548
1531
|
- vendored/puppet/lib/puppet/util/metric.rb
|
1549
1532
|
- vendored/puppet/lib/puppet/util/monkey_patches.rb
|
1550
1533
|
- vendored/puppet/lib/puppet/util/multi_match.rb
|
1551
|
-
- vendored/puppet/lib/puppet/util/nagios_maker.rb
|
1552
1534
|
- vendored/puppet/lib/puppet/util/network_device.rb
|
1553
1535
|
- vendored/puppet/lib/puppet/util/network_device/base.rb
|
1554
1536
|
- vendored/puppet/lib/puppet/util/network_device/cisco.rb
|
@@ -1,46 +0,0 @@
|
|
1
|
-
#--------------------
|
2
|
-
# A script to retrieve hosts from ldap and create an importable
|
3
|
-
# cfservd file from them
|
4
|
-
|
5
|
-
require 'digest/md5'
|
6
|
-
#require 'ldap'
|
7
|
-
require 'puppet/external/nagios/parser.rb'
|
8
|
-
require 'puppet/external/nagios/base.rb'
|
9
|
-
|
10
|
-
module Nagios
|
11
|
-
NAGIOSVERSION = '1.1'
|
12
|
-
# yay colors
|
13
|
-
PINK = "[0;31m"
|
14
|
-
GREEN = "[0;32m"
|
15
|
-
YELLOW = "[0;33m"
|
16
|
-
SLATE = "[0;34m"
|
17
|
-
ORANGE = "[0;35m"
|
18
|
-
BLUE = "[0;36m"
|
19
|
-
NOCOLOR = "[0m"
|
20
|
-
RESET = "[0m"
|
21
|
-
|
22
|
-
def self.version
|
23
|
-
NAGIOSVERSION
|
24
|
-
end
|
25
|
-
|
26
|
-
class Config
|
27
|
-
def Config.import(config)
|
28
|
-
|
29
|
-
text = String.new
|
30
|
-
|
31
|
-
File.open(config) { |file|
|
32
|
-
file.each { |line|
|
33
|
-
text += line
|
34
|
-
}
|
35
|
-
}
|
36
|
-
parser = Nagios::Parser.new
|
37
|
-
parser.parse(text)
|
38
|
-
end
|
39
|
-
|
40
|
-
def Config.each
|
41
|
-
Nagios::Object.objects.each { |object|
|
42
|
-
yield object
|
43
|
-
}
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
@@ -1,472 +0,0 @@
|
|
1
|
-
# The base class for all of our Nagios object types. Everything else
|
2
|
-
# is mostly just data.
|
3
|
-
class Nagios::Base
|
4
|
-
|
5
|
-
class UnknownNagiosType < RuntimeError # When an unknown type is asked for by name.
|
6
|
-
end
|
7
|
-
|
8
|
-
include Enumerable
|
9
|
-
|
10
|
-
class << self
|
11
|
-
attr_accessor :parameters, :derivatives, :ocs, :name, :att
|
12
|
-
attr_accessor :ldapbase
|
13
|
-
|
14
|
-
attr_writer :namevar
|
15
|
-
|
16
|
-
attr_reader :superior
|
17
|
-
end
|
18
|
-
|
19
|
-
# Attach one class to another.
|
20
|
-
def self.attach(hash)
|
21
|
-
@attach ||= {}
|
22
|
-
hash.each do |n, v| @attach[n] = v end
|
23
|
-
end
|
24
|
-
|
25
|
-
# Convert a parameter to camelcase
|
26
|
-
def self.camelcase(param)
|
27
|
-
param.gsub(/_./) do |match|
|
28
|
-
match.sub(/_/,'').capitalize
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
# Uncamelcase a parameter.
|
33
|
-
def self.decamelcase(param)
|
34
|
-
param.gsub(/[A-Z]/) do |match|
|
35
|
-
"_#{match.downcase}"
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
# Create a new instance of a given class.
|
40
|
-
def self.create(name, args = {})
|
41
|
-
name = name.intern if name.is_a? String
|
42
|
-
|
43
|
-
if @types.include?(name)
|
44
|
-
@types[name].new(args)
|
45
|
-
else
|
46
|
-
raise UnknownNagiosType, "Unknown type #{name}"
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# Yield each type in turn.
|
51
|
-
def self.eachtype
|
52
|
-
@types.each do |name, type|
|
53
|
-
yield [name, type]
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
|
-
# Create a mapping.
|
58
|
-
def self.map(hash)
|
59
|
-
@map ||= {}
|
60
|
-
hash.each do |n, v| @map[n] = v end
|
61
|
-
end
|
62
|
-
|
63
|
-
# Return a mapping (or nil) for a param
|
64
|
-
def self.mapping(name)
|
65
|
-
name = name.intern if name.is_a? String
|
66
|
-
if defined?(@map)
|
67
|
-
@map[name]
|
68
|
-
else
|
69
|
-
nil
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
# Return the namevar for the canonical name.
|
74
|
-
def self.namevar
|
75
|
-
if defined?(@namevar)
|
76
|
-
return @namevar
|
77
|
-
else
|
78
|
-
if parameter?(:name)
|
79
|
-
return :name
|
80
|
-
elsif tmp = (self.name.to_s + "_name").intern and parameter?(tmp)
|
81
|
-
@namevar = tmp
|
82
|
-
return @namevar
|
83
|
-
else
|
84
|
-
raise "Type #{self.name} has no name var"
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
|
89
|
-
# Create a new type.
|
90
|
-
def self.newtype(name, &block)
|
91
|
-
name = name.intern if name.is_a? String
|
92
|
-
|
93
|
-
@types ||= {}
|
94
|
-
|
95
|
-
# Create the class, with the correct name.
|
96
|
-
t = Class.new(self)
|
97
|
-
t.name = name
|
98
|
-
|
99
|
-
# Everyone gets this. There should probably be a better way, and I
|
100
|
-
# should probably hack the attribute system to look things up based on
|
101
|
-
# this "use" setting, but, eh.
|
102
|
-
t.parameters = [:use]
|
103
|
-
|
104
|
-
const_set(name.to_s.capitalize,t)
|
105
|
-
|
106
|
-
# Evaluate the passed block. This should usually define all of the work.
|
107
|
-
t.class_eval(&block)
|
108
|
-
|
109
|
-
@types[name] = t
|
110
|
-
end
|
111
|
-
|
112
|
-
# Define both the normal case and camelcase method for a parameter
|
113
|
-
def self.paramattr(name)
|
114
|
-
camel = camelcase(name)
|
115
|
-
param = name
|
116
|
-
|
117
|
-
[name, camel].each do |method|
|
118
|
-
define_method(method) do
|
119
|
-
@parameters[param]
|
120
|
-
end
|
121
|
-
|
122
|
-
define_method(method.to_s + "=") do |value|
|
123
|
-
@parameters[param] = value
|
124
|
-
end
|
125
|
-
end
|
126
|
-
|
127
|
-
end
|
128
|
-
|
129
|
-
# Is the specified name a valid parameter?
|
130
|
-
def self.parameter?(name)
|
131
|
-
name = name.intern if name.is_a? String
|
132
|
-
@parameters.include?(name)
|
133
|
-
end
|
134
|
-
|
135
|
-
# Manually set the namevar
|
136
|
-
def self.setnamevar(name)
|
137
|
-
name = name.intern if name.is_a? String
|
138
|
-
@namevar = name
|
139
|
-
end
|
140
|
-
|
141
|
-
# Set the valid parameters for this class
|
142
|
-
def self.setparameters(*array)
|
143
|
-
@parameters += array
|
144
|
-
end
|
145
|
-
|
146
|
-
# Set the superior ldap object class. Seems silly to include this
|
147
|
-
# in this class, but, eh.
|
148
|
-
def self.setsuperior(name)
|
149
|
-
@superior = name
|
150
|
-
end
|
151
|
-
|
152
|
-
# Parameters to suppress in output.
|
153
|
-
def self.suppress(name)
|
154
|
-
@suppress ||= []
|
155
|
-
@suppress << name
|
156
|
-
end
|
157
|
-
|
158
|
-
# Whether a given parameter is suppressed.
|
159
|
-
def self.suppress?(name)
|
160
|
-
defined?(@suppress) and @suppress.include?(name)
|
161
|
-
end
|
162
|
-
|
163
|
-
# Return our name as the string.
|
164
|
-
def self.to_s
|
165
|
-
self.name.to_s
|
166
|
-
end
|
167
|
-
|
168
|
-
# Return a type by name.
|
169
|
-
def self.type(name)
|
170
|
-
name = name.intern if name.is_a? String
|
171
|
-
|
172
|
-
@types[name]
|
173
|
-
end
|
174
|
-
|
175
|
-
# Convenience methods.
|
176
|
-
def [](param)
|
177
|
-
send(param)
|
178
|
-
end
|
179
|
-
|
180
|
-
# Convenience methods.
|
181
|
-
def []=(param,value)
|
182
|
-
send(param.to_s + "=", value)
|
183
|
-
end
|
184
|
-
|
185
|
-
# Iterate across all ofour set parameters.
|
186
|
-
def each
|
187
|
-
@parameters.each { |param,value|
|
188
|
-
yield(param,value)
|
189
|
-
}
|
190
|
-
end
|
191
|
-
|
192
|
-
# Initialize our object, optionally with a list of parameters.
|
193
|
-
def initialize(args = {})
|
194
|
-
@parameters = {}
|
195
|
-
|
196
|
-
args.each { |param,value|
|
197
|
-
self[param] = value
|
198
|
-
}
|
199
|
-
if @namevar == :_naginator_name
|
200
|
-
self['_naginator_name'] = self['name']
|
201
|
-
end
|
202
|
-
end
|
203
|
-
|
204
|
-
# Handle parameters like attributes.
|
205
|
-
def method_missing(mname, *args)
|
206
|
-
pname = mname.to_s
|
207
|
-
pname.sub!(/=/, '')
|
208
|
-
|
209
|
-
if self.class.parameter?(pname)
|
210
|
-
if pname =~ /A-Z/
|
211
|
-
pname = self.class.decamelcase(pname)
|
212
|
-
end
|
213
|
-
self.class.paramattr(pname)
|
214
|
-
|
215
|
-
# Now access the parameters directly, to make it at least less
|
216
|
-
# likely we'll end up in an infinite recursion.
|
217
|
-
if mname.to_s =~ /=$/
|
218
|
-
@parameters[pname] = args.first
|
219
|
-
else
|
220
|
-
return @parameters[mname]
|
221
|
-
end
|
222
|
-
else
|
223
|
-
super
|
224
|
-
end
|
225
|
-
end
|
226
|
-
|
227
|
-
# Retrieve our name, through a bit of redirection.
|
228
|
-
def name
|
229
|
-
send(self.class.namevar)
|
230
|
-
end
|
231
|
-
|
232
|
-
# This is probably a bad idea.
|
233
|
-
def name=(value)
|
234
|
-
unless self.class.namevar.to_s == "name"
|
235
|
-
send(self.class.namevar.to_s + "=", value)
|
236
|
-
end
|
237
|
-
end
|
238
|
-
|
239
|
-
def namevar
|
240
|
-
(self.type + "_name").intern
|
241
|
-
end
|
242
|
-
|
243
|
-
def parammap(param)
|
244
|
-
unless defined?(@map)
|
245
|
-
map = {
|
246
|
-
self.namevar => "cn"
|
247
|
-
}
|
248
|
-
map.update(self.class.map) if self.class.map
|
249
|
-
end
|
250
|
-
if map.include?(param)
|
251
|
-
return map[param]
|
252
|
-
else
|
253
|
-
return "nagios-" + param.id2name.gsub(/_/,'-')
|
254
|
-
end
|
255
|
-
end
|
256
|
-
|
257
|
-
def parent
|
258
|
-
unless defined?(self.class.attached)
|
259
|
-
puts "Duh, you called parent on an unattached class"
|
260
|
-
return
|
261
|
-
end
|
262
|
-
|
263
|
-
klass,param = self.class.attached
|
264
|
-
unless @parameters.include?(param)
|
265
|
-
puts "Huh, no attachment param"
|
266
|
-
return
|
267
|
-
end
|
268
|
-
klass[@parameters[param]]
|
269
|
-
end
|
270
|
-
|
271
|
-
# okay, this sucks
|
272
|
-
# how do i get my list of ocs?
|
273
|
-
def to_ldif
|
274
|
-
str = self.dn + "\n"
|
275
|
-
ocs = Array.new
|
276
|
-
if self.class.ocs
|
277
|
-
# i'm storing an array, so i have to flatten it and stuff
|
278
|
-
kocs = self.class.ocs
|
279
|
-
ocs.push(*kocs)
|
280
|
-
end
|
281
|
-
ocs.push "top"
|
282
|
-
oc = self.class.to_s
|
283
|
-
oc.sub!(/Nagios/,'nagios')
|
284
|
-
oc.sub!(/::/,'')
|
285
|
-
ocs.push oc
|
286
|
-
ocs.each { |objclass|
|
287
|
-
str += "objectclass: #{objclass}\n"
|
288
|
-
}
|
289
|
-
@parameters.each { |name,value|
|
290
|
-
next if self.class.suppress.include?(name)
|
291
|
-
ldapname = self.parammap(name)
|
292
|
-
str += ldapname + ": #{value}\n"
|
293
|
-
}
|
294
|
-
str += "\n"
|
295
|
-
end
|
296
|
-
|
297
|
-
def to_s
|
298
|
-
str = "define #{self.type} {\n"
|
299
|
-
|
300
|
-
@parameters.keys.sort.each { |param|
|
301
|
-
value = @parameters[param]
|
302
|
-
str += %{\t%-30s %s\n} % [ param,
|
303
|
-
if value.is_a? Array
|
304
|
-
value.join(",").sub(';', '\;')
|
305
|
-
else
|
306
|
-
value.to_s.sub(';', '\;')
|
307
|
-
end
|
308
|
-
]
|
309
|
-
}
|
310
|
-
|
311
|
-
str += "}\n"
|
312
|
-
|
313
|
-
str
|
314
|
-
end
|
315
|
-
|
316
|
-
# The type of object we are.
|
317
|
-
def type
|
318
|
-
self.class.name
|
319
|
-
end
|
320
|
-
|
321
|
-
# object types
|
322
|
-
newtype :host do
|
323
|
-
setparameters :host_name, :alias, :display_name, :address, :parents,
|
324
|
-
:hostgroups, :check_command, :initial_state, :max_check_attempts,
|
325
|
-
:check_interval, :retry_interval, :active_checks_enabled,
|
326
|
-
:passive_checks_enabled, :check_period, :obsess_over_host,
|
327
|
-
:check_freshness, :freshness_threshold, :event_handler,
|
328
|
-
:event_handler_enabled, :low_flap_threshold, :high_flap_threshold,
|
329
|
-
:flap_detection_enabled, :flap_detection_options,
|
330
|
-
:failure_prediction_enabled, :process_perf_data,
|
331
|
-
:retain_status_information, :retain_nonstatus_information, :contacts,
|
332
|
-
:contact_groups, :notification_interval, :first_notification_delay,
|
333
|
-
:notification_period, :notification_options, :notifications_enabled,
|
334
|
-
:stalking_options, :notes, :notes_url, :action_url, :icon_image,
|
335
|
-
:icon_image_alt, :vrml_image, :statusmap_image, "2d_coords".intern,
|
336
|
-
"3d_coords".intern,
|
337
|
-
:register, :use,
|
338
|
-
:realm, :poller_tag, :business_impact
|
339
|
-
|
340
|
-
setsuperior "person"
|
341
|
-
map :address => "ipHostNumber"
|
342
|
-
end
|
343
|
-
|
344
|
-
newtype :hostgroup do
|
345
|
-
setparameters :hostgroup_name, :alias, :members, :hostgroup_members, :notes,
|
346
|
-
:notes_url, :action_url,
|
347
|
-
:register, :use,
|
348
|
-
:realm
|
349
|
-
end
|
350
|
-
|
351
|
-
newtype :service do
|
352
|
-
attach :host => :host_name
|
353
|
-
setparameters :host_name, :hostgroup_name, :service_description,
|
354
|
-
:display_name, :servicegroups, :is_volatile, :check_command,
|
355
|
-
:initial_state, :max_check_attempts, :check_interval, :retry_interval,
|
356
|
-
:normal_check_interval, :retry_check_interval, :active_checks_enabled,
|
357
|
-
:passive_checks_enabled, :parallelize_check, :check_period,
|
358
|
-
:obsess_over_service, :check_freshness, :freshness_threshold,
|
359
|
-
:event_handler, :event_handler_enabled, :low_flap_threshold,
|
360
|
-
:high_flap_threshold, :flap_detection_enabled,:flap_detection_options,
|
361
|
-
:process_perf_data, :failure_prediction_enabled, :retain_status_information,
|
362
|
-
:retain_nonstatus_information, :notification_interval,
|
363
|
-
:first_notification_delay, :notification_period, :notification_options,
|
364
|
-
:notifications_enabled, :contacts, :contact_groups, :stalking_options,
|
365
|
-
:notes, :notes_url, :action_url, :icon_image, :icon_image_alt,
|
366
|
-
:register, :use,
|
367
|
-
:_naginator_name,
|
368
|
-
:poller_tag, :business_impact
|
369
|
-
|
370
|
-
suppress :host_name
|
371
|
-
|
372
|
-
setnamevar :_naginator_name
|
373
|
-
end
|
374
|
-
|
375
|
-
newtype :servicegroup do
|
376
|
-
setparameters :servicegroup_name, :alias, :members, :servicegroup_members,
|
377
|
-
:notes, :notes_url, :action_url,
|
378
|
-
:register, :use
|
379
|
-
end
|
380
|
-
|
381
|
-
newtype :contact do
|
382
|
-
setparameters :contact_name, :alias, :contactgroups,
|
383
|
-
:host_notifications_enabled, :service_notifications_enabled,
|
384
|
-
:host_notification_period, :service_notification_period,
|
385
|
-
:host_notification_options, :service_notification_options,
|
386
|
-
:host_notification_commands, :service_notification_commands,
|
387
|
-
:email, :pager, :address1, :address2, :address3, :address4,
|
388
|
-
:address5, :address6, :can_submit_commands, :retain_status_information,
|
389
|
-
:retain_nonstatus_information,
|
390
|
-
:register, :use
|
391
|
-
|
392
|
-
setsuperior "person"
|
393
|
-
end
|
394
|
-
|
395
|
-
newtype :contactgroup do
|
396
|
-
setparameters :contactgroup_name, :alias, :members, :contactgroup_members,
|
397
|
-
:register, :use
|
398
|
-
end
|
399
|
-
|
400
|
-
# TODO - We should support generic time periods here eg "day 1 - 15"
|
401
|
-
newtype :timeperiod do
|
402
|
-
setparameters :timeperiod_name, :alias, :sunday, :monday, :tuesday,
|
403
|
-
:wednesday, :thursday, :friday, :saturday, :exclude,
|
404
|
-
:register, :use
|
405
|
-
end
|
406
|
-
|
407
|
-
newtype :command do
|
408
|
-
setparameters :command_name, :command_line,
|
409
|
-
:poller_tag
|
410
|
-
end
|
411
|
-
|
412
|
-
newtype :servicedependency do
|
413
|
-
setparameters :dependent_host_name, :dependent_hostgroup_name,
|
414
|
-
:dependent_service_description, :host_name, :hostgroup_name,
|
415
|
-
:service_description, :inherits_parent, :execution_failure_criteria,
|
416
|
-
:notification_failure_criteria, :dependency_period,
|
417
|
-
:register, :use,
|
418
|
-
:_naginator_name
|
419
|
-
|
420
|
-
setnamevar :_naginator_name
|
421
|
-
end
|
422
|
-
|
423
|
-
newtype :serviceescalation do
|
424
|
-
setparameters :host_name, :hostgroup_name, :servicegroup_name,
|
425
|
-
:service_description, :contacts, :contact_groups,
|
426
|
-
:first_notification, :last_notification, :notification_interval,
|
427
|
-
:escalation_period, :escalation_options,
|
428
|
-
:register, :use,
|
429
|
-
:_naginator_name
|
430
|
-
|
431
|
-
setnamevar :_naginator_name
|
432
|
-
end
|
433
|
-
|
434
|
-
newtype :hostdependency do
|
435
|
-
setparameters :dependent_host_name, :dependent_hostgroup_name, :host_name,
|
436
|
-
:hostgroup_name, :inherits_parent, :execution_failure_criteria,
|
437
|
-
:notification_failure_criteria, :dependency_period,
|
438
|
-
:register, :use,
|
439
|
-
:_naginator_name
|
440
|
-
|
441
|
-
setnamevar :_naginator_name
|
442
|
-
end
|
443
|
-
|
444
|
-
newtype :hostescalation do
|
445
|
-
setparameters :host_name, :hostgroup_name, :contacts, :contact_groups,
|
446
|
-
:first_notification, :last_notification, :notification_interval,
|
447
|
-
:escalation_period, :escalation_options,
|
448
|
-
:register, :use,
|
449
|
-
:_naginator_name
|
450
|
-
|
451
|
-
setnamevar :_naginator_name
|
452
|
-
end
|
453
|
-
|
454
|
-
newtype :hostextinfo do
|
455
|
-
setparameters :host_name, :notes, :notes_url, :icon_image, :icon_image_alt,
|
456
|
-
:vrml_image, :statusmap_image, "2d_coords".intern, "3d_coords".intern,
|
457
|
-
:register, :use
|
458
|
-
|
459
|
-
setnamevar :host_name
|
460
|
-
end
|
461
|
-
|
462
|
-
newtype :serviceextinfo do
|
463
|
-
|
464
|
-
setparameters :host_name, :service_description, :notes, :notes_url,
|
465
|
-
:action_url, :icon_image, :icon_image_alt,
|
466
|
-
:register, :use,
|
467
|
-
:_naginator_name
|
468
|
-
|
469
|
-
setnamevar :_naginator_name
|
470
|
-
end
|
471
|
-
|
472
|
-
end
|