puppet 0.9.2 → 0.13.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +58 -0
- data/README +21 -18
- data/Rakefile +176 -36
- data/bin/puppet +34 -48
- data/bin/puppetca +41 -28
- data/bin/puppetd +87 -65
- data/bin/puppetdoc +99 -23
- data/bin/puppetmasterd +72 -91
- data/conf/redhat/client.init +80 -0
- data/conf/redhat/client.sysconfig +11 -0
- data/conf/redhat/fileserver.conf +12 -0
- data/conf/redhat/puppet.spec +130 -0
- data/conf/redhat/server.init +89 -0
- data/conf/redhat/server.sysconfig +9 -0
- data/examples/code/allatonce +2 -2
- data/examples/code/assignments +1 -1
- data/examples/code/classing +2 -2
- data/examples/code/components +2 -2
- data/examples/code/file.bl +5 -5
- data/examples/code/filedefaults +2 -2
- data/examples/code/fileparsing +1 -1
- data/examples/code/filerecursion +1 -1
- data/examples/code/functions +1 -1
- data/examples/code/groups +1 -1
- data/examples/code/importing +1 -1
- data/examples/code/nodes +1 -1
- data/examples/code/one +1 -1
- data/examples/code/relationships +2 -2
- data/examples/code/simpletests +5 -5
- data/examples/code/snippets/argumentdefaults +2 -2
- data/examples/code/snippets/casestatement +16 -8
- data/examples/code/snippets/classheirarchy.pp +4 -4
- data/examples/code/snippets/classincludes.pp +4 -4
- data/examples/code/snippets/classpathtest +2 -2
- data/examples/code/snippets/componentmetaparams.pp +11 -0
- data/examples/code/snippets/dirchmod +5 -5
- data/examples/code/snippets/emptyclass.pp +9 -0
- data/examples/code/snippets/failmissingexecpath.pp +1 -1
- data/examples/code/snippets/falsevalues.pp +1 -1
- data/examples/code/snippets/filecreate +5 -5
- data/examples/code/snippets/implicititeration +5 -5
- data/examples/code/snippets/multipleinstances +4 -4
- data/examples/code/snippets/namevartest +3 -3
- data/examples/code/snippets/scopetest +1 -1
- data/examples/code/snippets/selectorvalues.pp +3 -3
- data/examples/code/snippets/simpledefaults +2 -2
- data/examples/code/snippets/simpleselector +5 -5
- data/examples/code/snippets/singleary.pp +19 -0
- data/examples/root/etc/init.d/sleeper +3 -2
- data/ext/emacs/puppet-mode-init.el +6 -0
- data/ext/emacs/puppet-mode.el +189 -0
- data/ext/ldap/puppet.schema +17 -0
- data/ext/{module:puppet → module_puppet} +30 -31
- data/ext/vim/filetype.vim +9 -0
- data/ext/vim/puppet.vim +87 -0
- data/install.rb +63 -30
- data/lib/puppet.rb +216 -122
- data/lib/puppet/client.rb +51 -416
- data/lib/puppet/client/ca.rb +17 -0
- data/lib/puppet/client/dipper.rb +78 -0
- data/lib/puppet/client/file.rb +20 -0
- data/lib/puppet/client/log.rb +17 -0
- data/lib/puppet/client/master.rb +246 -0
- data/lib/puppet/client/proxy.rb +27 -0
- data/lib/puppet/client/status.rb +7 -0
- data/lib/puppet/config.rb +563 -13
- data/lib/puppet/daemon.rb +50 -22
- data/lib/puppet/element.rb +4 -4
- data/lib/puppet/event-loop.rb +1 -0
- data/lib/puppet/event-loop/better-definers.rb +367 -0
- data/lib/puppet/event-loop/event-loop.rb +355 -0
- data/lib/puppet/event-loop/signal-system.rb +220 -0
- data/lib/puppet/event.rb +9 -11
- data/lib/puppet/filetype.rb +195 -0
- data/lib/puppet/log.rb +35 -12
- data/lib/puppet/metric.rb +2 -2
- data/lib/puppet/networkclient.rb +145 -0
- data/lib/puppet/parameter.rb +335 -0
- data/lib/puppet/parser/ast.rb +42 -1453
- data/lib/puppet/parser/ast/astarray.rb +88 -0
- data/lib/puppet/parser/ast/branch.rb +47 -0
- data/lib/puppet/parser/ast/caseopt.rb +66 -0
- data/lib/puppet/parser/ast/casestatement.rb +78 -0
- data/lib/puppet/parser/ast/classdef.rb +78 -0
- data/lib/puppet/parser/ast/compdef.rb +111 -0
- data/lib/puppet/parser/ast/component.rb +105 -0
- data/lib/puppet/parser/ast/hostclass.rb +82 -0
- data/lib/puppet/parser/ast/leaf.rb +86 -0
- data/lib/puppet/parser/ast/node.rb +103 -0
- data/lib/puppet/parser/ast/nodedef.rb +68 -0
- data/lib/puppet/parser/ast/objectdef.rb +336 -0
- data/lib/puppet/parser/ast/objectparam.rb +30 -0
- data/lib/puppet/parser/ast/objectref.rb +76 -0
- data/lib/puppet/parser/ast/selector.rb +60 -0
- data/lib/puppet/parser/ast/typedefaults.rb +45 -0
- data/lib/puppet/parser/ast/vardef.rb +44 -0
- data/lib/puppet/parser/interpreter.rb +31 -14
- data/lib/puppet/parser/lexer.rb +2 -4
- data/lib/puppet/parser/parser.rb +332 -242
- data/lib/puppet/parser/scope.rb +55 -38
- data/lib/puppet/server.rb +43 -44
- data/lib/puppet/server/authstore.rb +3 -6
- data/lib/puppet/server/ca.rb +5 -2
- data/lib/puppet/server/filebucket.rb +2 -4
- data/lib/puppet/server/fileserver.rb +28 -12
- data/lib/puppet/server/logger.rb +15 -4
- data/lib/puppet/server/master.rb +62 -7
- data/lib/puppet/sslcertificates.rb +41 -607
- data/lib/puppet/sslcertificates/ca.rb +291 -0
- data/lib/puppet/sslcertificates/certificate.rb +283 -0
- data/lib/puppet/statechange.rb +6 -1
- data/lib/puppet/storage.rb +67 -56
- data/lib/puppet/transaction.rb +25 -9
- data/lib/puppet/transportable.rb +102 -22
- data/lib/puppet/type.rb +1096 -315
- data/lib/puppet/type/component.rb +30 -21
- data/lib/puppet/type/cron.rb +409 -448
- data/lib/puppet/type/exec.rb +234 -174
- data/lib/puppet/type/group.rb +65 -82
- data/lib/puppet/type/nameservice.rb +247 -3
- data/lib/puppet/type/nameservice/netinfo.rb +29 -40
- data/lib/puppet/type/nameservice/objectadd.rb +52 -66
- data/lib/puppet/type/nameservice/posix.rb +6 -194
- data/lib/puppet/type/package.rb +447 -295
- data/lib/puppet/type/package/apt.rb +51 -50
- data/lib/puppet/type/package/bsd.rb +82 -0
- data/lib/puppet/type/package/dpkg.rb +85 -88
- data/lib/puppet/type/package/rpm.rb +67 -63
- data/lib/puppet/type/package/sun.rb +119 -98
- data/lib/puppet/type/package/yum.rb +41 -37
- data/lib/puppet/type/parsedtype.rb +295 -0
- data/lib/puppet/type/parsedtype/host.rb +143 -0
- data/lib/puppet/type/parsedtype/port.rb +232 -0
- data/lib/puppet/type/parsedtype/sshkey.rb +129 -0
- data/lib/puppet/type/pfile.rb +484 -460
- data/lib/puppet/type/pfile/checksum.rb +237 -181
- data/lib/puppet/type/pfile/content.rb +67 -0
- data/lib/puppet/type/pfile/ensure.rb +212 -0
- data/lib/puppet/type/pfile/group.rb +106 -105
- data/lib/puppet/type/pfile/mode.rb +98 -101
- data/lib/puppet/type/pfile/source.rb +228 -209
- data/lib/puppet/type/pfile/type.rb +18 -21
- data/lib/puppet/type/pfile/uid.rb +127 -130
- data/lib/puppet/type/pfilebucket.rb +68 -63
- data/lib/puppet/type/schedule.rb +341 -0
- data/lib/puppet/type/service.rb +351 -255
- data/lib/puppet/type/service/base.rb +9 -14
- data/lib/puppet/type/service/debian.rb +32 -38
- data/lib/puppet/type/service/init.rb +130 -130
- data/lib/puppet/type/service/smf.rb +48 -20
- data/lib/puppet/type/state.rb +229 -16
- data/lib/puppet/type/symlink.rb +51 -63
- data/lib/puppet/type/tidy.rb +105 -102
- data/lib/puppet/type/user.rb +118 -180
- data/lib/puppet/util.rb +100 -6
- data/test/certmgr/certmgr.rb +0 -1
- data/test/client/client.rb +4 -4
- data/test/executables/puppetbin.rb +7 -14
- data/test/executables/puppetca.rb +18 -24
- data/test/executables/puppetd.rb +7 -16
- data/test/executables/puppetmasterd.rb +7 -9
- data/test/executables/puppetmodule.rb +11 -16
- data/test/language/ast.rb +11 -7
- data/test/language/interpreter.rb +1 -1
- data/test/language/scope.rb +2 -0
- data/test/language/snippets.rb +30 -5
- data/test/language/transportable.rb +77 -0
- data/test/other/config.rb +316 -0
- data/test/other/events.rb +22 -21
- data/test/other/log.rb +14 -14
- data/test/other/metrics.rb +4 -8
- data/test/other/overrides.rb +5 -5
- data/test/other/relationships.rb +4 -2
- data/test/other/storage.rb +64 -3
- data/test/other/transactions.rb +20 -20
- data/test/parser/parser.rb +7 -4
- data/test/puppet/conffiles.rb +12 -12
- data/test/puppet/defaults.rb +13 -11
- data/test/puppet/utiltest.rb +14 -11
- data/test/puppettest.rb +156 -48
- data/test/server/bucket.rb +2 -2
- data/test/server/fileserver.rb +6 -6
- data/test/server/logger.rb +19 -11
- data/test/server/master.rb +33 -4
- data/test/server/server.rb +2 -7
- data/test/types/basic.rb +5 -7
- data/test/types/component.rb +22 -18
- data/test/types/cron.rb +111 -44
- data/test/types/exec.rb +116 -59
- data/test/types/file.rb +262 -137
- data/test/types/filebucket.rb +13 -15
- data/test/types/fileignoresource.rb +12 -16
- data/test/types/filesources.rb +73 -48
- data/test/types/filetype.rb +13 -15
- data/test/types/group.rb +15 -13
- data/test/types/host.rb +146 -0
- data/test/types/package.rb +74 -63
- data/test/types/port.rb +139 -0
- data/test/types/query.rb +8 -8
- data/test/types/schedule.rb +335 -0
- data/test/types/service.rb +137 -21
- data/test/types/sshkey.rb +140 -0
- data/test/types/symlink.rb +3 -5
- data/test/types/tidy.rb +5 -14
- data/test/types/type.rb +67 -11
- data/test/types/user.rb +25 -23
- metadata +186 -122
- data/lib/puppet/type/pfile/create.rb +0 -108
- data/lib/puppet/type/pprocess.rb +0 -97
- data/lib/puppet/type/typegen.rb +0 -149
- data/lib/puppet/type/typegen/filerecord.rb +0 -243
- data/lib/puppet/type/typegen/filetype.rb +0 -316
- data/test/other/state.rb +0 -106
data/lib/puppet/parser/scope.rb
CHANGED
@@ -8,7 +8,9 @@ module Puppet
|
|
8
8
|
class Scope
|
9
9
|
include Enumerable
|
10
10
|
attr_accessor :parent, :level, :interp
|
11
|
-
attr_accessor :name, :type, :topscope, :base
|
11
|
+
attr_accessor :name, :type, :topscope, :base, :keyword, :autoname
|
12
|
+
|
13
|
+
attr_accessor :top
|
12
14
|
|
13
15
|
# This is probably not all that good of an idea, but...
|
14
16
|
# This way a parent can share its tables with all of its children.
|
@@ -149,6 +151,14 @@ module Puppet
|
|
149
151
|
@level == 1
|
150
152
|
end
|
151
153
|
|
154
|
+
# Return a list of all of the defined classes.
|
155
|
+
def classlist
|
156
|
+
unless defined? @classtable
|
157
|
+
raise Puppet::DevError, "Scope did not receive class table"
|
158
|
+
end
|
159
|
+
return @classtable.keys
|
160
|
+
end
|
161
|
+
|
152
162
|
# Yield each child scope in turn
|
153
163
|
def each
|
154
164
|
@children.reject { |child|
|
@@ -187,16 +197,24 @@ module Puppet
|
|
187
197
|
# cache the results, but it's not worth it at this stage.
|
188
198
|
|
189
199
|
# Note that we evaluate the node code with its containing
|
190
|
-
# scope, not with the top scope.
|
191
|
-
|
200
|
+
# scope, not with the top scope. We also retrieve the created
|
201
|
+
# nodescope so that we can get any classes set within it
|
202
|
+
nodescope = code.safeevaluate(scope, facts)
|
192
203
|
|
193
204
|
# We don't need to worry about removing the Node code because
|
194
205
|
# it will be removed during translation.
|
195
206
|
|
196
|
-
#
|
197
|
-
#return self.to_trans
|
207
|
+
# convert the whole thing
|
198
208
|
objects = self.to_trans
|
199
209
|
|
210
|
+
# Add any evaluated classes to our top-level object
|
211
|
+
unless nodescope.classlist.empty?
|
212
|
+
objects.classes = nodescope.classlist
|
213
|
+
end
|
214
|
+
|
215
|
+
if objects.is_a?(Puppet::TransBucket)
|
216
|
+
objects.top = true
|
217
|
+
end
|
200
218
|
# I should do something to add the node as an object with tags
|
201
219
|
# but that will possibly end up with far too many tags.
|
202
220
|
#self.logtags
|
@@ -248,7 +266,15 @@ module Puppet
|
|
248
266
|
end
|
249
267
|
}
|
250
268
|
|
251
|
-
|
269
|
+
objects = self.to_trans
|
270
|
+
objects.top = true
|
271
|
+
|
272
|
+
# Add our class list
|
273
|
+
unless self.classlist.empty?
|
274
|
+
objects.classes = self.classlist
|
275
|
+
end
|
276
|
+
|
277
|
+
return objects
|
252
278
|
end
|
253
279
|
|
254
280
|
# Initialize our new scope. Defaults to having no parent and to
|
@@ -352,7 +378,6 @@ module Puppet
|
|
352
378
|
"Could not retrieve %s table at level %s" %
|
353
379
|
[type,self.level]
|
354
380
|
)
|
355
|
-
error.stack = caller
|
356
381
|
raise error
|
357
382
|
end
|
358
383
|
|
@@ -404,32 +429,32 @@ module Puppet
|
|
404
429
|
|
405
430
|
# Look up a node by name
|
406
431
|
def lookupnode(name)
|
407
|
-
Puppet.debug "Looking up type %s" % name
|
432
|
+
#Puppet.debug "Looking up type %s" % name
|
408
433
|
value = self.lookup("type",name)
|
409
434
|
if value == :undefined
|
410
435
|
return nil
|
411
436
|
else
|
412
|
-
Puppet.debug "Found
|
437
|
+
#Puppet.debug "Found node %s" % name
|
413
438
|
return value
|
414
439
|
end
|
415
440
|
end
|
416
441
|
|
417
442
|
# Look up a defined type.
|
418
443
|
def lookuptype(name)
|
419
|
-
Puppet.debug "Looking up type %s" % name
|
444
|
+
#Puppet.debug "Looking up type %s" % name
|
420
445
|
value = self.lookup("type",name)
|
421
446
|
if value == :undefined
|
422
447
|
return nil
|
423
448
|
else
|
424
|
-
Puppet.debug "Found type %s" % name
|
449
|
+
#Puppet.debug "Found type %s" % name
|
425
450
|
return value
|
426
451
|
end
|
427
452
|
end
|
428
453
|
|
429
454
|
# Look up an object by name and type.
|
430
455
|
def lookupobject(name,type)
|
431
|
-
Puppet.debug "Looking up object %s of type %s in level %s" %
|
432
|
-
|
456
|
+
#Puppet.debug "Looking up object %s of type %s in level %s" %
|
457
|
+
# [name, type, @level]
|
433
458
|
sub = proc { |table|
|
434
459
|
if table.include?(type)
|
435
460
|
if table[type].include?(name)
|
@@ -449,13 +474,12 @@ module Puppet
|
|
449
474
|
|
450
475
|
# Look up a variable. The simplest value search we do.
|
451
476
|
def lookupvar(name)
|
452
|
-
Puppet.debug "Looking up variable %s" % name
|
477
|
+
#Puppet.debug "Looking up variable %s" % name
|
453
478
|
value = self.lookup("variable", name)
|
454
479
|
if value == :undefined
|
455
480
|
error = Puppet::ParseError.new(
|
456
481
|
"Undefined variable '%s'" % name
|
457
482
|
)
|
458
|
-
error.stack = caller
|
459
483
|
raise error
|
460
484
|
else
|
461
485
|
#Puppet.debug "Value of '%s' is '%s'" % [name,value]
|
@@ -465,7 +489,7 @@ module Puppet
|
|
465
489
|
|
466
490
|
# Create a new scope.
|
467
491
|
def newscope
|
468
|
-
Puppet.debug "Creating new scope, level %s" % [self.level + 1]
|
492
|
+
#Puppet.debug "Creating new scope, level %s" % [self.level + 1]
|
469
493
|
return Puppet::Parser::Scope.new(self)
|
470
494
|
end
|
471
495
|
|
@@ -490,15 +514,14 @@ module Puppet
|
|
490
514
|
end
|
491
515
|
|
492
516
|
params.each { |ary|
|
493
|
-
Puppet.debug "Default for %s is %s => %s" %
|
494
|
-
|
517
|
+
#Puppet.debug "Default for %s is %s => %s" %
|
518
|
+
# [type,ary[0].inspect,ary[1].inspect]
|
495
519
|
if @@declarative
|
496
520
|
if table.include?(ary[0])
|
497
521
|
error = Puppet::ParseError.new(
|
498
522
|
"Default already defined for %s { %s }" %
|
499
523
|
[type,ary[0]]
|
500
524
|
)
|
501
|
-
error.stack = caller
|
502
525
|
raise error
|
503
526
|
end
|
504
527
|
else
|
@@ -534,7 +557,7 @@ module Puppet
|
|
534
557
|
end
|
535
558
|
end
|
536
559
|
#Puppet.debug("result is '%s'" % newstring)
|
537
|
-
return newstring
|
560
|
+
return newstring.gsub(/\\t/, "\t").gsub(/\\n/, "\n").gsub(/\\s/, "\s")
|
538
561
|
end
|
539
562
|
|
540
563
|
# This method will fail if the named object is already defined anywhere
|
@@ -593,14 +616,10 @@ module Puppet
|
|
593
616
|
# in scopes above, but will not allow variables in the current scope
|
594
617
|
# to be reassigned if we're declarative (which is the default).
|
595
618
|
def setvar(name,value)
|
596
|
-
Puppet.debug "Setting %s to '%s' at level %s" %
|
597
|
-
|
619
|
+
#Puppet.debug "Setting %s to '%s' at level %s" %
|
620
|
+
# [name.inspect,value,self.level]
|
598
621
|
if @@declarative and @symtable.include?(name)
|
599
|
-
|
600
|
-
"Cannot reassign variable %s" % name
|
601
|
-
)
|
602
|
-
error.stack = caller
|
603
|
-
raise error
|
622
|
+
raise Puppet::ParseError, "Cannot reassign variable %s" % name
|
604
623
|
else
|
605
624
|
if @symtable.include?(name)
|
606
625
|
Puppet.warning "Reassigning %s to %s" % [name,value]
|
@@ -691,12 +710,9 @@ module Puppet
|
|
691
710
|
@topscope.addtags(child)
|
692
711
|
results.push(child)
|
693
712
|
else
|
694
|
-
|
713
|
+
raise Puppet::DevError,
|
695
714
|
"Puppet::Parse::Scope cannot handle objects of type %s" %
|
696
715
|
child.class
|
697
|
-
)
|
698
|
-
error.stack = caller
|
699
|
-
raise error
|
700
716
|
end
|
701
717
|
}
|
702
718
|
|
@@ -714,17 +730,18 @@ module Puppet
|
|
714
730
|
|
715
731
|
# it'd be nice not to have to do this...
|
716
732
|
results.each { |result|
|
717
|
-
#Puppet.
|
733
|
+
#Puppet.warning "Result type is %s" % result.class
|
718
734
|
bucket.push(result)
|
719
735
|
}
|
720
736
|
if defined? @type
|
721
737
|
bucket.type = @type
|
722
738
|
else
|
723
|
-
|
739
|
+
raise Puppet::ParseError,
|
724
740
|
"No type for scope %s" % @name
|
725
|
-
|
726
|
-
|
727
|
-
|
741
|
+
end
|
742
|
+
|
743
|
+
if defined? @keyword
|
744
|
+
bucket.keyword = @keyword
|
728
745
|
end
|
729
746
|
#Puppet.debug(
|
730
747
|
# "TransBucket with name %s and type %s in scope %s" %
|
@@ -744,7 +761,7 @@ module Puppet
|
|
744
761
|
# [bucket.name,self.object_id]
|
745
762
|
return bucket
|
746
763
|
else
|
747
|
-
Puppet.debug "nameless scope; just returning a list"
|
764
|
+
#Puppet.debug "nameless scope; just returning a list"
|
748
765
|
return results
|
749
766
|
end
|
750
767
|
end
|
@@ -752,4 +769,4 @@ module Puppet
|
|
752
769
|
end
|
753
770
|
end
|
754
771
|
|
755
|
-
# $Id: scope.rb
|
772
|
+
# $Id: scope.rb 871 2006-02-07 05:58:00Z luke $
|
data/lib/puppet/server.rb
CHANGED
@@ -28,14 +28,12 @@ module Puppet
|
|
28
28
|
include Puppet::Daemon
|
29
29
|
|
30
30
|
def initialize(hash = {})
|
31
|
+
Puppet.info "Starting server for Puppet version %s" % Puppet.version
|
31
32
|
daemonize = nil
|
32
33
|
if hash.include?(:Daemonize)
|
33
34
|
daemonize = hash[:Daemonize]
|
34
35
|
end
|
35
36
|
|
36
|
-
if daemonize
|
37
|
-
self.daemonize
|
38
|
-
end
|
39
37
|
# FIXME we should have some kind of access control here, using
|
40
38
|
# :RequestHandler
|
41
39
|
hash[:Port] ||= Puppet[:masterport]
|
@@ -97,62 +95,63 @@ module Puppet
|
|
97
95
|
self.mount("/RPC2", Puppet::Server::Servlet, @handlers)
|
98
96
|
end
|
99
97
|
end
|
100
|
-
end
|
101
|
-
|
102
|
-
class Server
|
103
|
-
# the base class for the different handlers
|
104
|
-
class Handler
|
105
|
-
attr_accessor :server
|
106
|
-
@subclasses = []
|
107
98
|
|
108
|
-
|
109
|
-
|
110
|
-
|
99
|
+
class Server
|
100
|
+
# the base class for the different handlers
|
101
|
+
class Handler
|
102
|
+
attr_accessor :server
|
103
|
+
@subclasses = []
|
111
104
|
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
}
|
116
|
-
end
|
105
|
+
def self.each
|
106
|
+
@subclasses.each { |c| yield c }
|
107
|
+
end
|
117
108
|
|
118
|
-
|
119
|
-
|
120
|
-
|
109
|
+
def self.handler(name)
|
110
|
+
@subclasses.find { |h|
|
111
|
+
h.name == name
|
112
|
+
}
|
113
|
+
end
|
121
114
|
|
122
|
-
|
123
|
-
|
124
|
-
return @interface
|
125
|
-
else
|
126
|
-
raise Puppet::DevError, "Handler %s has no defined interface" %
|
127
|
-
self
|
115
|
+
def self.inherited(sub)
|
116
|
+
@subclasses << sub
|
128
117
|
end
|
129
|
-
end
|
130
118
|
|
131
|
-
|
132
|
-
|
133
|
-
|
119
|
+
def self.interface
|
120
|
+
if defined? @interface
|
121
|
+
return @interface
|
122
|
+
else
|
123
|
+
raise Puppet::DevError, "Handler %s has no defined interface" %
|
124
|
+
self
|
125
|
+
end
|
134
126
|
end
|
135
127
|
|
136
|
-
|
137
|
-
|
128
|
+
def self.name
|
129
|
+
unless defined? @name
|
130
|
+
@name = self.to_s.sub(/.+::/, '').intern
|
131
|
+
end
|
138
132
|
|
139
|
-
|
133
|
+
return @name
|
134
|
+
end
|
135
|
+
|
136
|
+
def initialize(hash = {})
|
137
|
+
end
|
140
138
|
end
|
141
|
-
end
|
142
139
|
|
143
|
-
|
140
|
+
|
141
|
+
class ServerStatus < Handler
|
144
142
|
|
145
|
-
|
146
|
-
|
147
|
-
|
143
|
+
@interface = XMLRPC::Service::Interface.new("status") { |iface|
|
144
|
+
iface.add_method("int status()")
|
145
|
+
}
|
148
146
|
|
149
|
-
|
147
|
+
@name = :Status
|
150
148
|
|
151
|
-
|
152
|
-
|
149
|
+
def status(status = nil, client = nil, clientip = nil)
|
150
|
+
return 1
|
151
|
+
end
|
153
152
|
end
|
154
|
-
end
|
155
153
|
|
154
|
+
end
|
156
155
|
end
|
157
156
|
|
158
157
|
#---------------------------------------------------------------
|
@@ -167,4 +166,4 @@ require 'puppet/server/filebucket'
|
|
167
166
|
require 'puppet/server/logger'
|
168
167
|
require 'puppet/client'
|
169
168
|
|
170
|
-
# $Id: server.rb
|
169
|
+
# $Id: server.rb 873 2006-02-07 23:12:33Z luke $
|
@@ -1,10 +1,5 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
|
3
|
-
#--------------------
|
4
1
|
# standard module for determining whether a given hostname or IP has access to
|
5
2
|
# the requested resource
|
6
|
-
#
|
7
|
-
# $Id: authstore.rb 742 2005-11-16 17:12:11Z luke $
|
8
3
|
|
9
4
|
require 'ipaddr'
|
10
5
|
|
@@ -68,7 +63,7 @@ class Server
|
|
68
63
|
}
|
69
64
|
}
|
70
65
|
|
71
|
-
self.info "
|
66
|
+
self.info "defaulting to no access for %s" % name
|
72
67
|
# default to false
|
73
68
|
return false
|
74
69
|
end
|
@@ -225,3 +220,5 @@ class Server
|
|
225
220
|
end
|
226
221
|
end
|
227
222
|
end
|
223
|
+
#
|
224
|
+
# $Id: authstore.rb 826 2006-01-14 00:20:14Z luke $
|
data/lib/puppet/server/ca.rb
CHANGED
@@ -26,11 +26,14 @@ class Server
|
|
26
26
|
# we only otherwise know how to handle files
|
27
27
|
unless @autosign =~ /^\//
|
28
28
|
raise Puppet::Error, "Invalid autosign value %s" %
|
29
|
-
@autosign
|
29
|
+
@autosign.inspect
|
30
30
|
end
|
31
31
|
|
32
32
|
unless FileTest.exists?(@autosign)
|
33
|
-
|
33
|
+
unless defined? @@warnedonautosign
|
34
|
+
@@warnedonautosign = true
|
35
|
+
Puppet.info "Autosign is enabled but %s is missing" % @autosign
|
36
|
+
end
|
34
37
|
return false
|
35
38
|
end
|
36
39
|
auth = Puppet::Server::AuthStore.new
|
@@ -1,9 +1,5 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
|
3
1
|
#--------------------
|
4
2
|
# accept and serve files
|
5
|
-
#
|
6
|
-
# $Id: filebucket.rb 635 2005-09-07 18:13:36Z luke $
|
7
3
|
|
8
4
|
|
9
5
|
require 'webrick'
|
@@ -145,3 +141,5 @@ class Server
|
|
145
141
|
end
|
146
142
|
end
|
147
143
|
end
|
144
|
+
#
|
145
|
+
# $Id: filebucket.rb 755 2005-11-23 19:18:34Z luke $
|
@@ -8,7 +8,9 @@ class Server
|
|
8
8
|
class FileServer < Handler
|
9
9
|
attr_accessor :local
|
10
10
|
|
11
|
-
Puppet.
|
11
|
+
Puppet.setdefaults("fileserver",
|
12
|
+
[:fileserverconfig, "$confdir/fileserver.conf",
|
13
|
+
"Where the fileserver configuration is stored."])
|
12
14
|
|
13
15
|
#CHECKPARAMS = %w{checksum type mode owner group}
|
14
16
|
CHECKPARAMS = [:mode, :type, :owner, :group, :checksum]
|
@@ -19,6 +21,14 @@ class Server
|
|
19
21
|
iface.add_method("string retrieve(string)")
|
20
22
|
}
|
21
23
|
|
24
|
+
def authcheck(file, mount, client, clientip)
|
25
|
+
unless mount.allowed?(client, clientip)
|
26
|
+
Puppet.warning "%s cannot access %s in %s" %
|
27
|
+
[client, mount, file]
|
28
|
+
raise Puppet::Server::AuthorizationError, "Cannot access %s" % mount
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
22
32
|
# Run 'retrieve' on a file. This gets the actual parameters, so
|
23
33
|
# we can pass them to the client.
|
24
34
|
def check(dir)
|
@@ -28,8 +38,8 @@ class Server
|
|
28
38
|
end
|
29
39
|
|
30
40
|
obj = nil
|
31
|
-
unless obj = Puppet
|
32
|
-
obj = Puppet
|
41
|
+
unless obj = Puppet.type(:file)[dir]
|
42
|
+
obj = Puppet.type(:file).create(
|
33
43
|
:name => dir,
|
34
44
|
:check => CHECKPARAMS
|
35
45
|
)
|
@@ -49,8 +59,10 @@ class Server
|
|
49
59
|
readconfig
|
50
60
|
mount, path = splitpath(file)
|
51
61
|
|
52
|
-
|
53
|
-
|
62
|
+
authcheck(file, mount, client, clientip)
|
63
|
+
|
64
|
+
if client
|
65
|
+
Puppet.debug "Describing %s for %s" % [file, client]
|
54
66
|
end
|
55
67
|
|
56
68
|
sdir = nil
|
@@ -140,8 +152,10 @@ class Server
|
|
140
152
|
readconfig
|
141
153
|
mount, path = splitpath(dir)
|
142
154
|
|
143
|
-
|
144
|
-
|
155
|
+
authcheck(dir, mount, client, clientip)
|
156
|
+
|
157
|
+
if client
|
158
|
+
Puppet.debug "Listing %s for %s" % [dir, client]
|
145
159
|
end
|
146
160
|
|
147
161
|
subdir = nil
|
@@ -245,7 +259,7 @@ class Server
|
|
245
259
|
when "allow":
|
246
260
|
value.split(/\s*,\s*/).each { |val|
|
247
261
|
begin
|
248
|
-
mount.info "
|
262
|
+
mount.info "allowing %s access" % val
|
249
263
|
mount.allow(val)
|
250
264
|
rescue AuthStoreError => detail
|
251
265
|
raise FileServerError, "%s at line %s of %s" %
|
@@ -255,7 +269,7 @@ class Server
|
|
255
269
|
when "deny":
|
256
270
|
value.split(/\s*,\s*/).each { |val|
|
257
271
|
begin
|
258
|
-
mount.info "
|
272
|
+
mount.info "denying %s access" % val
|
259
273
|
mount.deny(val)
|
260
274
|
rescue AuthStoreError => detail
|
261
275
|
raise FileServerError, "%s at line %s of %s" %
|
@@ -301,8 +315,10 @@ class Server
|
|
301
315
|
readconfig
|
302
316
|
mount, path = splitpath(file)
|
303
317
|
|
304
|
-
|
305
|
-
|
318
|
+
authcheck(file, mount, client, clientip)
|
319
|
+
|
320
|
+
if client
|
321
|
+
Puppet.info "Sending %s to %s" % [file, client]
|
306
322
|
end
|
307
323
|
|
308
324
|
fpath = nil
|
@@ -474,4 +490,4 @@ class Server
|
|
474
490
|
end
|
475
491
|
end
|
476
492
|
|
477
|
-
# $Id: fileserver.rb
|
493
|
+
# $Id: fileserver.rb 873 2006-02-07 23:12:33Z luke $
|