puppet 0.24.9 → 0.25.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 +18680 -1241
- data/CHANGELOG.old +1705 -0
- data/LICENSE +2 -2
- data/README +1 -1
- data/README.queueing +126 -0
- data/README.rst +4 -4
- data/Rakefile +62 -216
- data/bin/filebucket +6 -117
- data/bin/pi +50 -0
- data/bin/puppet +7 -188
- data/bin/puppetdoc +7 -198
- data/bin/ralsh +4 -191
- data/conf/auth.conf +94 -0
- data/conf/gentoo/init.d/puppetmaster +30 -30
- data/conf/osx/PackageInfo.plist +30 -30
- data/conf/osx/createpackage.sh +23 -18
- data/conf/osx/preflight +8 -0
- data/conf/puppet-queue.conf +10 -0
- data/conf/redhat/client.init +52 -41
- data/conf/redhat/logrotate +1 -0
- data/conf/redhat/puppet.spec +74 -36
- data/conf/redhat/rundir-perms.patch +28 -0
- data/conf/redhat/server.init +48 -43
- data/conf/redhat/server.sysconfig +4 -4
- data/conf/solaris/smf/puppetd.xml +53 -53
- data/conf/solaris/smf/puppetmasterd.xml +53 -53
- data/conf/solaris/smf/svc-puppetd +4 -4
- data/conf/solaris/smf/svc-puppetmasterd +3 -3
- data/conf/suse/client.init +4 -4
- data/conf/suse/puppet.spec +14 -14
- data/conf/suse/server.init +17 -17
- data/examples/etc/init.d/sleeper +8 -8
- data/examples/mac_dscl.pp +2 -2
- data/examples/mac_dscl_revert.pp +1 -1
- data/examples/mcx_dock_default.pp +108 -108
- data/examples/mcx_dock_full.pp +108 -108
- data/examples/mcx_nogroup.pp +108 -108
- data/examples/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb +5 -5
- data/examples/modules/sample-module/manifests/init.pp +2 -2
- data/examples/relationships +1 -1
- data/ext/autotest/config +6 -6
- data/ext/bin/sleeper +12 -12
- data/ext/dbfix.sql +21 -21
- data/ext/emacs/puppet-mode.el +42 -41
- data/ext/extlookup.rb +183 -0
- data/ext/ldap/puppet.schema +2 -1
- data/ext/logcheck/puppet +1 -1
- data/ext/module_puppet +7 -7
- data/ext/nagios/check_puppet.rb +83 -83
- data/ext/nagios/naggen +302 -0
- data/ext/puppet-test +61 -18
- data/ext/puppetlisten/puppetlisten.rb +76 -0
- data/ext/puppetlisten/puppetrun.rb +39 -0
- data/ext/puppetstoredconfigclean.rb +29 -29
- data/ext/rack/README +73 -0
- data/ext/rack/files/apache2.conf +38 -0
- data/ext/rack/files/config.ru +18 -0
- data/ext/rack/manifest.pp +59 -0
- data/ext/vim/syntax/puppet.vim +54 -35
- data/install.rb +37 -26
- data/lib/puppet.rb +15 -227
- data/lib/puppet/agent.rb +134 -0
- data/lib/puppet/agent/locker.rb +42 -0
- data/lib/puppet/agent/runner.rb +65 -0
- data/lib/puppet/application.rb +313 -0
- data/lib/puppet/application/filebucket.rb +87 -0
- data/lib/puppet/application/pi.rb +214 -0
- data/lib/puppet/application/puppet.rb +177 -0
- data/lib/puppet/application/puppetca.rb +71 -0
- data/lib/puppet/application/puppetd.rb +256 -0
- data/lib/puppet/application/puppetdoc.rb +222 -0
- data/lib/puppet/application/puppetmasterd.rb +168 -0
- data/lib/puppet/application/puppetqd.rb +96 -0
- data/lib/puppet/application/puppetrun.rb +219 -0
- data/lib/puppet/application/ralsh.rb +168 -0
- data/lib/puppet/configurer.rb +177 -0
- data/lib/puppet/configurer/downloader.rb +79 -0
- data/lib/puppet/configurer/fact_handler.rb +68 -0
- data/lib/puppet/configurer/plugin_handler.rb +26 -0
- data/lib/puppet/daemon.rb +78 -28
- data/lib/puppet/defaults.rb +239 -166
- data/lib/puppet/dsl.rb +7 -7
- data/lib/puppet/external/dot.rb +271 -271
- data/lib/puppet/external/event-loop/better-definers.rb +298 -298
- data/lib/puppet/external/event-loop/event-loop.rb +274 -274
- data/lib/puppet/external/event-loop/signal-system.rb +163 -163
- data/lib/puppet/external/lock.rb +1 -1
- data/lib/puppet/external/nagios.rb +20 -20
- data/lib/puppet/external/nagios/base.rb +3 -3
- data/lib/puppet/external/nagios/grammar.ry +185 -0
- data/lib/puppet/external/nagios/makefile +9 -0
- data/lib/puppet/external/nagios/parser.rb +1 -1
- data/lib/puppet/feature/json.rb +2 -0
- data/lib/puppet/feature/rack.rb +24 -0
- data/lib/puppet/feature/rails.rb +23 -33
- data/lib/puppet/feature/rubygems.rb +6 -0
- data/lib/puppet/feature/stomp.rb +6 -0
- data/lib/puppet/file_serving/{file_base.rb → base.rb} +10 -9
- data/lib/puppet/file_serving/configuration.rb +61 -61
- data/lib/puppet/file_serving/configuration/parser.rb +24 -29
- data/lib/puppet/file_serving/content.rb +26 -11
- data/lib/puppet/file_serving/fileset.rb +54 -19
- data/lib/puppet/file_serving/indirection_hooks.rb +12 -24
- data/lib/puppet/file_serving/metadata.rb +8 -8
- data/lib/puppet/file_serving/mount.rb +9 -151
- data/lib/puppet/file_serving/mount/file.rb +126 -0
- data/lib/puppet/file_serving/mount/modules.rb +25 -0
- data/lib/puppet/file_serving/mount/plugins.rb +27 -0
- data/lib/puppet/file_serving/terminus_helper.rb +9 -4
- data/lib/puppet/indirector.rb +6 -4
- data/lib/puppet/indirector/active_record.rb +28 -0
- data/lib/puppet/indirector/catalog/active_record.rb +36 -0
- data/lib/puppet/indirector/catalog/compiler.rb +50 -24
- data/lib/puppet/indirector/catalog/queue.rb +5 -0
- data/lib/puppet/indirector/catalog/rest.rb +6 -0
- data/lib/puppet/indirector/catalog/yaml.rb +2 -4
- data/lib/puppet/indirector/certificate/ca.rb +9 -0
- data/lib/puppet/indirector/certificate/file.rb +9 -0
- data/lib/puppet/indirector/certificate/rest.rb +9 -0
- data/lib/puppet/indirector/certificate_request/ca.rb +14 -0
- data/lib/puppet/indirector/certificate_request/file.rb +8 -0
- data/lib/puppet/indirector/certificate_request/rest.rb +9 -0
- data/lib/puppet/indirector/certificate_revocation_list/ca.rb +8 -0
- data/lib/puppet/indirector/certificate_revocation_list/file.rb +8 -0
- data/lib/puppet/indirector/certificate_revocation_list/rest.rb +9 -0
- data/lib/puppet/indirector/direct_file_server.rb +4 -8
- data/lib/puppet/indirector/exec.rb +2 -6
- data/lib/puppet/indirector/facts/active_record.rb +36 -0
- data/lib/puppet/indirector/facts/facter.rb +30 -22
- data/lib/puppet/indirector/facts/rest.rb +6 -0
- data/lib/puppet/indirector/file.rb +1 -0
- data/lib/puppet/indirector/file_content/rest.rb +0 -1
- data/lib/puppet/indirector/file_metadata/file.rb +2 -2
- data/lib/puppet/indirector/file_metadata/rest.rb +0 -1
- data/lib/puppet/indirector/file_server.rb +31 -18
- data/lib/puppet/indirector/indirection.rb +46 -33
- data/lib/puppet/indirector/key/ca.rb +12 -0
- data/lib/puppet/indirector/key/file.rb +42 -0
- data/lib/puppet/indirector/node/active_record.rb +13 -0
- data/lib/puppet/indirector/node/ldap.rb +1 -1
- data/lib/puppet/indirector/queue.rb +83 -0
- data/lib/puppet/indirector/report/processor.rb +1 -1
- data/lib/puppet/indirector/report/rest.rb +7 -0
- data/lib/puppet/indirector/request.rb +158 -15
- data/lib/puppet/indirector/rest.rb +74 -36
- data/lib/puppet/indirector/runner/rest.rb +7 -0
- data/lib/puppet/indirector/ssl_file.rb +174 -0
- data/lib/puppet/indirector/terminus.rb +4 -4
- data/lib/puppet/indirector/yaml.rb +1 -1
- data/lib/puppet/metatype/manager.rb +3 -3
- data/lib/puppet/module.rb +99 -124
- data/lib/puppet/network/authconfig.rb +57 -42
- data/lib/puppet/network/authstore.rb +58 -10
- data/lib/puppet/network/client.rb +0 -2
- data/lib/puppet/network/client/ca.rb +1 -1
- data/lib/puppet/network/client/dipper.rb +7 -2
- data/lib/puppet/network/format.rb +123 -0
- data/lib/puppet/network/format_handler.rb +156 -0
- data/lib/puppet/network/formats.rb +123 -0
- data/lib/puppet/network/handler/filebucket.rb +1 -1
- data/lib/puppet/network/handler/fileserver.rb +43 -35
- data/lib/puppet/network/handler/master.rb +4 -4
- data/lib/puppet/network/handler/report.rb +1 -1
- data/lib/puppet/network/handler/resource.rb +16 -20
- data/lib/puppet/network/handler/runner.rb +9 -42
- data/lib/puppet/network/http.rb +4 -4
- data/lib/puppet/network/http/api.rb +4 -0
- data/lib/puppet/network/http/api/v1.rb +65 -0
- data/lib/puppet/network/http/handler.rb +163 -56
- data/lib/puppet/network/http/mongrel.rb +19 -15
- data/lib/puppet/network/http/mongrel/rest.rb +35 -17
- data/lib/puppet/network/http/rack.rb +62 -0
- data/lib/puppet/network/http/rack/httphandler.rb +34 -0
- data/lib/puppet/network/http/rack/rest.rb +79 -0
- data/lib/puppet/network/http/rack/xmlrpc.rb +65 -0
- data/lib/puppet/network/http/webrick.rb +89 -16
- data/lib/puppet/network/http/webrick/rest.rb +24 -11
- data/lib/puppet/network/http_pool.rb +28 -29
- data/lib/puppet/network/http_server/mongrel.rb +8 -10
- data/lib/puppet/network/http_server/webrick.rb +1 -3
- data/lib/puppet/network/rest_authconfig.rb +89 -0
- data/lib/puppet/network/rest_authorization.rb +25 -0
- data/lib/puppet/network/rights.rb +230 -27
- data/lib/puppet/network/server.rb +133 -31
- data/lib/puppet/network/xmlrpc/client.rb +5 -5
- data/lib/puppet/network/xmlrpc/webrick_servlet.rb +6 -6
- data/lib/puppet/node.rb +28 -21
- data/lib/puppet/node/environment.rb +48 -0
- data/lib/puppet/node/facts.rb +21 -0
- data/lib/puppet/parameter.rb +291 -219
- data/lib/puppet/parser/ast.rb +1 -0
- data/lib/puppet/parser/ast/astarray.rb +5 -1
- data/lib/puppet/parser/ast/boolean_operator.rb +3 -3
- data/lib/puppet/parser/ast/caseopt.rb +10 -0
- data/lib/puppet/parser/ast/casestatement.rb +12 -27
- data/lib/puppet/parser/ast/collection.rb +31 -0
- data/lib/puppet/parser/ast/collexpr.rb +18 -11
- data/lib/puppet/parser/ast/comparison_operator.rb +1 -1
- data/lib/puppet/parser/ast/definition.rb +6 -2
- data/lib/puppet/parser/ast/function.rb +7 -2
- data/lib/puppet/parser/ast/ifstatement.rb +11 -6
- data/lib/puppet/parser/ast/leaf.rb +106 -3
- data/lib/puppet/parser/ast/match_operator.rb +31 -0
- data/lib/puppet/parser/ast/node.rb +10 -6
- data/lib/puppet/parser/ast/resource_defaults.rb +2 -2
- data/lib/puppet/parser/ast/resource_override.rb +1 -1
- data/lib/puppet/parser/ast/resource_reference.rb +11 -3
- data/lib/puppet/parser/ast/selector.rb +14 -32
- data/lib/puppet/parser/ast/vardef.rb +1 -1
- data/lib/puppet/parser/collector.rb +67 -15
- data/lib/puppet/parser/compiler.rb +21 -53
- data/lib/puppet/parser/files.rb +92 -0
- data/lib/puppet/parser/functions.rb +3 -3
- data/lib/puppet/parser/functions/defined.rb +3 -3
- data/lib/puppet/parser/functions/fqdn_rand.rb +3 -3
- data/lib/puppet/parser/functions/inline_template.rb +4 -4
- data/lib/puppet/parser/functions/regsubst.rb +37 -35
- data/lib/puppet/parser/functions/require.rb +34 -0
- data/lib/puppet/parser/functions/shellquote.rb +41 -0
- data/lib/puppet/parser/functions/split.rb +29 -0
- data/lib/puppet/parser/functions/sprintf.rb +6 -6
- data/lib/puppet/parser/functions/template.rb +4 -4
- data/lib/puppet/parser/functions/versioncmp.rb +22 -1
- data/lib/puppet/parser/grammar.ra +812 -0
- data/lib/puppet/parser/interpreter.rb +4 -4
- data/lib/puppet/parser/lexer.rb +44 -15
- data/lib/puppet/parser/loaded_code.rb +115 -0
- data/lib/puppet/parser/makefile +8 -0
- data/lib/puppet/parser/parser.rb +1080 -928
- data/lib/puppet/parser/parser_support.rb +118 -96
- data/lib/puppet/parser/resource.rb +56 -126
- data/lib/puppet/parser/resource/param.rb +2 -76
- data/lib/puppet/parser/resource/reference.rb +15 -8
- data/lib/puppet/parser/scope.rb +68 -35
- data/lib/puppet/parser/templatewrapper.rb +8 -8
- data/lib/puppet/parser/yaml_trimmer.rb +11 -0
- data/lib/puppet/property.rb +69 -124
- data/lib/puppet/property/list.rb +3 -3
- data/lib/puppet/provider.rb +5 -5
- data/lib/puppet/provider/augeas/augeas.rb +119 -118
- data/lib/puppet/provider/computer/computer.rb +3 -3
- data/lib/puppet/provider/confine/variable.rb +1 -1
- data/lib/puppet/provider/cron/crontab.rb +8 -7
- data/lib/puppet/provider/group/directoryservice.rb +2 -2
- data/lib/puppet/provider/group/groupadd.rb +1 -1
- data/lib/puppet/provider/group/ldap.rb +3 -3
- data/lib/puppet/provider/group/pw.rb +1 -1
- data/lib/puppet/provider/host/parsed.rb +3 -3
- data/lib/puppet/provider/ldap.rb +1 -3
- data/lib/puppet/provider/macauthorization/macauthorization.rb +62 -55
- data/lib/puppet/provider/mailalias/aliases.rb +9 -1
- data/lib/puppet/provider/maillist/mailman.rb +8 -4
- data/lib/puppet/provider/mcx/mcxcontent.rb +11 -11
- data/lib/puppet/provider/mount/parsed.rb +2 -2
- data/lib/puppet/provider/nameservice.rb +6 -6
- data/lib/puppet/provider/nameservice/directoryservice.rb +83 -87
- data/lib/puppet/provider/package/appdmg.rb +10 -9
- data/lib/puppet/provider/package/apple.rb +1 -3
- data/lib/puppet/provider/package/apt.rb +5 -5
- data/lib/puppet/provider/package/aptitude.rb +1 -1
- data/lib/puppet/provider/package/aptrpm.rb +1 -1
- data/lib/puppet/provider/package/darwinport.rb +1 -1
- data/lib/puppet/provider/package/dpkg.rb +2 -2
- data/lib/puppet/provider/package/fink.rb +6 -6
- data/lib/puppet/provider/package/freebsd.rb +1 -1
- data/lib/puppet/provider/package/gem.rb +2 -2
- data/lib/puppet/provider/package/hpux.rb +5 -5
- data/lib/puppet/provider/package/pkgdmg.rb +30 -22
- data/lib/puppet/provider/package/portage.rb +1 -1
- data/lib/puppet/provider/package/ports.rb +1 -1
- data/lib/puppet/provider/package/rpm.rb +5 -5
- data/lib/puppet/provider/package/rug.rb +1 -1
- data/lib/puppet/provider/package/sun.rb +7 -7
- data/lib/puppet/provider/package/up2date.rb +1 -1
- data/lib/puppet/provider/package/yum.rb +2 -2
- data/lib/puppet/provider/package/yumhelper.py +2 -2
- data/lib/puppet/provider/port/parsed.rb +1 -1
- data/lib/puppet/provider/selmodule/semodule.rb +3 -3
- data/lib/puppet/provider/service/base.rb +21 -12
- data/lib/puppet/provider/service/daemontools.rb +86 -49
- data/lib/puppet/provider/service/debian.rb +20 -12
- data/lib/puppet/provider/service/freebsd.rb +5 -5
- data/lib/puppet/provider/service/gentoo.rb +2 -2
- data/lib/puppet/provider/service/init.rb +21 -33
- data/lib/puppet/provider/service/launchd.rb +120 -48
- data/lib/puppet/provider/service/redhat.rb +12 -21
- data/lib/puppet/provider/service/runit.rb +19 -9
- data/lib/puppet/provider/service/smf.rb +49 -34
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +34 -0
- data/lib/puppet/provider/sshkey/parsed.rb +2 -2
- data/lib/puppet/provider/user/directoryservice.rb +12 -29
- data/lib/puppet/provider/user/hpux.rb +3 -3
- data/lib/puppet/provider/user/ldap.rb +2 -2
- data/lib/puppet/provider/zfs/solaris.rb +1 -1
- data/lib/puppet/provider/zone/solaris.rb +4 -4
- data/lib/puppet/provider/zpool/solaris.rb +3 -3
- data/lib/puppet/rails.rb +9 -9
- data/lib/puppet/rails/benchmark.rb +69 -0
- data/lib/puppet/rails/database/001_add_created_at_to_all_tables.rb +5 -5
- data/lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb +2 -2
- data/lib/puppet/rails/database/003_add_environment_to_host.rb +1 -1
- data/lib/puppet/rails/database/schema.rb +8 -8
- data/lib/puppet/rails/fact_value.rb +1 -1
- data/lib/puppet/rails/host.rb +211 -93
- data/lib/puppet/rails/param_name.rb +5 -1
- data/lib/puppet/rails/param_value.rb +29 -2
- data/lib/puppet/rails/puppet_tag.rb +5 -0
- data/lib/puppet/rails/resource.rb +120 -20
- data/lib/puppet/rails/resource_tag.rb +1 -1
- data/lib/puppet/rails/source_file.rb +1 -1
- data/lib/puppet/reference/configuration.rb +14 -14
- data/lib/puppet/reference/function.rb +1 -1
- data/lib/puppet/reference/metaparameter.rb +48 -0
- data/lib/puppet/reference/providers.rb +6 -6
- data/lib/puppet/reference/type.rb +1 -37
- data/lib/puppet/relationship.rb +57 -30
- data/lib/puppet/reports/rrdgraph.rb +4 -4
- data/lib/puppet/reports/store.rb +3 -3
- data/lib/puppet/reports/tagmail.rb +15 -15
- data/lib/puppet/resource.rb +265 -0
- data/lib/puppet/{node → resource}/catalog.rb +188 -112
- data/lib/puppet/{resource_reference.rb → resource/reference.rb} +46 -24
- data/lib/puppet/simple_graph.rb +165 -27
- data/lib/puppet/ssl.rb +7 -0
- data/lib/puppet/ssl/base.rb +62 -0
- data/lib/puppet/ssl/certificate.rb +34 -0
- data/lib/puppet/ssl/certificate_authority.rb +298 -0
- data/lib/puppet/ssl/certificate_authority/interface.rb +118 -0
- data/lib/puppet/ssl/certificate_factory.rb +145 -0
- data/lib/puppet/ssl/certificate_request.rb +51 -0
- data/lib/puppet/ssl/certificate_revocation_list.rb +86 -0
- data/lib/puppet/ssl/host.rb +271 -0
- data/lib/puppet/ssl/inventory.rb +52 -0
- data/lib/puppet/ssl/key.rb +56 -0
- data/lib/puppet/sslcertificates.rb +6 -6
- data/lib/puppet/sslcertificates/ca.rb +15 -15
- data/lib/puppet/sslcertificates/certificate.rb +4 -4
- data/lib/puppet/sslcertificates/inventory.rb +3 -3
- data/lib/puppet/transaction.rb +113 -139
- data/lib/puppet/transaction/change.rb +6 -6
- data/lib/puppet/transaction/event.rb +1 -1
- data/lib/puppet/transaction/report.rb +7 -1
- data/lib/puppet/transportable.rb +28 -28
- data/lib/puppet/type.rb +263 -688
- data/lib/puppet/type/augeas.rb +3 -2
- data/lib/puppet/type/component.rb +28 -95
- data/lib/puppet/type/computer.rb +10 -10
- data/lib/puppet/type/cron.rb +19 -14
- data/lib/puppet/type/exec.rb +21 -20
- data/lib/puppet/type/file.rb +306 -633
- data/lib/puppet/type/file/checksum.rb +10 -11
- data/lib/puppet/type/file/content.rb +83 -22
- data/lib/puppet/type/file/ensure.rb +15 -9
- data/lib/puppet/type/file/group.rb +7 -1
- data/lib/puppet/type/file/mode.rb +1 -1
- data/lib/puppet/type/file/owner.rb +9 -3
- data/lib/puppet/type/file/selcontext.rb +4 -4
- data/lib/puppet/type/file/source.rb +78 -179
- data/lib/puppet/type/file/target.rb +3 -3
- data/lib/puppet/type/file/type.rb +2 -2
- data/lib/puppet/type/filebucket.rb +33 -54
- data/lib/puppet/type/group.rb +8 -8
- data/lib/puppet/type/host.rb +7 -7
- data/lib/puppet/type/k5login.rb +2 -2
- data/lib/puppet/type/macauthorization.rb +77 -52
- data/lib/puppet/type/mailalias.rb +2 -2
- data/lib/puppet/type/maillist.rb +2 -2
- data/lib/puppet/type/mcx.rb +3 -3
- data/lib/puppet/type/mount.rb +16 -11
- data/lib/puppet/type/notify.rb +4 -4
- data/lib/puppet/type/package.rb +6 -28
- data/lib/puppet/type/port.rb +1 -1
- data/lib/puppet/type/resources.rb +19 -19
- data/lib/puppet/type/schedule.rb +18 -20
- data/lib/puppet/type/selmodule.rb +1 -1
- data/lib/puppet/type/service.rb +11 -7
- data/lib/puppet/type/ssh_authorized_key.rb +26 -9
- data/lib/puppet/type/sshkey.rb +2 -2
- data/lib/puppet/type/tidy.rb +285 -289
- data/lib/puppet/type/user.rb +9 -7
- data/lib/puppet/type/yumrepo.rb +17 -16
- data/lib/puppet/type/zone.rb +8 -7
- data/lib/puppet/util.rb +11 -36
- data/lib/puppet/util/autoload.rb +31 -19
- data/lib/puppet/util/autoload/file_cache.rb +115 -0
- data/lib/puppet/util/backups.rb +86 -0
- data/lib/puppet/util/cacher.rb +135 -0
- data/lib/puppet/util/checksums.rb +11 -1
- data/lib/puppet/util/classgen.rb +1 -1
- data/lib/puppet/util/config_store.rb +2 -2
- data/lib/puppet/util/constant_inflector.rb +1 -1
- data/lib/puppet/util/diff.rb +2 -2
- data/lib/puppet/util/docs.rb +9 -3
- data/lib/puppet/util/execution.rb +1 -1
- data/lib/puppet/util/feature.rb +27 -20
- data/lib/puppet/util/fileparsing.rb +3 -3
- data/lib/puppet/util/filetype.rb +8 -6
- data/lib/puppet/util/graph.rb +5 -5
- data/lib/puppet/util/inifile.rb +5 -5
- data/lib/puppet/util/json.rb +13 -0
- data/lib/puppet/util/ldap/connection.rb +2 -2
- data/lib/puppet/util/log.rb +48 -31
- data/lib/puppet/util/metric.rb +4 -4
- data/lib/puppet/util/monkey_patches.rb +43 -0
- data/lib/puppet/util/nagios_maker.rb +1 -1
- data/lib/puppet/util/package.rb +4 -4
- data/lib/puppet/util/pidlock.rb +59 -59
- data/lib/puppet/util/posix.rb +13 -52
- data/lib/puppet/util/provider_features.rb +3 -3
- data/lib/puppet/util/queue.rb +96 -0
- data/lib/puppet/util/queue/stomp.rb +47 -0
- data/lib/puppet/util/rails/cache_accumulator.rb +65 -0
- data/lib/puppet/util/rails/collection_merger.rb +0 -39
- data/lib/puppet/util/rails/reference_serializer.rb +17 -3
- data/lib/puppet/util/rdoc.rb +1 -0
- data/lib/puppet/util/rdoc/code_objects.rb +5 -1
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +5 -5
- data/lib/puppet/util/rdoc/generators/template/puppet/puppet.rb +13 -13
- data/lib/puppet/util/rdoc/parser.rb +28 -32
- data/lib/puppet/util/reference.rb +29 -8
- data/lib/puppet/util/resource_template.rb +1 -1
- data/lib/puppet/util/selinux.rb +12 -6
- data/lib/puppet/util/settings.rb +203 -578
- data/lib/puppet/util/settings/boolean_setting.rb +33 -0
- data/lib/puppet/util/settings/file_setting.rb +119 -0
- data/lib/puppet/util/settings/setting.rb +110 -0
- data/lib/puppet/util/subclass_loader.rb +1 -1
- data/lib/puppet/util/suidmanager.rb +2 -2
- data/lib/puppet/util/tagging.rb +1 -1
- data/lib/puppet/util/warnings.rb +17 -9
- data/man/man8/filebucket.8 +2 -2
- data/man/man8/pi.8 +2 -2
- data/man/man8/puppet.8 +3 -4
- data/man/man8/puppet.conf.8 +63 -63
- data/man/man8/puppetca.8 +2 -2
- data/man/man8/puppetd.8 +2 -2
- data/man/man8/puppetdoc.8 +2 -2
- data/man/man8/puppetmasterd.8 +2 -2
- data/man/man8/puppetrun.8 +2 -2
- data/man/man8/ralsh.8 +3 -3
- data/sbin/puppetca +102 -0
- data/sbin/puppetd +159 -0
- data/sbin/puppetmasterd +66 -0
- data/sbin/puppetqd +53 -0
- data/sbin/puppetrun +130 -0
- data/spec/Rakefile +2 -2
- data/spec/integration/application/puppet.rb +33 -0
- data/spec/integration/bin/puppetmasterd.rb +110 -0
- data/spec/integration/configurer.rb +18 -0
- data/spec/integration/defaults.rb +158 -7
- data/spec/integration/file_serving/content.rb +2 -0
- data/spec/integration/file_serving/fileset.rb +14 -0
- data/spec/integration/file_serving/metadata.rb +2 -0
- data/spec/integration/file_serving/terminus_helper.rb +22 -0
- data/spec/integration/indirector/catalog/compiler.rb +67 -0
- data/spec/integration/indirector/catalog/queue.rb +61 -0
- data/spec/integration/indirector/certificate/rest.rb +69 -0
- data/spec/integration/indirector/certificate_request/rest.rb +89 -0
- data/spec/integration/indirector/certificate_revocation_list/rest.rb +77 -0
- data/spec/integration/indirector/direct_file_server.rb +16 -23
- data/spec/integration/indirector/file_content/file_server.rb +75 -0
- data/spec/integration/indirector/report/rest.rb +95 -0
- data/spec/integration/indirector/rest.rb +207 -147
- data/spec/integration/network/client.rb +19 -0
- data/spec/integration/network/formats.rb +110 -0
- data/spec/integration/network/handler.rb +25 -0
- data/spec/integration/network/server/mongrel.rb +26 -8
- data/spec/integration/network/server/webrick.rb +49 -11
- data/spec/integration/node/environment.rb +58 -0
- data/spec/integration/node/facts.rb +4 -2
- data/spec/integration/parser/compiler.rb +29 -0
- data/spec/integration/parser/functions/require.rb +67 -0
- data/spec/integration/provider/mailalias/aliases.rb +25 -0
- data/spec/integration/{node → resource}/catalog.rb +17 -10
- data/spec/integration/ssl/certificate_authority.rb +135 -0
- data/spec/integration/ssl/certificate_request.rb +59 -0
- data/spec/integration/ssl/certificate_revocation_list.rb +42 -0
- data/spec/integration/ssl/host.rb +90 -0
- data/spec/integration/transaction.rb +66 -0
- data/spec/integration/transaction/report.rb +2 -5
- data/spec/integration/type.rb +22 -0
- data/spec/integration/type/file.rb +458 -0
- data/spec/integration/type/package.rb +1 -1
- data/spec/integration/type/tidy.rb +27 -0
- data/spec/integration/util/autoload.rb +114 -0
- data/spec/integration/util/feature.rb +54 -0
- data/spec/integration/util/file_locking.rb +2 -1
- data/spec/integration/util/settings.rb +27 -0
- data/spec/lib/puppet_spec/files.rb +9 -0
- data/spec/monkey_patches/add_confine_and_runnable_to_rspec_dsl.rb +1 -0
- data/spec/monkey_patches/alias_should_to_must.rb +1 -0
- data/spec/shared_behaviours/file_server_terminus.rb +14 -11
- data/spec/shared_behaviours/file_serving.rb +13 -17
- data/spec/spec_helper.rb +22 -5
- data/spec/unit/agent.rb +259 -0
- data/spec/unit/agent/locker.rb +100 -0
- data/spec/unit/agent/runner.rb +118 -0
- data/spec/unit/application.rb +420 -0
- data/spec/unit/application/filebucket.rb +220 -0
- data/spec/unit/application/pi.rb +84 -0
- data/spec/unit/application/puppet.rb +404 -0
- data/spec/unit/application/puppetca.rb +142 -0
- data/spec/unit/application/puppetd.rb +502 -0
- data/spec/unit/application/puppetdoc.rb +345 -0
- data/spec/unit/application/puppetmasterd.rb +456 -0
- data/spec/unit/application/puppetqd.rb +186 -0
- data/spec/unit/application/puppetrun.rb +279 -0
- data/spec/unit/application/ralsh.rb +237 -0
- data/spec/unit/configurer.rb +232 -0
- data/spec/unit/configurer/downloader.rb +188 -0
- data/spec/unit/configurer/fact_handler.rb +150 -0
- data/spec/unit/configurer/plugin_handler.rb +112 -0
- data/spec/unit/daemon.rb +287 -0
- data/spec/unit/file_serving/{file_base.rb → base.rb} +39 -31
- data/spec/unit/file_serving/configuration.rb +104 -93
- data/spec/unit/file_serving/configuration/parser.rb +64 -18
- data/spec/unit/file_serving/content.rb +65 -26
- data/spec/unit/file_serving/fileset.rb +116 -14
- data/spec/unit/file_serving/indirection_hooks.rb +34 -95
- data/spec/unit/file_serving/metadata.rb +27 -40
- data/spec/unit/file_serving/mount.rb +7 -118
- data/spec/unit/file_serving/mount/file.rb +188 -0
- data/spec/unit/file_serving/mount/modules.rb +63 -0
- data/spec/unit/file_serving/mount/plugins.rb +61 -0
- data/spec/unit/file_serving/terminus_helper.rb +39 -27
- data/spec/unit/indirector.rb +6 -1
- data/spec/unit/indirector/active_record.rb +76 -0
- data/spec/unit/indirector/catalog/active_record.rb +122 -0
- data/spec/unit/indirector/catalog/compiler.rb +222 -118
- data/spec/unit/indirector/catalog/queue.rb +20 -0
- data/spec/unit/indirector/catalog/rest.rb +11 -0
- data/spec/unit/indirector/catalog/yaml.rb +6 -6
- data/spec/unit/indirector/certificate/ca.rb +28 -0
- data/spec/unit/indirector/certificate/file.rb +28 -0
- data/spec/unit/indirector/certificate/rest.rb +23 -0
- data/spec/unit/indirector/certificate_request/ca.rb +19 -0
- data/spec/unit/indirector/certificate_request/file.rb +19 -0
- data/spec/unit/indirector/certificate_request/rest.rb +23 -0
- data/spec/unit/indirector/certificate_revocation_list/ca.rb +21 -0
- data/spec/unit/indirector/certificate_revocation_list/file.rb +20 -0
- data/spec/unit/indirector/certificate_revocation_list/rest.rb +23 -0
- data/spec/unit/indirector/direct_file_server.rb +3 -8
- data/spec/unit/indirector/exec.rb +6 -1
- data/spec/unit/indirector/facts/active_record.rb +104 -0
- data/spec/unit/indirector/facts/facter.rb +53 -12
- data/spec/unit/indirector/facts/rest.rb +11 -0
- data/spec/unit/indirector/file.rb +8 -1
- data/spec/unit/indirector/file_metadata/file.rb +5 -5
- data/spec/unit/indirector/file_server.rb +181 -98
- data/spec/unit/indirector/indirection.rb +102 -38
- data/spec/unit/indirector/key/ca.rb +28 -0
- data/spec/unit/indirector/key/file.rb +104 -0
- data/spec/unit/indirector/node/active_record.rb +34 -0
- data/spec/unit/indirector/node/ldap.rb +1 -1
- data/spec/unit/indirector/node/rest.rb +2 -2
- data/spec/unit/indirector/queue.rb +123 -0
- data/spec/unit/indirector/report/rest.rb +28 -0
- data/spec/unit/indirector/request.rb +221 -0
- data/spec/unit/indirector/rest.rb +343 -334
- data/spec/unit/indirector/runner/rest.rb +11 -0
- data/spec/unit/indirector/ssl_file.rb +280 -0
- data/spec/unit/module.rb +180 -180
- data/spec/unit/network/authconfig.rb +292 -0
- data/spec/unit/network/authstore.rb +94 -0
- data/spec/unit/network/client.rb +2 -2
- data/spec/unit/network/client/dipper.rb +16 -0
- data/spec/unit/network/format.rb +191 -0
- data/spec/unit/network/format_handler.rb +306 -0
- data/spec/unit/network/formats.rb +249 -0
- data/spec/unit/network/handler/fileserver.rb +2 -5
- data/spec/unit/network/http.rb +3 -3
- data/spec/unit/network/http/api/v1.rb +122 -0
- data/spec/unit/network/http/handler.rb +448 -0
- data/spec/unit/network/http/mongrel.rb +46 -32
- data/spec/unit/network/http/mongrel/rest.rb +174 -319
- data/spec/unit/network/http/rack.rb +102 -0
- data/spec/unit/network/http/rack/rest.rb +199 -0
- data/spec/unit/network/http/rack/xmlrpc.rb +157 -0
- data/spec/unit/network/http/webrick.rb +249 -37
- data/spec/unit/network/http/webrick/rest.rb +113 -279
- data/spec/unit/network/http_pool.rb +86 -110
- data/spec/unit/network/rest_authconfig.rb +146 -0
- data/spec/unit/network/rest_authorization.rb +43 -0
- data/spec/unit/network/rights.rb +519 -0
- data/spec/unit/network/server.rb +475 -257
- data/spec/unit/node.rb +43 -10
- data/spec/unit/node/environment.rb +143 -9
- data/spec/unit/node/facts.rb +77 -24
- data/spec/unit/other/selinux.rb +85 -0
- data/spec/unit/other/transbucket.rb +29 -13
- data/spec/unit/other/transobject.rb +35 -15
- data/spec/unit/parameter.rb +378 -5
- data/spec/unit/parser/ast.rb +1 -1
- data/spec/unit/parser/ast/arithmetic_operator.rb +17 -17
- data/spec/unit/parser/ast/astarray.rb +16 -10
- data/spec/unit/parser/ast/boolean_operator.rb +2 -2
- data/spec/unit/parser/ast/casestatement.rb +143 -0
- data/spec/unit/parser/ast/collection.rb +63 -0
- data/spec/unit/parser/ast/collexpr.rb +31 -8
- data/spec/unit/parser/ast/comparison_operator.rb +9 -9
- data/spec/unit/parser/ast/definition.rb +18 -0
- data/spec/unit/parser/ast/function.rb +6 -0
- data/spec/unit/parser/ast/ifstatement.rb +75 -0
- data/spec/unit/parser/ast/leaf.rb +261 -0
- data/spec/unit/parser/ast/match_operator.rb +50 -0
- data/spec/unit/parser/ast/minus.rb +1 -1
- data/spec/unit/parser/ast/node.rb +20 -0
- data/spec/unit/parser/ast/not.rb +1 -1
- data/spec/unit/parser/ast/resource_override.rb +5 -5
- data/spec/unit/parser/ast/resource_reference.rb +11 -5
- data/spec/unit/parser/ast/selector.rb +156 -0
- data/spec/unit/parser/ast/vardef.rb +11 -11
- data/spec/unit/parser/collector.rb +167 -48
- data/spec/unit/parser/compiler.rb +128 -104
- data/spec/unit/parser/files.rb +190 -0
- data/spec/unit/parser/functions/inline_template.rb +0 -0
- data/spec/unit/parser/functions/regsubst.rb +42 -42
- data/spec/unit/parser/functions/require.rb +36 -0
- data/spec/unit/parser/functions/shellquote.rb +92 -0
- data/spec/unit/parser/functions/split.rb +51 -0
- data/spec/unit/parser/functions/sprintf.rb +11 -11
- data/spec/unit/parser/functions/template.rb +0 -0
- data/spec/unit/parser/functions/versioncmp.rb +2 -2
- data/spec/unit/parser/interpreter.rb +16 -7
- data/spec/unit/parser/lexer.rb +72 -12
- data/spec/unit/parser/loaded_code.rb +198 -0
- data/spec/unit/parser/parser.rb +215 -28
- data/spec/unit/parser/resource.rb +131 -22
- data/spec/unit/parser/scope.rb +207 -12
- data/spec/unit/parser/templatewrapper.rb +8 -3
- data/spec/unit/property.rb +270 -16
- data/spec/unit/property/list.rb +12 -6
- data/spec/unit/provider.rb +31 -0
- data/spec/unit/provider/augeas/augeas.rb +61 -33
- data/spec/unit/provider/macauthorization.rb +29 -29
- data/spec/unit/provider/mcx/mcxcontent.rb +4 -4
- data/spec/unit/provider/mount/parsed.rb +5 -8
- data/spec/unit/provider/naginator.rb +0 -0
- data/spec/unit/provider/package/apt.rb +6 -6
- data/spec/unit/provider/package/pkgdmg.rb +73 -0
- data/spec/unit/provider/selboolean.rb +1 -1
- data/spec/unit/provider/selmodule.rb +2 -2
- data/spec/unit/provider/service/daemontools.rb +40 -15
- data/spec/unit/provider/service/debian.rb +89 -0
- data/spec/unit/provider/service/init.rb +106 -0
- data/spec/unit/provider/service/launchd.rb +71 -13
- data/spec/unit/provider/service/redhat.rb +94 -0
- data/spec/unit/provider/service/runit.rb +14 -2
- data/spec/unit/provider/ssh_authorized_key/parsed.rb +66 -2
- data/spec/unit/provider/user/ldap.rb +1 -1
- data/spec/unit/provider/user/user_role_add.rb +1 -1
- data/spec/unit/provider/zfs/solaris.rb +18 -6
- data/spec/unit/provider/zone/solaris.rb +1 -1
- data/spec/unit/rails.rb +16 -22
- data/spec/unit/rails/host.rb +163 -0
- data/spec/unit/rails/param_value.rb +49 -0
- data/spec/unit/rails/resource.rb +87 -0
- data/spec/unit/relationship.rb +141 -29
- data/spec/unit/resource.rb +504 -0
- data/spec/unit/resource/catalog.rb +1061 -0
- data/spec/unit/resource/reference.rb +111 -0
- data/spec/unit/simple_graph.rb +448 -191
- data/spec/unit/ssl/certificate.rb +124 -0
- data/spec/unit/ssl/certificate_authority.rb +741 -0
- data/spec/unit/ssl/certificate_authority/interface.rb +269 -0
- data/spec/unit/ssl/certificate_factory.rb +107 -0
- data/spec/unit/ssl/certificate_request.rb +193 -0
- data/spec/unit/ssl/certificate_revocation_list.rb +180 -0
- data/spec/unit/ssl/host.rb +704 -0
- data/spec/unit/ssl/inventory.rb +180 -0
- data/spec/unit/ssl/key.rb +198 -0
- data/spec/unit/transaction.rb +65 -2
- data/spec/unit/transaction/change.rb +1 -1
- data/spec/unit/transaction/report.rb +1 -1
- data/spec/unit/type.rb +361 -8
- data/spec/unit/type/augeas.rb +30 -37
- data/spec/unit/type/component.rb +63 -0
- data/spec/unit/type/computer.rb +17 -21
- data/spec/unit/type/exec.rb +27 -2
- data/spec/unit/type/file.rb +704 -83
- data/spec/unit/type/file/content.rb +253 -15
- data/spec/unit/type/file/ensure.rb +65 -2
- data/spec/unit/type/file/group.rb +5 -0
- data/spec/unit/type/file/owner.rb +5 -0
- data/spec/unit/type/file/selinux.rb +12 -16
- data/spec/unit/type/file/source.rb +264 -0
- data/spec/unit/type/filebucket.rb +74 -0
- data/spec/unit/type/group.rb +1 -5
- data/spec/unit/type/macauthorization.rb +59 -26
- data/spec/unit/type/mcx.rb +8 -16
- data/spec/unit/type/mount.rb +8 -16
- data/spec/unit/type/noop_metaparam.rb +0 -2
- data/spec/unit/type/package.rb +13 -23
- data/spec/unit/type/resources.rb +4 -7
- data/spec/unit/type/schedule.rb +1 -7
- data/spec/unit/type/selboolean.rb +4 -6
- data/spec/unit/type/service.rb +23 -33
- data/spec/unit/type/ssh_authorized_key.rb +25 -14
- data/spec/unit/type/tidy.rb +329 -21
- data/spec/unit/type/user.rb +18 -10
- data/spec/unit/type/zfs.rb +6 -6
- data/spec/unit/util/autoload.rb +94 -3
- data/spec/unit/util/autoload/file_cache.rb +183 -0
- data/spec/unit/util/backups.rb +159 -0
- data/spec/unit/util/cache_accumulator.rb +69 -0
- data/spec/unit/util/cacher.rb +185 -0
- data/spec/unit/util/checksums.rb +9 -1
- data/spec/unit/util/feature.rb +72 -0
- data/spec/unit/util/filetype.rb +1 -11
- data/spec/unit/util/json.rb +21 -0
- data/spec/unit/util/log.rb +45 -0
- data/spec/unit/util/package.rb +2 -2
- data/spec/unit/util/queue.rb +88 -0
- data/spec/unit/util/queue/stomp.rb +140 -0
- data/spec/unit/util/reference_serializer.rb +52 -0
- data/spec/unit/util/selinux.rb +5 -3
- data/spec/unit/util/settings.rb +413 -264
- data/spec/unit/util/settings/file_setting.rb +223 -0
- data/spec/unit/util/storage.rb +11 -11
- data/spec/unit/util/warnings.rb +21 -17
- data/test/Rakefile +6 -5
- data/test/certmgr/ca.rb +5 -5
- data/test/certmgr/certmgr.rb +4 -4
- data/test/data/providers/cron/crontab.allthree +2 -2
- data/test/data/providers/cron/crontab.envNcomment +1 -1
- data/test/data/providers/cron/crontab.envNname +1 -1
- data/test/data/providers/cron/crontab.multirecords +1 -1
- data/test/data/providers/cron/crontab_collections.yaml +14 -14
- data/test/data/providers/cron/crontab_multiple_with_env.yaml +6 -6
- data/test/data/providers/cron/crontab_sample_records.yaml +102 -102
- data/test/data/providers/mailalias/aliases/test1 +28 -0
- data/test/data/providers/package/testpackages.yaml +6 -6
- data/test/data/reports/1.yaml +17 -17
- data/test/data/reports/tagmail_passers.conf +2 -2
- data/test/data/snippets/append.pp +5 -5
- data/test/data/snippets/casestatement.pp +9 -2
- data/test/data/snippets/classincludes.pp +1 -1
- data/test/data/snippets/collection_override.pp +8 -0
- data/test/data/snippets/fqparents.pp +2 -2
- data/test/data/snippets/ifexpression.pp +12 -0
- data/test/data/snippets/multilinecomments.pp +5 -1
- data/test/data/snippets/selectorvalues.pp +7 -0
- data/test/data/types/hosts/1 +1 -1
- data/test/data/types/hosts/2 +3 -3
- data/test/data/types/hosts/solaris +2 -2
- data/test/data/types/mount/freebsd.fstab +7 -7
- data/test/data/types/mount/solaris.fstab +10 -10
- data/test/data/types/port/1 +472 -472
- data/test/data/types/port/darwin +4347 -4347
- data/test/language/ast.rb +3 -2
- data/test/language/ast/casestatement.rb +12 -12
- data/test/language/ast/resource.rb +4 -4
- data/test/language/ast/resource_reference.rb +5 -5
- data/test/language/ast/selector.rb +11 -11
- data/test/language/ast/variable.rb +4 -4
- data/test/language/functions.rb +16 -16
- data/test/language/parser.rb +89 -111
- data/test/language/resource.rb +3 -88
- data/test/language/scope.rb +14 -55
- data/test/language/snippets.rb +31 -31
- data/test/lib/puppettest.rb +12 -12
- data/test/lib/puppettest/certificates.rb +2 -2
- data/test/lib/puppettest/exetest.rb +0 -1
- data/test/lib/puppettest/fakes.rb +1 -1
- data/test/lib/puppettest/parsertesting.rb +9 -4
- data/test/lib/puppettest/railstesting.rb +3 -3
- data/test/lib/puppettest/servertest.rb +1 -1
- data/test/lib/puppettest/support/assertions.rb +2 -2
- data/test/lib/puppettest/support/collection.rb +1 -1
- data/test/lib/puppettest/support/resources.rb +7 -7
- data/test/lib/puppettest/support/utils.rb +10 -16
- data/test/lib/puppettest/testcase.rb +2 -1
- data/test/network/authconfig.rb +1 -1
- data/test/network/authorization.rb +1 -1
- data/test/network/authstore.rb +57 -14
- data/test/network/client/ca.rb +1 -0
- data/test/network/client/resource.rb +12 -50
- data/test/network/client_request.rb +1 -1
- data/test/network/handler/bucket.rb +2 -2
- data/test/network/handler/fileserver.rb +17 -21
- data/test/network/handler/master.rb +5 -5
- data/test/network/handler/report.rb +3 -3
- data/test/network/handler/resource.rb +29 -75
- data/test/network/handler/runner.rb +8 -58
- data/test/network/rights.rb +1 -1
- data/test/network/server/mongrel_test.rb +15 -1
- data/test/network/server/webrick.rb +0 -36
- data/test/network/xmlrpc/webrick_servlet.rb +5 -5
- data/test/other/dsl.rb +3 -3
- data/test/other/events.rb +15 -15
- data/test/other/puppet.rb +2 -32
- data/test/other/relationships.rb +21 -148
- data/test/other/report.rb +20 -23
- data/test/other/transactions.rb +110 -298
- data/test/puppet/defaults.rb +1 -1
- data/test/puppet/tc_suidmanager.rb +1 -1
- data/test/rails/railsparameter.rb +4 -4
- data/test/ral/manager/attributes.rb +12 -68
- data/test/ral/manager/instances.rb +3 -19
- data/test/ral/manager/manager.rb +7 -7
- data/test/ral/manager/provider.rb +7 -7
- data/test/ral/manager/type.rb +54 -349
- data/test/ral/providers/cron/crontab.rb +14 -14
- data/test/ral/providers/group.rb +5 -6
- data/test/ral/providers/host/parsed.rb +3 -3
- data/test/ral/providers/mailalias/aliases.rb +4 -4
- data/test/ral/providers/package.rb +3 -3
- data/test/ral/providers/package/aptitude.rb +55 -55
- data/test/ral/providers/package/aptrpm.rb +7 -7
- data/test/ral/providers/parsedfile.rb +10 -14
- data/test/ral/providers/port/parsed.rb +6 -6
- data/test/ral/providers/provider.rb +10 -10
- data/test/ral/providers/service/base.rb +32 -32
- data/test/ral/providers/sshkey/parsed.rb +14 -14
- data/test/ral/providers/user.rb +16 -17
- data/test/ral/providers/user/useradd.rb +19 -22
- data/test/ral/type/cron.rb +21 -28
- data/test/ral/type/exec.rb +57 -60
- data/test/ral/type/file.rb +88 -862
- data/test/ral/type/file/target.rb +21 -70
- data/test/ral/type/fileignoresource.rb +37 -44
- data/test/ral/type/filesources.rb +43 -473
- data/test/ral/type/group.rb +6 -7
- data/test/ral/type/host.rb +14 -30
- data/test/ral/type/mailalias.rb +3 -3
- data/test/ral/type/port.rb +5 -5
- data/test/ral/type/resources.rb +37 -37
- data/test/ral/type/service.rb +3 -3
- data/test/ral/type/sshkey.rb +34 -39
- data/test/ral/type/user.rb +15 -14
- data/test/ral/type/yumrepo.rb +18 -17
- data/test/ral/type/zone.rb +4 -6
- data/test/test +9 -9
- data/test/util/fileparsing.rb +10 -10
- data/test/util/inifile.rb +6 -6
- data/test/util/instance_loader.rb +1 -1
- data/test/util/log.rb +2 -2
- data/test/util/metrics.rb +1 -6
- data/test/util/package.rb +1 -1
- data/test/util/pidlock.rb +116 -116
- data/test/util/settings.rb +40 -429
- data/test/util/storage.rb +5 -5
- data/test/util/subclass_loader.rb +0 -7
- data/test/util/utiltest.rb +10 -29
- metadata +1369 -941
- data/bin/puppetca +0 -363
- data/bin/puppetd +0 -439
- data/bin/puppetmasterd +0 -289
- data/bin/puppetrun +0 -369
- data/conf/redhat/lsb-config.patch +0 -51
- data/conf/redhat/no-chuser-0.15.1.patch +0 -38
- data/conf/redhat/no-lockdir.patch +0 -13
- data/examples/mac_netinfo.pp +0 -5
- data/ext/passenger/README +0 -63
- data/ext/passenger/apache2.conf +0 -29
- data/ext/passenger/config.ru +0 -40
- data/lib/puppet/config_stores/rest.rb +0 -60
- data/lib/puppet/executables/client/certhandler.rb +0 -82
- data/lib/puppet/indirector/file_content/modules.rb +0 -11
- data/lib/puppet/indirector/file_metadata/modules.rb +0 -17
- data/lib/puppet/indirector/module_files.rb +0 -82
- data/lib/puppet/indirector/ssl_rsa.rb +0 -5
- data/lib/puppet/indirector/ssl_rsa/file.rb +0 -33
- data/lib/puppet/network/client/master.rb +0 -524
- data/lib/puppet/network/http_server/rack.rb +0 -148
- data/lib/puppet/pgraph.rb +0 -121
- data/lib/puppet/provider/group/netinfo.rb +0 -15
- data/lib/puppet/provider/host/netinfo.rb +0 -19
- data/lib/puppet/provider/mount/netinfo.rb +0 -37
- data/lib/puppet/provider/nameservice/netinfo.rb +0 -224
- data/lib/puppet/provider/user/netinfo.rb +0 -111
- data/lib/puppet/util/fact_store.rb +0 -59
- data/lib/puppet/util/uri_helper.rb +0 -22
- data/spec/integration/file_serving/configuration.rb +0 -43
- data/spec/integration/indirector/module_files.rb +0 -57
- data/spec/unit/executables/client/certhandler.rb +0 -135
- data/spec/unit/indirector/file_content/modules.rb +0 -18
- data/spec/unit/indirector/file_metadata/modules.rb +0 -42
- data/spec/unit/indirector/module_files.rb +0 -259
- data/spec/unit/indirector/ssl_rsa/file.rb +0 -121
- data/spec/unit/network/client/master.rb +0 -442
- data/spec/unit/node/catalog.rb +0 -865
- data/spec/unit/other/pgraph.rb +0 -210
- data/spec/unit/resource_reference.rb +0 -73
- data/spec/unit/util/uri_helper.rb +0 -41
- data/test/data/snippets/ifexpression.rb +0 -6
- data/test/executables/filebucket.rb +0 -51
- data/test/executables/puppetbin.rb +0 -104
- data/test/executables/puppetca.rb +0 -115
- data/test/executables/puppetd.rb +0 -55
- data/test/executables/puppetmasterd.rb +0 -147
- data/test/network/client/client.rb +0 -195
- data/test/network/client/master.rb +0 -490
- data/test/network/daemon.rb +0 -70
- data/test/network/handler/handler.rb +0 -63
- data/test/other/overrides.rb +0 -107
- data/test/puppet/conffiles.rb +0 -107
- data/test/rails/ast.rb +0 -73
- data/test/rails/configuration.rb +0 -71
- data/test/rails/host.rb +0 -154
- data/test/rails/railsresource.rb +0 -251
- data/test/ral/providers/host/netinfo.rb +0 -56
- data/test/ral/providers/mount/netinfo.rb +0 -79
- data/test/ral/type/basic.rb +0 -85
- data/test/ral/type/filebucket.rb +0 -157
- data/test/ral/type/parameter.rb +0 -174
- data/test/ral/type/property.rb +0 -388
- data/test/ral/type/tidy.rb +0 -291
- data/test/util/autoload.rb +0 -145
- data/test/util/features.rb +0 -95
@@ -12,11 +12,11 @@ Puppet::Type.type(:file).newproperty(:checksum) do
|
|
12
12
|
specify that a file's checksum should be monitored and then subscribe to
|
13
13
|
the file from another object and receive events to signify
|
14
14
|
checksum changes, for instance.
|
15
|
-
|
15
|
+
|
16
16
|
There are a number of checksum types available including MD5 hashing (and
|
17
|
-
an md5lite variation that only hashes the first 500 characters of the
|
17
|
+
an md5lite variation that only hashes the first 500 characters of the
|
18
18
|
file.
|
19
|
-
|
19
|
+
|
20
20
|
The default checksum parameter, if checksums are enabled, is md5."
|
21
21
|
|
22
22
|
@event = :file_changed
|
@@ -66,6 +66,7 @@ Puppet::Type.type(:file).newproperty(:checksum) do
|
|
66
66
|
# Store the checksum in the data cache, or retrieve it if only the
|
67
67
|
# sum type is provided.
|
68
68
|
def cache(type, sum = nil)
|
69
|
+
return unless c = resource.catalog and c.host_config?
|
69
70
|
unless type
|
70
71
|
raise ArgumentError, "A type must be specified to cache a checksum"
|
71
72
|
end
|
@@ -73,7 +74,7 @@ Puppet::Type.type(:file).newproperty(:checksum) do
|
|
73
74
|
type = :mtime if type == :timestamp
|
74
75
|
type = :ctime if type == :time
|
75
76
|
|
76
|
-
unless state = @resource.cached(:checksums)
|
77
|
+
unless state = @resource.cached(:checksums)
|
77
78
|
self.debug "Initializing checksum hash"
|
78
79
|
state = {}
|
79
80
|
@resource.cache(:checksums, state)
|
@@ -171,12 +172,9 @@ Puppet::Type.type(:file).newproperty(:checksum) do
|
|
171
172
|
if currentvalue == :absent
|
172
173
|
# if they're copying, then we won't worry about the file
|
173
174
|
# not existing yet
|
174
|
-
unless @resource.property(:source)
|
175
|
-
self.warning("File %s does not exist -- cannot checksum" % @resource[:path])
|
176
|
-
end
|
177
|
-
return nil
|
175
|
+
return nil unless @resource.property(:source)
|
178
176
|
end
|
179
|
-
|
177
|
+
|
180
178
|
# If the sums are different, then return an event.
|
181
179
|
if self.updatesum(currentvalue)
|
182
180
|
return :file_changed
|
@@ -195,7 +193,7 @@ Puppet::Type.type(:file).newproperty(:checksum) do
|
|
195
193
|
return true
|
196
194
|
end
|
197
195
|
end
|
198
|
-
|
196
|
+
|
199
197
|
# Even though they can specify multiple checksums, the insync?
|
200
198
|
# mechanism can really only test against one, so we'll just retrieve
|
201
199
|
# the first specified sum type.
|
@@ -222,13 +220,14 @@ Puppet::Type.type(:file).newproperty(:checksum) do
|
|
222
220
|
# out of sync. We don't want to generate an event the first
|
223
221
|
# time we get a sum.
|
224
222
|
self.updatesum(currentvalue) unless cache(checktype())
|
225
|
-
|
223
|
+
|
226
224
|
# @resource.debug "checksum state is %s" % self.is
|
227
225
|
return currentvalue
|
228
226
|
end
|
229
227
|
|
230
228
|
# Store the new sum to the state db.
|
231
229
|
def updatesum(newvalue)
|
230
|
+
return unless c = resource.catalog and c.host_config?
|
232
231
|
result = false
|
233
232
|
|
234
233
|
# if we're replacing, vs. updating
|
@@ -1,6 +1,9 @@
|
|
1
|
+
require 'puppet/util/checksums'
|
2
|
+
|
1
3
|
module Puppet
|
2
4
|
Puppet::Type.type(:file).newproperty(:content) do
|
3
5
|
include Puppet::Util::Diff
|
6
|
+
include Puppet::Util::Checksums
|
4
7
|
|
5
8
|
desc "Specify the contents of a file as a string. Newlines, tabs, and
|
6
9
|
spaces can be specified using the escaped syntax (e.g., \\n for a
|
@@ -18,34 +21,93 @@ module Puppet
|
|
18
21
|
content => $str
|
19
22
|
}
|
20
23
|
}
|
21
|
-
|
24
|
+
|
22
25
|
This attribute is especially useful when used with
|
23
26
|
`PuppetTemplating templating`:trac:."
|
24
27
|
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
+
# Store a checksum as the value, rather than the actual content.
|
29
|
+
# Simplifies everything.
|
30
|
+
munge do |value|
|
31
|
+
if value == :absent
|
32
|
+
value
|
33
|
+
else
|
34
|
+
@actual_content = value
|
35
|
+
"{#{checksum_type}}" + send(self.checksum_type, value)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# Checksums need to invert how changes are printed.
|
40
|
+
def change_to_s(currentvalue, newvalue)
|
41
|
+
# Our "new" checksum value is provided by the source.
|
42
|
+
unless source = resource.parameter(:source) and newvalue = source.checksum
|
43
|
+
newvalue = "unknown checksum"
|
44
|
+
end
|
45
|
+
if currentvalue == :absent
|
46
|
+
return "defined content as '%s'" % [newvalue]
|
47
|
+
elsif newvalue == :absent
|
48
|
+
return "undefined content from '%s'" % [currentvalue]
|
49
|
+
else
|
50
|
+
return "content changed '%s' to '%s'" % [currentvalue, newvalue]
|
51
|
+
end
|
52
|
+
end
|
53
|
+
|
54
|
+
def checksum_type
|
55
|
+
if source = resource.parameter(:source)
|
56
|
+
result = source.checksum
|
57
|
+
elsif checksum = resource.parameter(:checksum)
|
58
|
+
result = checksum.checktype
|
59
|
+
else
|
60
|
+
return :md5
|
61
|
+
end
|
62
|
+
if result =~ /^\{(\w+)\}.+/
|
63
|
+
return $1.to_sym
|
64
|
+
else
|
65
|
+
return result
|
66
|
+
end
|
28
67
|
end
|
29
68
|
|
30
|
-
|
31
|
-
|
69
|
+
# If content was specified, return that; else try to return the source content;
|
70
|
+
# else, return nil.
|
71
|
+
def actual_content
|
72
|
+
if defined?(@actual_content) and @actual_content
|
73
|
+
return @actual_content
|
74
|
+
end
|
75
|
+
|
76
|
+
if s = resource.parameter(:source)
|
77
|
+
return s.content
|
78
|
+
end
|
79
|
+
return nil
|
32
80
|
end
|
33
81
|
|
34
|
-
def
|
35
|
-
|
82
|
+
def content
|
83
|
+
self.should || (s = resource.parameter(:source) and s.content)
|
36
84
|
end
|
37
85
|
|
38
86
|
# Override this method to provide diffs if asked for.
|
39
87
|
# Also, fix #872: when content is used, and replace is true, the file
|
40
88
|
# should be insync when it exists
|
41
89
|
def insync?(is)
|
42
|
-
if
|
90
|
+
if resource.should_be_file?
|
91
|
+
return false if is == :absent
|
92
|
+
else
|
93
|
+
return true
|
94
|
+
end
|
95
|
+
|
96
|
+
return true if ! @resource.replace?
|
97
|
+
|
98
|
+
if self.should
|
99
|
+
return super
|
100
|
+
elsif source = resource.parameter(:source)
|
101
|
+
fail "Got a remote source with no checksum" unless source.checksum
|
102
|
+
result = (is == source.checksum)
|
103
|
+
else
|
104
|
+
# We've got no content specified, and no source from which to
|
105
|
+
# get content.
|
43
106
|
return true
|
44
107
|
end
|
45
108
|
|
46
|
-
result
|
47
|
-
|
48
|
-
string_file_diff(@resource[:path], self.should)
|
109
|
+
if ! result and Puppet[:show_diff]
|
110
|
+
string_file_diff(@resource[:path], actual_content)
|
49
111
|
end
|
50
112
|
return result
|
51
113
|
end
|
@@ -53,31 +115,30 @@ module Puppet
|
|
53
115
|
def retrieve
|
54
116
|
return :absent unless stat = @resource.stat
|
55
117
|
|
56
|
-
|
57
|
-
|
58
|
-
# Don't even try to manage the content on directories
|
118
|
+
# Don't even try to manage the content on directories or links
|
59
119
|
return nil if stat.ftype == "directory"
|
60
120
|
|
61
121
|
begin
|
62
|
-
|
63
|
-
return currentvalue
|
122
|
+
return "{#{checksum_type}}" + send(checksum_type.to_s + "_file", resource[:path]).to_s
|
64
123
|
rescue => detail
|
65
|
-
raise Puppet::Error, "Could not read %s: %s" %
|
66
|
-
[@resource.title, detail]
|
124
|
+
raise Puppet::Error, "Could not read %s: %s" % [@resource.title, detail]
|
67
125
|
end
|
68
126
|
end
|
69
127
|
|
70
128
|
# Make sure we're also managing the checksum property.
|
71
129
|
def should=(value)
|
130
|
+
@resource.newattr(:checksum) unless @resource.parameter(:checksum)
|
72
131
|
super
|
73
|
-
@resource.newattr(:checksum) unless @resource.property(:checksum)
|
74
132
|
end
|
75
133
|
|
76
134
|
# Just write our content out to disk.
|
77
135
|
def sync
|
78
136
|
return_event = @resource.stat ? :file_changed : :file_created
|
79
|
-
|
80
|
-
|
137
|
+
|
138
|
+
# We're safe not testing for the 'source' if there's no 'should'
|
139
|
+
# because we wouldn't have gotten this far if there weren't at least
|
140
|
+
# one valid value somewhere.
|
141
|
+
@resource.write(actual_content, :content)
|
81
142
|
|
82
143
|
return return_event
|
83
144
|
end
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Puppet
|
2
|
-
Puppet.type(:file).ensurable do
|
2
|
+
Puppet::Type.type(:file).ensurable do
|
3
3
|
require 'etc'
|
4
4
|
desc "Whether to create files that don't currently exist.
|
5
5
|
Possible values are *absent*, *present*, *file*, and *directory*.
|
@@ -9,14 +9,14 @@ module Puppet
|
|
9
9
|
|
10
10
|
Anything other than those values will be considered to be a symlink.
|
11
11
|
For instance, the following text creates a link::
|
12
|
-
|
12
|
+
|
13
13
|
# Useful on solaris
|
14
14
|
file { \"/etc/inetd.conf\":
|
15
15
|
ensure => \"/etc/inet/inetd.conf\"
|
16
16
|
}
|
17
|
-
|
17
|
+
|
18
18
|
You can make relative links::
|
19
|
-
|
19
|
+
|
20
20
|
# Useful on solaris
|
21
21
|
file { \"/etc/inetd.conf\":
|
22
22
|
ensure => \"inet/inetd.conf\"
|
@@ -110,13 +110,19 @@ module Puppet
|
|
110
110
|
end
|
111
111
|
|
112
112
|
def change_to_s(currentvalue, newvalue)
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
113
|
+
return super unless newvalue.to_s == "file"
|
114
|
+
|
115
|
+
return super unless property = @resource.property(:content)
|
116
|
+
|
117
|
+
# We know that content is out of sync if we're here, because
|
118
|
+
# it's essentially equivalent to 'ensure' in the transaction.
|
119
|
+
if source = @resource.parameter(:source)
|
120
|
+
should = source.checksum
|
117
121
|
else
|
118
|
-
|
122
|
+
should = property.should
|
119
123
|
end
|
124
|
+
|
125
|
+
return property.change_to_s(property.retrieve, should)
|
120
126
|
end
|
121
127
|
|
122
128
|
# Check that we can actually create anything
|
@@ -2,7 +2,7 @@ require 'puppet/util/posix'
|
|
2
2
|
|
3
3
|
# Manage file group ownership.
|
4
4
|
module Puppet
|
5
|
-
Puppet.type(:file).newproperty(:group) do
|
5
|
+
Puppet::Type.type(:file).newproperty(:group) do
|
6
6
|
include Puppet::Util::POSIX
|
7
7
|
|
8
8
|
require 'etc'
|
@@ -79,6 +79,12 @@ module Puppet
|
|
79
79
|
|
80
80
|
# Determine if the group is valid, and if so, return the GID
|
81
81
|
def validgroup?(value)
|
82
|
+
begin
|
83
|
+
number = Integer(value)
|
84
|
+
return number
|
85
|
+
rescue ArgumentError
|
86
|
+
number = nil
|
87
|
+
end
|
82
88
|
if number = gid(value)
|
83
89
|
return number
|
84
90
|
else
|
@@ -2,7 +2,7 @@
|
|
2
2
|
# for specification (e.g., u+rwx, or -0011), but for now only supports
|
3
3
|
# specifying the full mode.
|
4
4
|
module Puppet
|
5
|
-
Puppet.type(:file).newproperty(:mode) do
|
5
|
+
Puppet::Type.type(:file).newproperty(:mode) do
|
6
6
|
require 'etc'
|
7
7
|
desc "Mode the file should be. Currently relatively limited:
|
8
8
|
you must specify the exact mode the file should be."
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Puppet
|
2
|
-
Puppet.type(:file).newproperty(:owner) do
|
2
|
+
Puppet::Type.type(:file).newproperty(:owner) do
|
3
3
|
include Puppet::Util::POSIX
|
4
4
|
include Puppet::Util::Warnings
|
5
5
|
|
@@ -49,6 +49,12 @@ module Puppet
|
|
49
49
|
|
50
50
|
# Determine if the user is valid, and if so, return the UID
|
51
51
|
def validuser?(value)
|
52
|
+
begin
|
53
|
+
number = Integer(value)
|
54
|
+
return number
|
55
|
+
rescue ArgumentError
|
56
|
+
number = nil
|
57
|
+
end
|
52
58
|
if number = uid(value)
|
53
59
|
return number
|
54
60
|
else
|
@@ -89,13 +95,13 @@ module Puppet
|
|
89
95
|
end
|
90
96
|
end
|
91
97
|
end
|
92
|
-
|
98
|
+
|
93
99
|
unless stat = @resource.stat(false)
|
94
100
|
return :absent
|
95
101
|
end
|
96
102
|
|
97
103
|
currentvalue = stat.uid
|
98
|
-
|
104
|
+
|
99
105
|
# On OS X, files that are owned by -2 get returned as really
|
100
106
|
# large UIDs instead of negative ones. This isn't a Ruby bug,
|
101
107
|
# it's an OS X bug, since it shows up in perl, too.
|
@@ -58,7 +58,7 @@ module Puppet
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
Puppet.type(:file).newproperty(:seluser, :parent => Puppet::SELFileContext) do
|
61
|
+
Puppet::Type.type(:file).newproperty(:seluser, :parent => Puppet::SELFileContext) do
|
62
62
|
desc "What the SELinux user component of the context of the file should be.
|
63
63
|
Any valid SELinux user component is accepted. For example ``user_u``.
|
64
64
|
If not specified it defaults to the value returned by matchpathcon for
|
@@ -69,7 +69,7 @@ module Puppet
|
|
69
69
|
defaultto { self.retrieve_default_context(:seluser) }
|
70
70
|
end
|
71
71
|
|
72
|
-
Puppet.type(:file).newproperty(:selrole, :parent => Puppet::SELFileContext) do
|
72
|
+
Puppet::Type.type(:file).newproperty(:selrole, :parent => Puppet::SELFileContext) do
|
73
73
|
desc "What the SELinux role component of the context of the file should be.
|
74
74
|
Any valid SELinux role component is accepted. For example ``role_r``.
|
75
75
|
If not specified it defaults to the value returned by matchpathcon for
|
@@ -80,7 +80,7 @@ module Puppet
|
|
80
80
|
defaultto { self.retrieve_default_context(:selrole) }
|
81
81
|
end
|
82
82
|
|
83
|
-
Puppet.type(:file).newproperty(:seltype, :parent => Puppet::SELFileContext) do
|
83
|
+
Puppet::Type.type(:file).newproperty(:seltype, :parent => Puppet::SELFileContext) do
|
84
84
|
desc "What the SELinux type component of the context of the file should be.
|
85
85
|
Any valid SELinux type component is accepted. For example ``tmp_t``.
|
86
86
|
If not specified it defaults to the value returned by matchpathcon for
|
@@ -91,7 +91,7 @@ module Puppet
|
|
91
91
|
defaultto { self.retrieve_default_context(:seltype) }
|
92
92
|
end
|
93
93
|
|
94
|
-
Puppet.type(:file).newproperty(:selrange, :parent => Puppet::SELFileContext) do
|
94
|
+
Puppet::Type.type(:file).newproperty(:selrange, :parent => Puppet::SELFileContext) do
|
95
95
|
desc "What the SELinux range component of the context of the file should be.
|
96
96
|
Any valid SELinux range component is accepted. For example ``s0`` or
|
97
97
|
``SystemHigh``. If not specified it defaults to the value returned by
|
@@ -1,10 +1,14 @@
|
|
1
|
+
|
2
|
+
require 'puppet/file_serving/content'
|
3
|
+
require 'puppet/file_serving/metadata'
|
4
|
+
|
1
5
|
module Puppet
|
2
6
|
# Copy files from a local or remote source. This state *only* does any work
|
3
7
|
# when the remote file is an actual file; in that case, this state copies
|
4
8
|
# the file down. If the remote file is a dir or a link or whatever, then
|
5
9
|
# this state, during retrieval, modifies the appropriate other states
|
6
10
|
# so that things get taken care of appropriately.
|
7
|
-
Puppet.type(:file).
|
11
|
+
Puppet::Type.type(:file).newparam(:source) do
|
8
12
|
include Puppet::Util::Diff
|
9
13
|
|
10
14
|
attr_accessor :source, :local
|
@@ -29,15 +33,15 @@ module Puppet
|
|
29
33
|
will use the local filesystem. This makes it easy to use the same
|
30
34
|
configuration in both local and centralized forms.
|
31
35
|
|
32
|
-
Currently, only the ``puppet`` scheme is supported for source
|
33
|
-
URL's. Puppet will connect to the file server running on
|
34
|
-
``server`` to retrieve the contents of the file. If the
|
35
|
-
``server`` part is empty, the behavior of the command-line
|
36
|
+
Currently, only the ``puppet`` scheme is supported for source
|
37
|
+
URL's. Puppet will connect to the file server running on
|
38
|
+
``server`` to retrieve the contents of the file. If the
|
39
|
+
``server`` part is empty, the behavior of the command-line
|
36
40
|
interpreter (``puppet``) and the client demon (``puppetd``) differs
|
37
41
|
slightly: ``puppet`` will look such a file up on the module path
|
38
|
-
on the local host, whereas ``puppetd`` will connect to the
|
42
|
+
on the local host, whereas ``puppetd`` will connect to the
|
39
43
|
puppet server that it received the manifest from.
|
40
|
-
|
44
|
+
|
41
45
|
See the `FileServingConfiguration fileserver configuration documentation`:trac: for information on how to configure
|
42
46
|
and use file services within Puppet.
|
43
47
|
|
@@ -52,225 +56,120 @@ module Puppet
|
|
52
56
|
\"/nfs/files/file\"
|
53
57
|
]
|
54
58
|
}
|
55
|
-
|
59
|
+
|
56
60
|
This will use the first found file as the source.
|
57
|
-
|
61
|
+
|
58
62
|
You cannot currently copy links using this mechanism; set ``links``
|
59
63
|
to ``follow`` if any remote sources are links.
|
60
64
|
"
|
61
65
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
66
|
+
validate do |sources|
|
67
|
+
sources = [sources] unless sources.is_a?(Array)
|
68
|
+
sources.each do |source|
|
69
|
+
begin
|
70
|
+
uri = URI.parse(URI.escape(source))
|
71
|
+
rescue => detail
|
72
|
+
self.fail "Could not understand source %s: %s" % [source, detail.to_s]
|
73
|
+
end
|
74
|
+
|
75
|
+
unless uri.scheme.nil? or %w{file puppet}.include?(uri.scheme)
|
76
|
+
self.fail "Cannot use URLs of type '%s' as source for fileserving" % [uri.scheme]
|
77
|
+
end
|
67
78
|
end
|
68
79
|
end
|
69
|
-
|
70
|
-
munge do |source|
|
71
|
-
# if source.is_a? Symbol
|
72
|
-
# return source
|
73
|
-
# end
|
74
80
|
|
75
|
-
|
76
|
-
|
81
|
+
munge do |sources|
|
82
|
+
sources = [sources] unless sources.is_a?(Array)
|
83
|
+
sources.collect { |source| source.sub(/\/$/, '') }
|
77
84
|
end
|
78
|
-
|
85
|
+
|
79
86
|
def change_to_s(currentvalue, newvalue)
|
80
|
-
# newvalue = "{md5}" + @
|
87
|
+
# newvalue = "{md5}" + @metadata.checksum
|
81
88
|
if @resource.property(:ensure).retrieve == :absent
|
82
|
-
return "creating from source %s with contents %s" % [
|
89
|
+
return "creating from source %s with contents %s" % [metadata.source, metadata.checksum]
|
83
90
|
else
|
84
|
-
return "replacing from source %s with contents %s" % [
|
91
|
+
return "replacing from source %s with contents %s" % [metadata.source, metadata.checksum]
|
85
92
|
end
|
86
93
|
end
|
87
|
-
|
94
|
+
|
88
95
|
def checksum
|
89
|
-
if
|
90
|
-
|
96
|
+
if metadata
|
97
|
+
metadata.checksum
|
91
98
|
else
|
92
99
|
nil
|
93
100
|
end
|
94
101
|
end
|
95
102
|
|
96
|
-
#
|
97
|
-
|
98
|
-
|
99
|
-
server = sourceobj.server
|
103
|
+
# Look up (if necessary) and return remote content.
|
104
|
+
cached_attr(:content) do
|
105
|
+
raise Puppet::DevError, "No source for content was stored with the metadata" unless metadata.source
|
100
106
|
|
101
|
-
|
102
|
-
|
103
|
-
rescue Puppet::Network::XMLRPCClientError => detail
|
104
|
-
fail detail, "Could not describe %s: %s" % [path, detail]
|
107
|
+
unless tmp = Puppet::FileServing::Content.find(metadata.source)
|
108
|
+
fail "Could not find any content at %s" % metadata.source
|
105
109
|
end
|
110
|
+
tmp.content
|
111
|
+
end
|
106
112
|
|
107
|
-
|
113
|
+
# Copy the values from the source to the resource. Yay.
|
114
|
+
def copy_source_values
|
115
|
+
devfail "Somehow got asked to copy source values without any metadata" unless metadata
|
108
116
|
|
109
|
-
#
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
end
|
117
|
-
unless value.nil?
|
118
|
-
args[param] = value
|
117
|
+
# Take each of the stats and set them as states on the local file
|
118
|
+
# if a value has not already been provided.
|
119
|
+
[:owner, :mode, :group, :checksum].each do |param|
|
120
|
+
next if param == :owner and Puppet::Util::SUIDManager.uid != 0
|
121
|
+
next if param == :checksum and metadata.ftype == "directory"
|
122
|
+
unless value = @resource[param] and value != :absent
|
123
|
+
@resource[param] = metadata.send(param)
|
119
124
|
end
|
120
|
-
}
|
121
|
-
|
122
|
-
# Now decide whether we're doing checksums or symlinks
|
123
|
-
if args[:type] == "link"
|
124
|
-
args[:target] = other
|
125
|
-
else
|
126
|
-
args[:checksum] = other
|
127
125
|
end
|
128
126
|
|
129
|
-
#
|
130
|
-
|
131
|
-
args.delete(:owner)
|
132
|
-
end
|
133
|
-
|
134
|
-
return args
|
135
|
-
end
|
136
|
-
|
137
|
-
# Use the info we get from describe() to check if we're in sync.
|
138
|
-
def insync?(currentvalue)
|
139
|
-
if currentvalue == :nocopy
|
140
|
-
return true
|
141
|
-
end
|
142
|
-
|
143
|
-
# the only thing this actual state can do is copy files around. Therefore,
|
144
|
-
# only pay attention if the remote is a file.
|
145
|
-
unless @stats[:type] == "file"
|
146
|
-
return true
|
147
|
-
end
|
148
|
-
|
149
|
-
#FIXARB: Inefficient? Needed to call retrieve on parent's ensure and checksum
|
150
|
-
parentensure = @resource.property(:ensure).retrieve
|
151
|
-
if parentensure != :absent and ! @resource.replace?
|
152
|
-
return true
|
153
|
-
end
|
154
|
-
# Now, we just check to see if the checksums are the same
|
155
|
-
parentchecksum = @resource.property(:checksum).retrieve
|
156
|
-
result = (!parentchecksum.nil? and (parentchecksum == @stats[:checksum]))
|
127
|
+
# Set the 'ensure' value, unless we're trying to delete the file.
|
128
|
+
@resource[:ensure] = metadata.ftype unless @resource[:ensure] == :absent
|
157
129
|
|
158
|
-
|
159
|
-
|
160
|
-
# retrieval twice, so we cache the value.
|
161
|
-
if ! result and Puppet[:show_diff] and File.exists?(@resource[:path]) and ! @stats[:_diffed]
|
162
|
-
@stats[:_remote_content] = get_remote_content
|
163
|
-
string_file_diff(@resource[:path], @stats[:_remote_content])
|
164
|
-
@stats[:_diffed] = true
|
130
|
+
if metadata.ftype == "link"
|
131
|
+
@resource[:target] = metadata.destination
|
165
132
|
end
|
166
|
-
return result
|
167
133
|
end
|
168
134
|
|
169
135
|
def pinparams
|
170
|
-
[:mode, :type, :owner, :group]
|
136
|
+
[:mode, :type, :owner, :group, :content]
|
171
137
|
end
|
172
138
|
|
173
139
|
def found?
|
174
|
-
! (
|
140
|
+
! (metadata.nil? or metadata.ftype.nil?)
|
175
141
|
end
|
176
142
|
|
177
|
-
#
|
178
|
-
#
|
179
|
-
#
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
# Find the first source that exists. @shouldorig contains
|
189
|
-
# the sources as specified by the user.
|
190
|
-
@should.each { |source|
|
191
|
-
if @stats = self.describe(source)
|
192
|
-
@source = source
|
143
|
+
# Provide, and retrieve if necessary, the metadata for this file. Fail
|
144
|
+
# if we can't find data about this host, and fail if there are any
|
145
|
+
# problems in our query.
|
146
|
+
cached_attr(:metadata) do
|
147
|
+
return nil unless value
|
148
|
+
result = nil
|
149
|
+
value.each do |source|
|
150
|
+
begin
|
151
|
+
if data = Puppet::FileServing::Metadata.find(source)
|
152
|
+
result = data
|
153
|
+
result.source = source
|
193
154
|
break
|
194
155
|
end
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
if !found?
|
199
|
-
raise Puppet::Error, "No specified source was found from" + @should.inject("") { |s, source| s + " #{source},"}.gsub(/,$/,"")
|
200
|
-
end
|
201
|
-
|
202
|
-
case @stats[:type]
|
203
|
-
when "directory", "file", "link":
|
204
|
-
@resource[:ensure] = @stats[:type] unless @resource.deleting?
|
205
|
-
else
|
206
|
-
self.info @stats.inspect
|
207
|
-
self.err "Cannot use files of type %s as sources" % @stats[:type]
|
208
|
-
return :nocopy
|
156
|
+
rescue => detail
|
157
|
+
fail detail, "Could not retrieve file metadata for %s: %s" % [source, detail]
|
158
|
+
end
|
209
159
|
end
|
210
|
-
|
211
|
-
|
212
|
-
# if a value has not already been provided.
|
213
|
-
@stats.each { |stat, value|
|
214
|
-
next if stat == :checksum
|
215
|
-
next if stat == :type
|
216
|
-
|
217
|
-
# was the stat already specified, or should the value
|
218
|
-
# be inherited from the source?
|
219
|
-
@resource[stat] = value unless @resource.argument?(stat)
|
220
|
-
}
|
221
|
-
|
222
|
-
return @stats[:checksum]
|
160
|
+
fail "Could not retrieve information from source(s) %s" % value.join(", ") unless result
|
161
|
+
result
|
223
162
|
end
|
224
|
-
|
225
|
-
def should
|
226
|
-
@should
|
227
|
-
end
|
228
|
-
|
163
|
+
|
229
164
|
# Make sure we're also checking the checksum
|
230
|
-
def
|
165
|
+
def value=(value)
|
231
166
|
super
|
232
167
|
|
233
168
|
checks = (pinparams + [:ensure])
|
234
169
|
checks.delete(:checksum)
|
235
|
-
|
236
|
-
@resource[:check] = checks
|
237
|
-
@resource[:checksum] = :md5 unless @resource.property(:checksum)
|
238
|
-
end
|
239
|
-
|
240
|
-
def sync
|
241
|
-
contents = @stats[:_remote_content] || get_remote_content()
|
242
|
-
|
243
|
-
exists = File.exists?(@resource[:path])
|
244
|
-
|
245
|
-
@resource.write(contents, :source, @stats[:checksum])
|
246
|
-
|
247
|
-
if exists
|
248
|
-
return :file_changed
|
249
|
-
else
|
250
|
-
return :file_created
|
251
|
-
end
|
252
|
-
end
|
253
|
-
|
254
|
-
private
|
255
|
-
|
256
|
-
def get_remote_content
|
257
|
-
raise Puppet::DevError, "Got told to copy non-file %s" % @resource[:path] unless @stats[:type] == "file"
|
258
|
-
|
259
|
-
sourceobj, path = @resource.uri2obj(@source)
|
260
|
-
|
261
|
-
begin
|
262
|
-
contents = sourceobj.server.retrieve(path, @resource[:links])
|
263
|
-
rescue => detail
|
264
|
-
self.fail "Could not retrieve %s: %s" % [path, detail]
|
265
|
-
end
|
266
|
-
|
267
|
-
contents = CGI.unescape(contents) unless sourceobj.server.local
|
268
|
-
|
269
|
-
if contents == ""
|
270
|
-
self.notice "Could not retrieve contents for %s" % @source
|
271
|
-
end
|
272
170
|
|
273
|
-
|
171
|
+
resource[:check] = checks
|
172
|
+
resource[:checksum] = :md5 unless resource.property(:checksum)
|
274
173
|
end
|
275
174
|
end
|
276
175
|
end
|