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
@@ -0,0 +1,111 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
4
|
+
|
5
|
+
require 'puppet/resource/reference'
|
6
|
+
|
7
|
+
describe Puppet::Resource::Reference do
|
8
|
+
it "should have a :title attribute" do
|
9
|
+
Puppet::Resource::Reference.new(:file, "foo").title.should == "foo"
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should canonize types to capitalized strings" do
|
13
|
+
Puppet::Resource::Reference.new(:file, "foo").type.should == "File"
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should canonize qualified types so all strings are capitalized" do
|
17
|
+
Puppet::Resource::Reference.new("foo::bar", "foo").type.should == "Foo::Bar"
|
18
|
+
end
|
19
|
+
|
20
|
+
it "should set its type to 'Class' and its title to the passed title if the passed type is :component and the title has no square brackets in it" do
|
21
|
+
ref = Puppet::Resource::Reference.new(:component, "foo")
|
22
|
+
ref.type.should == "Class"
|
23
|
+
ref.title.should == "foo"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "should interpret the title as a reference and assign appropriately if the type is :component and the title contains square brackets" do
|
27
|
+
ref = Puppet::Resource::Reference.new(:component, "foo::bar[yay]")
|
28
|
+
ref.type.should == "Foo::Bar"
|
29
|
+
ref.title.should == "yay"
|
30
|
+
end
|
31
|
+
|
32
|
+
it "should set the type to 'Class' if it is nil and the title contains no square brackets" do
|
33
|
+
ref = Puppet::Resource::Reference.new(nil, "yay")
|
34
|
+
ref.type.should == "Class"
|
35
|
+
ref.title.should == "yay"
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should interpret the title as a reference and assign appropriately if the type is nil and the title contains square brackets" do
|
39
|
+
ref = Puppet::Resource::Reference.new(nil, "foo::bar[yay]")
|
40
|
+
ref.type.should == "Foo::Bar"
|
41
|
+
ref.title.should == "yay"
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should interpret the title as a reference and assign appropriately if the type is nil and the title contains nested square brackets" do
|
45
|
+
ref = Puppet::Resource::Reference.new(nil, "foo::bar[baz[yay]]")
|
46
|
+
ref.type.should == "Foo::Bar"
|
47
|
+
ref.title.should =="baz[yay]"
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should interpret the type as a reference and assign appropriately if the title is nil and the type contains square brackets" do
|
51
|
+
ref = Puppet::Resource::Reference.new("foo::bar[baz]")
|
52
|
+
ref.type.should == "Foo::Bar"
|
53
|
+
ref.title.should =="baz"
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should be able to extract its information from a Puppet::Type instance" do
|
57
|
+
ral = Puppet::Type.type(:file).new :path => "/foo"
|
58
|
+
ref = Puppet::Resource::Reference.new(ral)
|
59
|
+
ref.type.should == "File"
|
60
|
+
ref.title.should == "/foo"
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
it "should fail if the title is nil and the type is not a valid resource reference string" do
|
65
|
+
lambda { Puppet::Resource::Reference.new("foo") }.should raise_error(ArgumentError)
|
66
|
+
end
|
67
|
+
|
68
|
+
it "should be considered builtin if an existing resource type matches the type" do
|
69
|
+
Puppet::Resource::Reference.new("file", "/f").should be_builtin_type
|
70
|
+
end
|
71
|
+
|
72
|
+
it "should be not considered builtin if an existing resource type does not match the type" do
|
73
|
+
Puppet::Resource::Reference.new("foobar", "/f").should_not be_builtin_type
|
74
|
+
end
|
75
|
+
|
76
|
+
it "should be able to produce a backward-compatible reference array" do
|
77
|
+
Puppet::Resource::Reference.new("foobar", "/f").to_trans_ref.should == %w{Foobar /f}
|
78
|
+
end
|
79
|
+
|
80
|
+
it "should downcase resource types when producing a backward-compatible reference array for builtin resource types" do
|
81
|
+
Puppet::Resource::Reference.new("file", "/f").to_trans_ref.should == %w{file /f}
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should be considered equivalent to another reference if their type and title match" do
|
85
|
+
Puppet::Resource::Reference.new("file", "/f").should == Puppet::Resource::Reference.new("file", "/f")
|
86
|
+
end
|
87
|
+
|
88
|
+
it "should not be considered equivalent to a non-reference" do
|
89
|
+
Puppet::Resource::Reference.new("file", "/f").should_not == "foo"
|
90
|
+
end
|
91
|
+
|
92
|
+
it "should not be considered equivalent to another reference if their types do not match" do
|
93
|
+
Puppet::Resource::Reference.new("file", "/f").should_not == Puppet::Resource::Reference.new("exec", "/f")
|
94
|
+
end
|
95
|
+
|
96
|
+
it "should not be considered equivalent to another reference if their titles do not match" do
|
97
|
+
Puppet::Resource::Reference.new("file", "/foo").should_not == Puppet::Resource::Reference.new("file", "/f")
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
101
|
+
describe Puppet::Resource::Reference, "when resolving resources with a catalog" do
|
102
|
+
it "should resolve all resources using the catalog" do
|
103
|
+
config = mock 'catalog'
|
104
|
+
ref = Puppet::Resource::Reference.new("foo::bar", "yay")
|
105
|
+
ref.catalog = config
|
106
|
+
|
107
|
+
config.expects(:resource).with("Foo::Bar[yay]").returns(:myresource)
|
108
|
+
|
109
|
+
ref.resolve.should == :myresource
|
110
|
+
end
|
111
|
+
end
|
data/spec/unit/simple_graph.rb
CHANGED
@@ -30,251 +30,508 @@ describe Puppet::SimpleGraph do
|
|
30
30
|
|
31
31
|
proc { @graph.to_dot_graph }.should_not raise_error
|
32
32
|
end
|
33
|
-
end
|
34
33
|
|
35
|
-
|
36
|
-
before do
|
34
|
+
it "should always put its edges first when printing yaml" do
|
37
35
|
@graph = Puppet::SimpleGraph.new
|
36
|
+
@graph.add_edge(:one, :two)
|
37
|
+
p @graph.to_yaml_properties
|
38
|
+
@graph.to_yaml_properties[0].should == "@edges"
|
38
39
|
end
|
39
40
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
41
|
+
describe "when managing vertices" do
|
42
|
+
before do
|
43
|
+
@graph = Puppet::SimpleGraph.new
|
44
|
+
end
|
44
45
|
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
46
|
+
it "should provide a method to add a vertex" do
|
47
|
+
@graph.add_vertex(:test)
|
48
|
+
@graph.vertex?(:test).should be_true
|
49
|
+
end
|
49
50
|
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
51
|
+
it "should reset its reversed graph when vertices are added" do
|
52
|
+
rev = @graph.reversal
|
53
|
+
@graph.add_vertex(:test)
|
54
|
+
@graph.reversal.should_not equal(rev)
|
55
|
+
end
|
54
56
|
|
55
|
-
|
56
|
-
|
57
|
-
|
57
|
+
it "should ignore already-present vertices when asked to add a vertex" do
|
58
|
+
@graph.add_vertex(:test)
|
59
|
+
proc { @graph.add_vertex(:test) }.should_not raise_error
|
60
|
+
end
|
58
61
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
@graph.vertices.should include(:one)
|
64
|
-
@graph.vertices.should include(:two)
|
65
|
-
end
|
62
|
+
it "should return true when asked if a vertex is present" do
|
63
|
+
@graph.add_vertex(:test)
|
64
|
+
@graph.vertex?(:test).should be_true
|
65
|
+
end
|
66
66
|
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
@graph.vertex?(:one).should be_false
|
71
|
-
end
|
67
|
+
it "should return false when asked if a non-vertex is present" do
|
68
|
+
@graph.vertex?(:test).should be_false
|
69
|
+
end
|
72
70
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
71
|
+
it "should return all set vertices when asked" do
|
72
|
+
@graph.add_vertex(:one)
|
73
|
+
@graph.add_vertex(:two)
|
74
|
+
@graph.vertices.length.should == 2
|
75
|
+
@graph.vertices.should include(:one)
|
76
|
+
@graph.vertices.should include(:two)
|
77
|
+
end
|
77
78
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
it "should remove a given vertex when asked" do
|
80
|
+
@graph.add_vertex(:one)
|
81
|
+
@graph.remove_vertex!(:one)
|
82
|
+
@graph.vertex?(:one).should be_false
|
83
|
+
end
|
82
84
|
|
83
|
-
|
84
|
-
|
85
|
+
it "should do nothing when a non-vertex is asked to be removed" do
|
86
|
+
proc { @graph.remove_vertex!(:one) }.should_not raise_error
|
87
|
+
end
|
85
88
|
end
|
86
89
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
end
|
90
|
+
describe "when managing edges" do
|
91
|
+
before do
|
92
|
+
@graph = Puppet::SimpleGraph.new
|
93
|
+
end
|
92
94
|
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
end
|
95
|
+
it "should provide a method to test whether a given vertex pair is an edge" do
|
96
|
+
@graph.should respond_to(:edge?)
|
97
|
+
end
|
97
98
|
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
99
|
+
it "should reset its reversed graph when edges are added" do
|
100
|
+
rev = @graph.reversal
|
101
|
+
@graph.add_edge(:one, :two)
|
102
|
+
@graph.reversal.should_not equal(rev)
|
103
|
+
end
|
102
104
|
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
105
|
+
it "should provide a method to add an edge as an instance of the edge class" do
|
106
|
+
edge = Puppet::Relationship.new(:one, :two)
|
107
|
+
@graph.add_edge(edge)
|
108
|
+
@graph.edge?(:one, :two).should be_true
|
109
|
+
end
|
108
110
|
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
end
|
111
|
+
it "should provide a method to add an edge by specifying the two vertices" do
|
112
|
+
@graph.add_edge(:one, :two)
|
113
|
+
@graph.edge?(:one, :two).should be_true
|
114
|
+
end
|
114
115
|
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
end
|
116
|
+
it "should provide a method to add an edge by specifying the two vertices and a label" do
|
117
|
+
@graph.add_edge(:one, :two, :callback => :awesome)
|
118
|
+
@graph.edge?(:one, :two).should be_true
|
119
|
+
end
|
120
120
|
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
121
|
+
it "should provide a method for retrieving an edge label" do
|
122
|
+
edge = Puppet::Relationship.new(:one, :two, :callback => :awesome)
|
123
|
+
@graph.add_edge(edge)
|
124
|
+
@graph.edge_label(:one, :two).should == {:callback => :awesome}
|
125
|
+
end
|
126
126
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
edges = @graph.edges
|
133
|
-
edges.length.should == 2
|
134
|
-
edges.should include(one)
|
135
|
-
edges.should include(two)
|
136
|
-
end
|
127
|
+
it "should provide a method for retrieving an edge" do
|
128
|
+
edge = Puppet::Relationship.new(:one, :two)
|
129
|
+
@graph.add_edge(edge)
|
130
|
+
@graph.edge(:one, :two).should equal(edge)
|
131
|
+
end
|
137
132
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
end
|
133
|
+
it "should add the edge source as a vertex if it is not already" do
|
134
|
+
edge = Puppet::Relationship.new(:one, :two)
|
135
|
+
@graph.add_edge(edge)
|
136
|
+
@graph.vertex?(:one).should be_true
|
137
|
+
end
|
144
138
|
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
@graph.remove_vertex!(:two)
|
151
|
-
@graph.edge?(:one, :two).should be_false
|
152
|
-
@graph.edge?(:two, :three).should be_false
|
153
|
-
@graph.edges.length.should == 0
|
154
|
-
end
|
155
|
-
end
|
139
|
+
it "should add the edge target as a vertex if it is not already" do
|
140
|
+
edge = Puppet::Relationship.new(:one, :two)
|
141
|
+
@graph.add_edge(edge)
|
142
|
+
@graph.vertex?(:two).should be_true
|
143
|
+
end
|
156
144
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
145
|
+
it "should return all edges as edge instances when asked" do
|
146
|
+
one = Puppet::Relationship.new(:one, :two)
|
147
|
+
two = Puppet::Relationship.new(:two, :three)
|
148
|
+
@graph.add_edge(one)
|
149
|
+
@graph.add_edge(two)
|
150
|
+
edges = @graph.edges
|
151
|
+
edges.should be_instance_of(Array)
|
152
|
+
edges.length.should == 2
|
153
|
+
edges.should include(one)
|
154
|
+
edges.should include(two)
|
155
|
+
end
|
167
156
|
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
157
|
+
it "should remove an edge when asked" do
|
158
|
+
edge = Puppet::Relationship.new(:one, :two)
|
159
|
+
@graph.add_edge(edge)
|
160
|
+
@graph.remove_edge!(edge)
|
161
|
+
@graph.edge?(edge.source, edge.target).should be_false
|
162
|
+
end
|
173
163
|
|
174
|
-
|
175
|
-
|
164
|
+
it "should remove all related edges when a vertex is removed" do
|
165
|
+
one = Puppet::Relationship.new(:one, :two)
|
166
|
+
two = Puppet::Relationship.new(:two, :three)
|
167
|
+
@graph.add_edge(one)
|
168
|
+
@graph.add_edge(two)
|
169
|
+
@graph.remove_vertex!(:two)
|
170
|
+
@graph.edge?(:one, :two).should be_false
|
171
|
+
@graph.edge?(:two, :three).should be_false
|
172
|
+
@graph.edges.length.should == 0
|
173
|
+
end
|
176
174
|
end
|
177
175
|
|
178
|
-
|
179
|
-
|
180
|
-
|
176
|
+
describe "when finding adjacent vertices" do
|
177
|
+
before do
|
178
|
+
@graph = Puppet::SimpleGraph.new
|
179
|
+
@one_two = Puppet::Relationship.new(:one, :two)
|
180
|
+
@two_three = Puppet::Relationship.new(:two, :three)
|
181
|
+
@one_three = Puppet::Relationship.new(:one, :three)
|
182
|
+
@graph.add_edge(@one_two)
|
183
|
+
@graph.add_edge(@one_three)
|
184
|
+
@graph.add_edge(@two_three)
|
185
|
+
end
|
181
186
|
|
182
|
-
|
183
|
-
|
184
|
-
|
187
|
+
it "should return adjacent vertices" do
|
188
|
+
adj = @graph.adjacent(:one)
|
189
|
+
adj.should be_include(:three)
|
190
|
+
adj.should be_include(:two)
|
191
|
+
end
|
185
192
|
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
end
|
193
|
+
it "should default to finding :out vertices" do
|
194
|
+
@graph.adjacent(:two).should == [:three]
|
195
|
+
end
|
190
196
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
one = Puppet::Relationship.new(:one, :two)
|
195
|
-
two = Puppet::Relationship.new(:two, :three)
|
196
|
-
@graph.add_edge(one)
|
197
|
-
@graph.add_edge(two)
|
197
|
+
it "should support selecting :in vertices" do
|
198
|
+
@graph.adjacent(:two, :direction => :in).should == [:one]
|
199
|
+
end
|
198
200
|
|
199
|
-
|
200
|
-
|
201
|
+
it "should default to returning the matching vertices as an array of vertices" do
|
202
|
+
@graph.adjacent(:two).should == [:three]
|
203
|
+
end
|
201
204
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
+
it "should support returning an array of matching edges" do
|
206
|
+
@graph.adjacent(:two, :type => :edges).should == [@two_three]
|
207
|
+
end
|
205
208
|
|
206
|
-
|
207
|
-
|
209
|
+
# Bug #2111
|
210
|
+
it "should not consider a vertex adjacent just because it was asked about previously" do
|
211
|
+
@graph = Puppet::SimpleGraph.new
|
212
|
+
@graph.add_vertex("a")
|
213
|
+
@graph.add_vertex("b")
|
214
|
+
@graph.edge?("a", "b")
|
215
|
+
@graph.adjacent("a").should == []
|
216
|
+
end
|
208
217
|
end
|
209
|
-
end
|
210
218
|
|
211
|
-
describe
|
212
|
-
|
213
|
-
|
214
|
-
|
219
|
+
describe "when clearing" do
|
220
|
+
before do
|
221
|
+
@graph = Puppet::SimpleGraph.new
|
222
|
+
one = Puppet::Relationship.new(:one, :two)
|
223
|
+
two = Puppet::Relationship.new(:two, :three)
|
224
|
+
@graph.add_edge(one)
|
225
|
+
@graph.add_edge(two)
|
215
226
|
|
216
|
-
|
217
|
-
|
218
|
-
@graph.reversal.edge?(:two, :one).should be_true
|
219
|
-
end
|
227
|
+
@graph.clear
|
228
|
+
end
|
220
229
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
@graph.add_edge(:one, :two, :stuff => :awesome)
|
229
|
-
edge = @graph.reversal.edge(:two, :one)
|
230
|
-
edge.label.should == {:stuff => :awesome}
|
230
|
+
it "should remove all vertices" do
|
231
|
+
@graph.vertices.should be_empty
|
232
|
+
end
|
233
|
+
|
234
|
+
it "should remove all edges" do
|
235
|
+
@graph.edges.should be_empty
|
236
|
+
end
|
231
237
|
end
|
232
|
-
end
|
233
238
|
|
234
|
-
describe
|
235
|
-
|
236
|
-
|
239
|
+
describe "when reversing graphs" do
|
240
|
+
before do
|
241
|
+
@graph = Puppet::SimpleGraph.new
|
242
|
+
end
|
243
|
+
|
244
|
+
it "should provide a method for reversing the graph" do
|
245
|
+
@graph.add_edge(:one, :two)
|
246
|
+
@graph.reversal.edge?(:two, :one).should be_true
|
247
|
+
end
|
248
|
+
|
249
|
+
it "should add all vertices to the reversed graph" do
|
250
|
+
@graph.add_edge(:one, :two)
|
251
|
+
@graph.vertex?(:one).should be_true
|
252
|
+
@graph.vertex?(:two).should be_true
|
253
|
+
end
|
254
|
+
|
255
|
+
it "should retain labels on edges" do
|
256
|
+
@graph.add_edge(:one, :two, :callback => :awesome)
|
257
|
+
edge = @graph.reversal.edge(:two, :one)
|
258
|
+
edge.label.should == {:callback => :awesome}
|
259
|
+
end
|
237
260
|
end
|
238
261
|
|
239
|
-
|
240
|
-
|
241
|
-
@graph.
|
262
|
+
describe "when sorting the graph" do
|
263
|
+
before do
|
264
|
+
@graph = Puppet::SimpleGraph.new
|
265
|
+
end
|
266
|
+
|
267
|
+
def add_edges(hash)
|
268
|
+
hash.each do |a,b|
|
269
|
+
@graph.add_edge(a, b)
|
270
|
+
end
|
271
|
+
end
|
272
|
+
|
273
|
+
it "should sort the graph topologically" do
|
274
|
+
add_edges :a => :b, :b => :c
|
275
|
+
@graph.topsort.should == [:a, :b, :c]
|
276
|
+
end
|
277
|
+
|
278
|
+
it "should fail on two-vertex loops" do
|
279
|
+
add_edges :a => :b, :b => :a
|
280
|
+
proc { @graph.topsort }.should raise_error(Puppet::Error)
|
281
|
+
end
|
282
|
+
|
283
|
+
it "should fail on multi-vertex loops" do
|
284
|
+
add_edges :a => :b, :b => :c, :c => :a
|
285
|
+
proc { @graph.topsort }.should raise_error(Puppet::Error)
|
286
|
+
end
|
287
|
+
|
288
|
+
it "should fail when a larger tree contains a small cycle" do
|
289
|
+
add_edges :a => :b, :b => :a, :c => :a, :d => :c
|
290
|
+
proc { @graph.topsort }.should raise_error(Puppet::Error)
|
291
|
+
end
|
292
|
+
|
293
|
+
it "should succeed on trees with no cycles" do
|
294
|
+
add_edges :a => :b, :b => :e, :c => :a, :d => :c
|
295
|
+
proc { @graph.topsort }.should_not raise_error
|
296
|
+
end
|
297
|
+
|
298
|
+
# Our graph's add_edge method is smart enough not to add
|
299
|
+
# duplicate edges, so we use the objects, which it doesn't
|
300
|
+
# check.
|
301
|
+
it "should be able to sort graphs with duplicate edges" do
|
302
|
+
one = Puppet::Relationship.new(:a, :b)
|
303
|
+
@graph.add_edge(one)
|
304
|
+
two = Puppet::Relationship.new(:a, :b)
|
305
|
+
@graph.add_edge(two)
|
306
|
+
proc { @graph.topsort }.should_not raise_error
|
242
307
|
end
|
243
308
|
end
|
244
309
|
|
245
|
-
|
246
|
-
|
247
|
-
|
310
|
+
describe "when writing dot files" do
|
311
|
+
before do
|
312
|
+
@graph = Puppet::SimpleGraph.new
|
313
|
+
@name = :test
|
314
|
+
@file = File.join(Puppet[:graphdir], @name.to_s + ".dot")
|
315
|
+
end
|
316
|
+
|
317
|
+
it "should only write when graphing is enabled" do
|
318
|
+
File.expects(:open).with(@file).never
|
319
|
+
Puppet[:graph] = false
|
320
|
+
@graph.write_graph(@name)
|
321
|
+
end
|
322
|
+
|
323
|
+
it "should write a dot file based on the passed name" do
|
324
|
+
File.expects(:open).with(@file, "w").yields(stub("file", :puts => nil))
|
325
|
+
@graph.expects(:to_dot).with("name" => @name.to_s.capitalize)
|
326
|
+
Puppet[:graph] = true
|
327
|
+
@graph.write_graph(@name)
|
328
|
+
end
|
329
|
+
|
330
|
+
after do
|
331
|
+
Puppet.settings.clear
|
332
|
+
end
|
248
333
|
end
|
249
334
|
|
250
|
-
|
251
|
-
|
252
|
-
|
335
|
+
describe Puppet::SimpleGraph do
|
336
|
+
before do
|
337
|
+
@graph = Puppet::SimpleGraph.new
|
338
|
+
end
|
339
|
+
|
340
|
+
it "should correctly clear vertices and edges when asked" do
|
341
|
+
@graph.add_edge("a", "b")
|
342
|
+
@graph.add_vertex "c"
|
343
|
+
@graph.clear
|
344
|
+
@graph.vertices.should be_empty
|
345
|
+
@graph.edges.should be_empty
|
346
|
+
end
|
253
347
|
end
|
254
348
|
|
255
|
-
|
256
|
-
|
257
|
-
|
349
|
+
describe "when matching edges" do
|
350
|
+
before do
|
351
|
+
@graph = Puppet::SimpleGraph.new
|
352
|
+
@event = Puppet::Transaction::Event.new(:yay, "a")
|
353
|
+
@none = Puppet::Transaction::Event.new(:NONE, "a")
|
354
|
+
|
355
|
+
@edges = {}
|
356
|
+
@edges["a/b"] = Puppet::Relationship.new("a", "b", {:event => :yay, :callback => :refresh})
|
357
|
+
@edges["a/c"] = Puppet::Relationship.new("a", "c", {:event => :yay, :callback => :refresh})
|
358
|
+
@graph.add_edge(@edges["a/b"])
|
359
|
+
end
|
360
|
+
|
361
|
+
it "should match edges whose source matches the source of the event" do
|
362
|
+
@graph.matching_edges([@event]).should == [@edges["a/b"]]
|
363
|
+
end
|
364
|
+
|
365
|
+
it "should match always match nothing when the event is :NONE" do
|
366
|
+
@graph.matching_edges([@none]).should be_empty
|
367
|
+
end
|
368
|
+
|
369
|
+
it "should match multiple edges" do
|
370
|
+
@graph.add_edge(@edges["a/c"])
|
371
|
+
edges = @graph.matching_edges([@event])
|
372
|
+
edges.should be_include(@edges["a/b"])
|
373
|
+
edges.should be_include(@edges["a/c"])
|
374
|
+
end
|
258
375
|
end
|
259
376
|
|
260
|
-
|
261
|
-
|
262
|
-
|
377
|
+
describe "when determining dependencies" do
|
378
|
+
before do
|
379
|
+
@graph = Puppet::SimpleGraph.new
|
380
|
+
|
381
|
+
@graph.add_edge("a", "b")
|
382
|
+
@graph.add_edge("a", "c")
|
383
|
+
@graph.add_edge("b", "d")
|
384
|
+
end
|
385
|
+
|
386
|
+
it "should find all dependents when they are on multiple levels" do
|
387
|
+
@graph.dependents("a").sort.should == %w{b c d}.sort
|
388
|
+
end
|
389
|
+
|
390
|
+
it "should find single dependents" do
|
391
|
+
@graph.dependents("b").sort.should == %w{d}.sort
|
392
|
+
end
|
393
|
+
|
394
|
+
it "should return an empty array when there are no dependents" do
|
395
|
+
@graph.dependents("c").sort.should == [].sort
|
396
|
+
end
|
397
|
+
|
398
|
+
it "should find all dependencies when they are on multiple levels" do
|
399
|
+
@graph.dependencies("d").sort.should == %w{a b}
|
400
|
+
end
|
401
|
+
|
402
|
+
it "should find single dependencies" do
|
403
|
+
@graph.dependencies("c").sort.should == %w{a}
|
404
|
+
end
|
405
|
+
|
406
|
+
it "should return an empty array when there are no dependencies" do
|
407
|
+
@graph.dependencies("a").sort.should == []
|
408
|
+
end
|
263
409
|
end
|
264
410
|
|
265
|
-
|
266
|
-
|
267
|
-
|
411
|
+
require 'puppet/util/graph'
|
412
|
+
|
413
|
+
class Container
|
414
|
+
include Puppet::Util::Graph
|
415
|
+
include Enumerable
|
416
|
+
attr_accessor :name
|
417
|
+
def each
|
418
|
+
@children.each do |c| yield c end
|
419
|
+
end
|
420
|
+
|
421
|
+
def initialize(name, ary)
|
422
|
+
@name = name
|
423
|
+
@children = ary
|
424
|
+
end
|
425
|
+
|
426
|
+
def push(*ary)
|
427
|
+
ary.each { |c| @children.push(c)}
|
428
|
+
end
|
429
|
+
|
430
|
+
def to_s
|
431
|
+
@name
|
432
|
+
end
|
268
433
|
end
|
269
434
|
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
435
|
+
describe "when splicing the graph" do
|
436
|
+
def container_graph
|
437
|
+
@one = Container.new("one", %w{a b})
|
438
|
+
@two = Container.new("two", ["c", "d"])
|
439
|
+
@three = Container.new("three", ["i", "j"])
|
440
|
+
@middle = Container.new("middle", ["e", "f", @two])
|
441
|
+
@top = Container.new("top", ["g", "h", @middle, @one, @three])
|
442
|
+
@empty = Container.new("empty", [])
|
443
|
+
|
444
|
+
@contgraph = @top.to_graph
|
445
|
+
|
446
|
+
# We have to add the container to the main graph, else it won't
|
447
|
+
# be spliced in the dependency graph.
|
448
|
+
@contgraph.add_vertex(@empty)
|
449
|
+
end
|
450
|
+
|
451
|
+
def dependency_graph
|
452
|
+
@depgraph = Puppet::SimpleGraph.new
|
453
|
+
@contgraph.vertices.each do |v|
|
454
|
+
@depgraph.add_vertex(v)
|
455
|
+
end
|
456
|
+
|
457
|
+
# We have to specify a relationship to our empty container, else it
|
458
|
+
# never makes it into the dep graph in the first place.
|
459
|
+
{@one => @two, "f" => "c", "h" => @middle, "c" => @empty}.each do |source, target|
|
460
|
+
@depgraph.add_edge(source, target, :callback => :refresh)
|
461
|
+
end
|
462
|
+
end
|
463
|
+
|
464
|
+
def splice
|
465
|
+
@depgraph.splice!(@contgraph, Container)
|
466
|
+
end
|
467
|
+
|
468
|
+
before do
|
469
|
+
container_graph
|
470
|
+
dependency_graph
|
471
|
+
splice
|
472
|
+
end
|
473
|
+
|
474
|
+
# This is the real heart of splicing -- replacing all containers in
|
475
|
+
# our relationship and exploding their relationships so that each
|
476
|
+
# relationship to a container gets copied to all of its children.
|
477
|
+
it "should remove all Container objects from the dependency graph" do
|
478
|
+
@depgraph.vertices.find_all { |v| v.is_a?(Container) }.should be_empty
|
479
|
+
end
|
480
|
+
|
481
|
+
it "should add container relationships to contained objects" do
|
482
|
+
@contgraph.leaves(@middle).each do |leaf|
|
483
|
+
@depgraph.should be_edge("h", leaf)
|
484
|
+
end
|
485
|
+
end
|
486
|
+
|
487
|
+
it "should explode container-to-container relationships, making edges between all respective contained objects" do
|
488
|
+
@one.each do |oobj|
|
489
|
+
@two.each do |tobj|
|
490
|
+
@depgraph.should be_edge(oobj, tobj)
|
491
|
+
end
|
492
|
+
end
|
493
|
+
end
|
494
|
+
|
495
|
+
it "should no longer contain anything but the non-container objects" do
|
496
|
+
@depgraph.vertices.find_all { |v| ! v.is_a?(String) }.should be_empty
|
497
|
+
end
|
498
|
+
|
499
|
+
it "should copy labels" do
|
500
|
+
@depgraph.edges.each do |edge|
|
501
|
+
edge.label.should == {:callback => :refresh}
|
502
|
+
end
|
503
|
+
end
|
504
|
+
|
505
|
+
it "should not add labels to edges that have none" do
|
506
|
+
@depgraph.add_edge(@two, @three)
|
507
|
+
splice
|
508
|
+
@depgraph.edge_label("c", "i").should == {}
|
509
|
+
end
|
510
|
+
|
511
|
+
it "should copy labels over edges that have none" do
|
512
|
+
@depgraph.add_edge("c", @three, {:callback => :refresh})
|
513
|
+
splice
|
514
|
+
# And make sure the label got copied.
|
515
|
+
@depgraph.edge_label("c", "i").should == {:callback => :refresh}
|
516
|
+
end
|
517
|
+
|
518
|
+
it "should not replace a label with a nil label" do
|
519
|
+
# Lastly, add some new label-less edges and make sure the label stays.
|
520
|
+
@depgraph.add_edge(@middle, @three)
|
521
|
+
@depgraph.add_edge("c", @three, {:callback => :refresh})
|
522
|
+
splice
|
523
|
+
@depgraph.edge_label("c", "i").should == {:callback => :refresh}
|
524
|
+
end
|
525
|
+
|
526
|
+
it "should copy labels to all created edges" do
|
527
|
+
@depgraph.add_edge(@middle, @three)
|
528
|
+
@depgraph.add_edge("c", @three, {:callback => :refresh})
|
529
|
+
splice
|
530
|
+
@three.each do |child|
|
531
|
+
edge = Puppet::Relationship.new("c", child)
|
532
|
+
@depgraph.should be_edge(edge.source, edge.target)
|
533
|
+
@depgraph.edge_label(edge.source, edge.target).should == {:callback => :refresh}
|
534
|
+
end
|
535
|
+
end
|
279
536
|
end
|
280
537
|
end
|