puppet 3.3.2 → 3.4.0.rc1
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/CONTRIBUTING.md +22 -0
- data/Gemfile +11 -2
- data/README.md +13 -17
- data/README_DEVELOPER.md +1 -1
- data/Rakefile +1 -1
- data/examples/hiera/README.md +4 -4
- data/ext/debian/puppetmaster.init +1 -0
- data/ext/debian/rules +2 -5
- data/ext/nagios/check_puppet.rb +7 -7
- data/ext/osx/file_mapping.yaml +1 -1
- data/ext/osx/preflight.erb +34 -19
- data/ext/rack/{files/config.ru → config.ru} +0 -0
- data/ext/rack/{files/apache2.conf → example-passenger-vhost.conf} +6 -0
- data/ext/redhat/puppet.spec.erb +20 -2
- data/ext/systemd/{puppetagent.service → puppet.service} +0 -0
- data/lib/hiera_puppet.rb +2 -2
- data/lib/puppet/agent.rb +1 -6
- data/lib/puppet/application.rb +15 -2
- data/lib/puppet/application/agent.rb +2 -7
- data/lib/puppet/application/apply.rb +8 -13
- data/lib/puppet/application/cert.rb +47 -7
- data/lib/puppet/application/device.rb +1 -6
- data/lib/puppet/application/face_base.rb +1 -1
- data/lib/puppet/application/filebucket.rb +1 -1
- data/lib/puppet/application/inspect.rb +3 -12
- data/lib/puppet/application/master.rb +1 -6
- data/lib/puppet/application/queue.rb +1 -6
- data/lib/puppet/application/resource.rb +2 -6
- data/lib/puppet/coercion.rb +11 -0
- data/lib/puppet/configurer.rb +5 -3
- data/lib/puppet/configurer/downloader.rb +3 -1
- data/lib/puppet/configurer/plugin_handler.rb +10 -0
- data/lib/puppet/confine.rb +80 -0
- data/lib/puppet/{provider/confine → confine}/exists.rb +3 -3
- data/lib/puppet/{provider/confine → confine}/false.rb +2 -2
- data/lib/puppet/{provider/confine → confine}/feature.rb +2 -2
- data/lib/puppet/{provider/confine → confine}/true.rb +2 -2
- data/lib/puppet/{provider/confine → confine}/variable.rb +2 -2
- data/lib/puppet/{provider/confine_collection.rb → confine_collection.rb} +4 -4
- data/lib/puppet/{provider/confiner.rb → confiner.rb} +4 -4
- data/lib/puppet/daemon.rb +2 -6
- data/lib/puppet/data_binding.rb +2 -30
- data/lib/puppet/defaults.rb +283 -174
- data/lib/puppet/error.rb +1 -0
- data/lib/puppet/external/nagios.rb +0 -2
- data/lib/puppet/external/nagios/base.rb +4 -3
- data/lib/puppet/external/nagios/grammar.ry +173 -112
- data/lib/puppet/external/nagios/parser.rb +233 -184
- data/lib/puppet/face/file/store.rb +1 -1
- data/lib/puppet/face/module/generate.rb +5 -7
- data/lib/puppet/face/parser.rb +12 -2
- data/lib/puppet/face/plugin.rb +6 -0
- data/lib/puppet/feature/base.rb +16 -0
- data/lib/puppet/feature/external_facts.rb +5 -0
- data/lib/puppet/feature/libuser.rb +1 -1
- data/lib/puppet/feature/msgpack.rb +1 -0
- data/lib/puppet/feature/rails.rb +2 -2
- data/lib/puppet/file_bucket/dipper.rb +8 -6
- data/lib/puppet/file_bucket/file.rb +17 -1
- data/lib/puppet/file_serving/base.rb +21 -10
- data/lib/puppet/file_serving/configuration.rb +5 -7
- data/lib/puppet/file_serving/configuration/parser.rb +1 -1
- data/lib/puppet/file_serving/content.rb +1 -1
- data/lib/puppet/file_serving/fileset.rb +3 -3
- data/lib/puppet/file_serving/metadata.rb +22 -18
- data/lib/puppet/file_serving/mount/file.rb +1 -1
- data/lib/puppet/file_serving/mount/pluginfacts.rb +35 -0
- data/lib/puppet/file_system.rb +3 -0
- data/lib/puppet/file_system/file.rb +261 -0
- data/lib/puppet/file_system/file18.rb +5 -0
- data/lib/puppet/file_system/file19.rb +5 -0
- data/lib/puppet/file_system/file19windows.rb +113 -0
- data/lib/puppet/file_system/memory_file.rb +31 -0
- data/lib/puppet/file_system/tempfile.rb +20 -0
- data/lib/puppet/indirector/active_record.rb +1 -0
- data/lib/puppet/indirector/catalog/compiler.rb +28 -0
- data/lib/puppet/indirector/certificate_request/memory.rb +6 -0
- data/lib/puppet/indirector/data_binding/hiera.rb +46 -2
- data/lib/puppet/indirector/direct_file_server.rb +2 -2
- data/lib/puppet/indirector/facts/facter.rb +25 -0
- data/lib/puppet/indirector/file_bucket_file/file.rb +60 -74
- data/lib/puppet/indirector/indirection.rb +5 -1
- data/lib/puppet/indirector/json.rb +1 -1
- data/lib/puppet/indirector/key/ca.rb +4 -0
- data/lib/puppet/indirector/key/file.rb +7 -3
- data/lib/puppet/indirector/key/memory.rb +6 -0
- data/lib/puppet/indirector/node/write_only_yaml.rb +2 -2
- data/lib/puppet/indirector/request.rb +17 -11
- data/lib/puppet/indirector/resource/ral.rb +5 -0
- data/lib/puppet/indirector/resource/rest.rb +1 -0
- data/lib/puppet/indirector/resource/store_configs.rb +4 -0
- data/lib/puppet/indirector/rest.rb +2 -1
- data/lib/puppet/indirector/ssl_file.rb +7 -7
- data/lib/puppet/indirector/terminus.rb +4 -0
- data/lib/puppet/indirector/yaml.rb +3 -3
- data/lib/puppet/interface/documentation.rb +4 -11
- data/lib/puppet/module.rb +19 -6
- data/lib/puppet/module_tool/applications/builder.rb +1 -1
- data/lib/puppet/module_tool/applications/installer.rb +1 -1
- data/lib/puppet/module_tool/checksums.rb +1 -1
- data/lib/puppet/module_tool/dependency.rb +7 -3
- data/lib/puppet/module_tool/metadata.rb +6 -2
- data/lib/puppet/module_tool/tar.rb +2 -1
- data/lib/puppet/module_tool/tar/gnu.rb +6 -2
- data/lib/puppet/module_tool/tar/mini.rb +2 -0
- data/lib/puppet/module_tool/tar/solaris.rb +2 -5
- data/lib/puppet/network/authconfig.rb +0 -2
- data/lib/puppet/network/authentication.rb +1 -1
- data/lib/puppet/network/authstore.rb +6 -7
- data/lib/puppet/network/format.rb +2 -3
- data/lib/puppet/network/format_handler.rb +16 -11
- data/lib/puppet/network/format_support.rb +14 -0
- data/lib/puppet/network/formats.rb +26 -0
- data/lib/puppet/network/http/connection.rb +8 -41
- data/lib/puppet/network/http/handler.rb +28 -32
- data/lib/puppet/network/http/webrick.rb +15 -22
- data/lib/puppet/network/http_pool.rb +43 -9
- data/lib/puppet/network/rights.rb +0 -0
- data/lib/puppet/node.rb +24 -8
- data/lib/puppet/node/environment.rb +18 -20
- data/lib/puppet/node/facts.rb +23 -6
- data/lib/puppet/parameter.rb +15 -2
- data/lib/puppet/parameter/boolean.rb +5 -0
- data/lib/puppet/parameter/value_collection.rb +6 -4
- data/lib/puppet/parser/ast/resourceparam.rb +2 -1
- data/lib/puppet/parser/compiler.rb +25 -9
- data/lib/puppet/parser/files.rb +1 -1
- data/lib/puppet/parser/functions.rb +12 -21
- data/lib/puppet/parser/functions/collect.rb +6 -35
- data/lib/puppet/parser/functions/contain.rb +26 -0
- data/lib/puppet/parser/functions/create_resources.rb +5 -0
- data/lib/puppet/parser/functions/extlookup.rb +2 -2
- data/lib/puppet/parser/functions/file.rb +1 -1
- data/lib/puppet/parser/functions/{reject.rb → filter.rb} +13 -12
- data/lib/puppet/parser/functions/fqdn_rand.rb +13 -5
- data/lib/puppet/parser/functions/include.rb +18 -1
- data/lib/puppet/parser/functions/map.rb +44 -0
- data/lib/puppet/parser/functions/select.rb +6 -38
- data/lib/puppet/parser/lexer.rb +1 -1
- data/lib/puppet/parser/parser_support.rb +1 -1
- data/lib/puppet/parser/resource.rb +6 -45
- data/lib/puppet/parser/scope.rb +33 -2
- data/lib/puppet/parser/type_loader.rb +4 -60
- data/lib/puppet/pops/binder/bindings_loader.rb +1 -1
- data/lib/puppet/pops/binder/config/binder_config.rb +3 -3
- data/lib/puppet/pops/binder/hiera2/bindings_provider.rb +1 -1
- data/lib/puppet/pops/binder/scheme_handler/confdir_hiera_scheme.rb +1 -1
- data/lib/puppet/pops/binder/scheme_handler/module_hiera_scheme.rb +2 -2
- data/lib/puppet/pops/issues.rb +4 -0
- data/lib/puppet/pops/model/ast_transformer.rb +4 -1
- data/lib/puppet/pops/model/model_label_provider.rb +1 -1
- data/lib/puppet/pops/parser/egrammar.ra +5 -24
- data/lib/puppet/pops/parser/eparser.rb +859 -902
- data/lib/puppet/pops/parser/lexer.rb +48 -30
- data/lib/puppet/pops/parser/parser_support.rb +1 -1
- data/lib/puppet/pops/patterns.rb +4 -4
- data/lib/puppet/pops/utils.rb +1 -1
- data/lib/puppet/pops/validation/checker3_1.rb +25 -20
- data/lib/puppet/provider.rb +23 -6
- data/lib/puppet/provider/aixobject.rb +0 -0
- data/lib/puppet/provider/augeas/augeas.rb +21 -5
- data/lib/puppet/provider/confine.rb +5 -79
- data/lib/puppet/provider/cron/crontab.rb +0 -0
- data/lib/puppet/provider/exec.rb +9 -7
- data/lib/puppet/provider/exec/posix.rb +10 -1
- data/lib/puppet/provider/exec/windows.rb +1 -1
- data/lib/puppet/provider/file/posix.rb +1 -0
- data/lib/puppet/provider/file/windows.rb +16 -5
- data/lib/puppet/provider/group/aix.rb +0 -0
- data/lib/puppet/provider/group/windows_adsi.rb +33 -1
- data/lib/puppet/provider/macauthorization/macauthorization.rb +1 -1
- data/lib/puppet/provider/mailalias/aliases.rb +0 -0
- data/lib/puppet/provider/maillist/mailman.rb +0 -0
- data/lib/puppet/provider/mount/parsed.rb +0 -0
- data/lib/puppet/provider/nameservice/directoryservice.rb +3 -3
- data/lib/puppet/provider/package/appdmg.rb +1 -1
- data/lib/puppet/provider/package/apple.rb +1 -1
- data/lib/puppet/provider/package/apt.rb +1 -1
- data/lib/puppet/provider/package/aptitude.rb +0 -0
- data/lib/puppet/provider/package/blastwave.rb +1 -1
- data/lib/puppet/provider/package/dpkg.rb +1 -1
- data/lib/puppet/provider/package/fink.rb +1 -1
- data/lib/puppet/provider/package/freebsd.rb +0 -0
- data/lib/puppet/provider/package/gem.rb +0 -0
- data/lib/puppet/provider/package/macports.rb +0 -0
- data/lib/puppet/provider/package/msi.rb +4 -10
- data/lib/puppet/provider/package/nim.rb +8 -8
- data/lib/puppet/provider/package/openbsd.rb +1 -1
- data/lib/puppet/provider/package/opkg.rb +0 -0
- data/lib/puppet/provider/package/pacman.rb +2 -2
- data/lib/puppet/provider/package/pkgdmg.rb +1 -1
- data/lib/puppet/provider/package/pkgutil.rb +1 -1
- data/lib/puppet/provider/package/ports.rb +0 -0
- data/lib/puppet/provider/package/rpm.rb +39 -3
- data/lib/puppet/provider/package/sun.rb +3 -3
- data/lib/puppet/provider/package/sunfreeware.rb +0 -0
- data/lib/puppet/provider/package/windows.rb +12 -19
- data/lib/puppet/provider/package/windows/package.rb +1 -1
- data/lib/puppet/provider/package/yum.rb +2 -2
- data/lib/puppet/provider/parsedfile.rb +0 -0
- data/lib/puppet/provider/port/parsed.rb +0 -0
- data/lib/puppet/provider/service/base.rb +0 -0
- data/lib/puppet/provider/service/bsd.rb +3 -3
- data/lib/puppet/provider/service/daemontools.rb +8 -8
- data/lib/puppet/provider/service/debian.rb +0 -0
- data/lib/puppet/provider/service/freebsd.rb +3 -3
- data/lib/puppet/provider/service/init.rb +5 -4
- data/lib/puppet/provider/service/launchd.rb +35 -24
- data/lib/puppet/provider/service/openbsd.rb +23 -0
- data/lib/puppet/provider/service/redhat.rb +0 -0
- data/lib/puppet/provider/service/runit.rb +3 -3
- data/lib/puppet/provider/service/smf.rb +0 -0
- data/lib/puppet/provider/service/src.rb +0 -0
- data/lib/puppet/provider/service/systemd.rb +0 -0
- data/lib/puppet/provider/service/upstart.rb +3 -3
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +2 -2
- data/lib/puppet/provider/sshkey/parsed.rb +0 -0
- data/lib/puppet/provider/user/aix.rb +0 -0
- data/lib/puppet/provider/user/directoryservice.rb +1 -1
- data/lib/puppet/provider/user/useradd.rb +1 -1
- data/lib/puppet/provider/zone/solaris.rb +1 -1
- data/lib/puppet/rails/benchmark.rb +1 -1
- data/lib/puppet/reference/configuration.rb +1 -2
- data/lib/puppet/reference/indirection.rb +12 -14
- data/lib/puppet/relationship.rb +7 -4
- data/lib/puppet/reports.rb +2 -2
- data/lib/puppet/reports/rrdgraph.rb +1 -1
- data/lib/puppet/reports/store.rb +3 -3
- data/lib/puppet/reports/tagmail.rb +2 -2
- data/lib/puppet/resource.rb +66 -8
- data/lib/puppet/resource/catalog.rb +18 -25
- data/lib/puppet/resource/status.rb +10 -4
- data/lib/puppet/run.rb +6 -2
- data/lib/puppet/settings.rb +39 -119
- data/lib/puppet/settings/base_setting.rb +8 -9
- data/lib/puppet/settings/directory_setting.rb +8 -0
- data/lib/puppet/settings/file_setting.rb +35 -1
- data/lib/puppet/settings/priority_setting.rb +42 -0
- data/lib/puppet/ssl.rb +4 -0
- data/lib/puppet/ssl/certificate.rb +18 -0
- data/lib/puppet/ssl/certificate_authority.rb +101 -72
- data/lib/puppet/ssl/certificate_authority/autosign_command.rb +44 -0
- data/lib/puppet/ssl/certificate_authority/interface.rb +21 -17
- data/lib/puppet/ssl/certificate_factory.rb +38 -12
- data/lib/puppet/ssl/certificate_request.rb +201 -47
- data/lib/puppet/ssl/certificate_request_attributes.rb +34 -0
- data/lib/puppet/ssl/certificate_revocation_list.rb +2 -2
- data/lib/puppet/ssl/host.rb +21 -10
- data/lib/puppet/ssl/inventory.rb +6 -10
- data/lib/puppet/ssl/key.rb +1 -1
- data/lib/puppet/ssl/oids.rb +78 -0
- data/lib/puppet/ssl/validator.rb +41 -97
- data/lib/puppet/ssl/validator/default_validator.rb +153 -0
- data/lib/puppet/ssl/validator/no_validator.rb +17 -0
- data/lib/puppet/status.rb +4 -0
- data/lib/puppet/test/test_helper.rb +5 -0
- data/lib/puppet/transaction.rb +13 -0
- data/lib/puppet/transaction/event.rb +8 -3
- data/lib/puppet/transaction/report.rb +6 -2
- data/lib/puppet/transaction/resource_harness.rb +173 -115
- data/lib/puppet/type.rb +30 -13
- data/lib/puppet/type/augeas.rb +12 -46
- data/lib/puppet/type/component.rb +1 -7
- data/lib/puppet/type/cron.rb +0 -0
- data/lib/puppet/type/exec.rb +13 -1
- data/lib/puppet/type/file.rb +19 -10
- data/lib/puppet/type/file/checksum.rb +0 -0
- data/lib/puppet/type/file/content.rb +3 -0
- data/lib/puppet/type/file/ensure.rb +33 -15
- data/lib/puppet/type/file/group.rb +0 -0
- data/lib/puppet/type/file/mode.rb +6 -2
- data/lib/puppet/type/file/owner.rb +0 -0
- data/lib/puppet/type/file/source.rb +65 -14
- data/lib/puppet/type/file/target.rb +6 -6
- data/lib/puppet/type/file/type.rb +0 -0
- data/lib/puppet/type/filebucket.rb +0 -0
- data/lib/puppet/type/group.rb +18 -0
- data/lib/puppet/type/host.rb +0 -0
- data/lib/puppet/type/k5login.rb +4 -4
- data/lib/puppet/type/mailalias.rb +0 -0
- data/lib/puppet/type/maillist.rb +0 -0
- data/lib/puppet/type/mount.rb +15 -1
- data/lib/puppet/type/package.rb +7 -1
- data/lib/puppet/type/port.rb +0 -0
- data/lib/puppet/type/schedule.rb +9 -4
- data/lib/puppet/type/service.rb +1 -1
- data/lib/puppet/type/sshkey.rb +0 -0
- data/lib/puppet/type/tidy.rb +1 -1
- data/lib/puppet/type/user.rb +3 -0
- data/lib/puppet/type/yumrepo.rb +8 -6
- data/lib/puppet/type/zpool.rb +0 -0
- data/lib/puppet/util.rb +4 -31
- data/lib/puppet/util/adsi.rb +73 -17
- data/lib/puppet/util/autoload.rb +3 -3
- data/lib/puppet/util/backups.rb +4 -4
- data/lib/puppet/util/cacher.rb +7 -13
- data/lib/puppet/util/checksums.rb +2 -2
- data/lib/puppet/util/classgen.rb +3 -1
- data/lib/puppet/util/colors.rb +1 -0
- data/lib/puppet/util/command_line.rb +5 -0
- data/lib/puppet/util/docs.rb +33 -27
- data/lib/puppet/util/execution.rb +42 -18
- data/lib/puppet/util/filetype.rb +3 -3
- data/lib/puppet/util/instance_loader.rb +2 -2
- data/lib/puppet/util/instrumentation.rb +23 -42
- data/lib/puppet/util/instrumentation/data.rb +11 -4
- data/lib/puppet/util/instrumentation/indirection_probe.rb +11 -4
- data/lib/puppet/util/instrumentation/instrumentable.rb +7 -14
- data/lib/puppet/util/instrumentation/listener.rb +15 -8
- data/lib/puppet/util/instrumentation/listeners/log.rb +4 -10
- data/lib/puppet/util/instrumentation/listeners/performance.rb +8 -14
- data/lib/puppet/util/limits.rb +12 -0
- data/lib/puppet/util/lockfile.rb +2 -2
- data/lib/puppet/util/log.rb +14 -6
- data/lib/puppet/util/log/destinations.rb +23 -1
- data/lib/puppet/util/metric.rb +9 -3
- data/lib/puppet/util/monkey_patches.rb +7 -2
- data/lib/puppet/util/network_device/config.rb +1 -1
- data/lib/puppet/util/plugins.rb +1 -1
- data/lib/puppet/util/posix.rb +0 -0
- data/lib/puppet/util/profiler.rb +7 -2
- data/lib/puppet/util/provider_features.rb +2 -2
- data/lib/puppet/util/rdoc.rb +28 -30
- data/lib/puppet/util/rdoc/code_objects.rb +75 -25
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +1 -1
- data/lib/puppet/util/rdoc/parser.rb +12 -487
- data/lib/puppet/util/rdoc/parser/puppet_parser_core.rb +477 -0
- data/lib/puppet/util/rdoc/parser/puppet_parser_rdoc1.rb +19 -0
- data/lib/puppet/util/rdoc/parser/puppet_parser_rdoc2.rb +14 -0
- data/lib/puppet/util/reference.rb +1 -1
- data/lib/puppet/util/resource_template.rb +1 -1
- data/lib/puppet/util/selinux.rb +1 -1
- data/lib/puppet/util/storage.rb +2 -2
- data/lib/puppet/util/suidmanager.rb +1 -1
- data/lib/puppet/util/tag_set.rb +29 -0
- data/lib/puppet/util/tagging.rb +8 -24
- data/lib/puppet/util/watched_file.rb +1 -1
- data/lib/puppet/util/watcher.rb +1 -1
- data/lib/puppet/util/windows.rb +3 -0
- data/lib/puppet/util/windows/access_control_entry.rb +84 -0
- data/lib/puppet/util/windows/access_control_list.rb +106 -0
- data/lib/puppet/util/windows/file.rb +213 -0
- data/lib/puppet/util/windows/process.rb +199 -0
- data/lib/puppet/util/windows/root_certs.rb +52 -37
- data/lib/puppet/util/windows/security.rb +270 -245
- data/lib/puppet/util/windows/security_descriptor.rb +62 -0
- data/lib/puppet/util/windows/sid.rb +26 -4
- data/lib/puppet/version.rb +2 -2
- data/spec/fixtures/releases/jamtur01-apache/lib/puppet/provider/a2mod/debian.rb +1 -1
- data/spec/fixtures/unit/indirector/{hiera → data_binding/hiera}/global.yaml +0 -0
- data/spec/fixtures/unit/indirector/data_binding/hiera/invalid.yaml +1 -0
- data/spec/fixtures/unit/module/trailing-comma.json +24 -0
- data/spec/fixtures/unit/util/monkey_patches/x509.pem +32 -0
- data/spec/integration/application/apply_spec.rb +1 -1
- data/spec/integration/application/doc_spec.rb +1 -1
- data/spec/integration/configurer_spec.rb +4 -2
- data/spec/integration/data_binding.rb +100 -0
- data/spec/integration/indirector/catalog/compiler_spec.rb +16 -13
- data/spec/integration/indirector/direct_file_server_spec.rb +3 -5
- data/spec/integration/indirector/file_content/file_server_spec.rb +2 -2
- data/spec/integration/node/facts_spec.rb +1 -1
- data/spec/integration/node_spec.rb +1 -1
- data/spec/integration/parser/compiler_spec.rb +90 -0
- data/spec/integration/parser/parser_spec.rb +2 -2
- data/spec/integration/provider/cron/crontab_spec.rb +3 -5
- data/spec/integration/resource/catalog_spec.rb +1 -1
- data/spec/integration/ssl/autosign_spec.rb +90 -0
- data/spec/integration/ssl/certificate_authority_spec.rb +62 -69
- data/spec/integration/ssl/certificate_revocation_list_spec.rb +1 -1
- data/spec/integration/ssl/host_spec.rb +1 -1
- data/spec/integration/transaction_spec.rb +13 -13
- data/spec/integration/type/exec_spec.rb +2 -2
- data/spec/integration/type/file_spec.rb +287 -45
- data/spec/integration/type/tidy_spec.rb +3 -3
- data/spec/integration/util/rdoc/parser_spec.rb +236 -35
- data/spec/integration/util/settings_spec.rb +1 -1
- data/spec/integration/util/windows/process_spec.rb +22 -0
- data/spec/integration/util/windows/security_spec.rb +316 -106
- data/spec/lib/matchers/containment_matchers.rb +52 -0
- data/spec/lib/puppet_spec/compiler.rb +6 -0
- data/spec/lib/puppet_spec/files.rb +20 -21
- data/spec/shared_behaviours/documentation_on_faces.rb +3 -3
- data/spec/shared_behaviours/file_server_terminus.rb +2 -2
- data/spec/shared_contexts/platform.rb +1 -0
- data/spec/spec_helper.rb +13 -1
- data/spec/unit/agent_spec.rb +0 -12
- data/spec/unit/application/agent_spec.rb +4 -4
- data/spec/unit/application/apply_spec.rb +18 -2
- data/spec/unit/application/cert_spec.rb +8 -6
- data/spec/unit/application/device_spec.rb +1 -1
- data/spec/unit/application/filebucket_spec.rb +1 -1
- data/spec/unit/application/inspect_spec.rb +1 -1
- data/spec/unit/application_spec.rb +24 -0
- data/spec/unit/configurer/downloader_spec.rb +8 -7
- data/spec/unit/configurer/fact_handler_spec.rb +23 -0
- data/spec/unit/configurer/plugin_handler_spec.rb +7 -2
- data/spec/unit/configurer_spec.rb +15 -5
- data/spec/unit/{provider/confine → confine}/exists_spec.rb +12 -12
- data/spec/unit/{provider/confine → confine}/false_spec.rb +9 -9
- data/spec/unit/{provider/confine → confine}/feature_spec.rb +10 -10
- data/spec/unit/{provider/confine → confine}/true_spec.rb +7 -7
- data/spec/unit/{provider/confine → confine}/variable_spec.rb +16 -16
- data/spec/unit/{provider/confine_collection_spec.rb → confine_collection_spec.rb} +30 -30
- data/spec/unit/{provider/confine_spec.rb → confine_spec.rb} +11 -11
- data/spec/unit/{provider/confiner_spec.rb → confiner_spec.rb} +4 -4
- data/spec/unit/face/parser_spec.rb +54 -0
- data/spec/unit/file_bucket/dipper_spec.rb +2 -2
- data/spec/unit/file_serving/base_spec.rb +32 -9
- data/spec/unit/file_serving/configuration_spec.rb +7 -7
- data/spec/unit/file_serving/content_spec.rb +12 -7
- data/spec/unit/file_serving/fileset_spec.rb +57 -27
- data/spec/unit/file_serving/metadata_spec.rb +74 -12
- data/spec/unit/file_serving/mount/file_spec.rb +10 -10
- data/spec/unit/file_serving/mount/pluginfacts_spec.rb +73 -0
- data/spec/unit/file_system/file_spec.rb +486 -0
- data/spec/unit/file_system/tempfile_spec.rb +48 -0
- data/spec/unit/graph/relationship_graph_spec.rb +0 -6
- data/spec/unit/hiera_puppet_spec.rb +2 -2
- data/spec/unit/indirector/catalog/compiler_spec.rb +15 -19
- data/spec/unit/indirector/certificate_status/file_spec.rb +30 -40
- data/spec/unit/indirector/data_binding/hiera_spec.rb +95 -2
- data/spec/unit/indirector/direct_file_server_spec.rb +6 -6
- data/spec/unit/indirector/facts/facter_spec.rb +33 -0
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +61 -52
- data/spec/unit/indirector/file_metadata/file_spec.rb +2 -2
- data/spec/unit/indirector/file_server_spec.rb +4 -4
- data/spec/unit/indirector/json_spec.rb +4 -4
- data/spec/unit/indirector/key/file_spec.rb +13 -14
- data/spec/unit/indirector/resource/ral_spec.rb +7 -0
- data/spec/unit/indirector/resource/store_configs_spec.rb +11 -0
- data/spec/unit/indirector/rest_spec.rb +7 -3
- data/spec/unit/indirector/ssl_file_spec.rb +14 -17
- data/spec/unit/indirector/yaml_spec.rb +4 -4
- data/spec/unit/module_spec.rb +43 -15
- data/spec/unit/module_tool/tar/gnu_spec.rb +2 -2
- data/spec/unit/module_tool/tar/solaris_spec.rb +2 -2
- data/spec/unit/module_tool/tar_spec.rb +45 -0
- data/spec/unit/network/authconfig_spec.rb +2 -1
- data/spec/unit/network/authentication_spec.rb +2 -2
- data/spec/unit/network/format_handler_spec.rb +2 -2
- data/spec/unit/network/formats_spec.rb +24 -0
- data/spec/unit/network/http/connection_spec.rb +76 -199
- data/spec/unit/network/http/handler_spec.rb +33 -34
- data/spec/unit/network/http_pool_spec.rb +8 -5
- data/spec/unit/node/environment_spec.rb +76 -90
- data/spec/unit/node/facts_spec.rb +20 -3
- data/spec/unit/node_spec.rb +43 -0
- data/spec/unit/parameter/boolean_spec.rb +22 -12
- data/spec/unit/parser/ast/resourceparam_spec.rb +51 -0
- data/spec/unit/parser/compiler_spec.rb +103 -35
- data/spec/unit/parser/eparser_adapter_spec.rb +12 -12
- data/spec/unit/parser/files_spec.rb +11 -11
- data/spec/unit/parser/functions/contain_spec.rb +185 -0
- data/spec/unit/parser/functions/create_resources_spec.rb +13 -5
- data/spec/unit/parser/functions/generate_spec.rb +1 -1
- data/spec/unit/parser/functions_spec.rb +2 -2
- data/spec/unit/parser/lexer_spec.rb +1 -1
- data/spec/unit/parser/methods/each_spec.rb +1 -1
- data/spec/unit/parser/methods/{select_spec.rb → filter_spec.rb} +11 -11
- data/spec/unit/parser/methods/map_spec.rb +95 -0
- data/spec/unit/parser/methods/reduce_spec.rb +12 -11
- data/spec/unit/parser/methods/shared.rb +5 -5
- data/spec/unit/parser/methods/slice_spec.rb +13 -13
- data/spec/unit/parser/parser_spec.rb +1 -1
- data/spec/unit/parser/resource/param_spec.rb +44 -0
- data/spec/unit/parser/resource_spec.rb +16 -15
- data/spec/unit/pops/model/ast_transformer_spec.rb +18 -4
- data/spec/unit/pops/parser/lexer_spec.rb +22 -5
- data/spec/unit/pops/parser/parse_calls_spec.rb +5 -5
- data/spec/unit/pops/transformer/transform_calls_spec.rb +6 -6
- data/spec/unit/pops/transformer/transform_containers_spec.rb +2 -2
- data/spec/unit/pops/validator/validator_spec.rb +31 -0
- data/spec/unit/provider/augeas/augeas_spec.rb +57 -2
- data/spec/unit/provider/exec/posix_spec.rb +8 -3
- data/spec/unit/provider/file/posix_spec.rb +2 -2
- data/spec/unit/provider/group/windows_adsi_spec.rb +70 -3
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +3 -3
- data/spec/unit/provider/package/apt_spec.rb +1 -1
- data/spec/unit/provider/package/msi_spec.rb +15 -42
- data/spec/unit/provider/package/openbsd_spec.rb +3 -3
- data/spec/unit/provider/package/rpm_spec.rb +56 -13
- data/spec/unit/provider/package/windows_spec.rb +15 -19
- data/spec/unit/provider/service/base_spec.rb +1 -1
- data/spec/unit/provider/service/daemontools_spec.rb +18 -8
- data/spec/unit/provider/service/freebsd_spec.rb +3 -3
- data/spec/unit/provider/service/gentoo_spec.rb +5 -2
- data/spec/unit/provider/service/init_spec.rb +17 -17
- data/spec/unit/provider/service/launchd_spec.rb +76 -23
- data/spec/unit/provider/service/openbsd_spec.rb +125 -0
- data/spec/unit/provider/service/openwrt_spec.rb +1 -1
- data/spec/unit/provider/service/runit_spec.rb +12 -5
- data/spec/unit/provider/service/upstart_spec.rb +4 -4
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +5 -5
- data/spec/unit/provider/user/directoryservice_spec.rb +4 -4
- data/spec/unit/provider/zone/solaris_spec.rb +1 -1
- data/spec/unit/provider_spec.rb +2 -2
- data/spec/unit/reports/http_spec.rb +19 -34
- data/spec/unit/reports/store_spec.rb +2 -2
- data/spec/unit/resource/catalog_spec.rb +81 -11
- data/spec/unit/resource/status_spec.rb +11 -1
- data/spec/unit/resource/type_spec.rb +30 -1
- data/spec/unit/resource_spec.rb +40 -4
- data/spec/unit/settings/file_setting_spec.rb +2 -2
- data/spec/unit/settings/path_setting_spec.rb +2 -2
- data/spec/unit/settings/priority_setting_spec.rb +66 -0
- data/spec/unit/settings_spec.rb +16 -31
- data/spec/unit/ssl/certificate_authority/autosign_command_spec.rb +30 -0
- data/spec/unit/ssl/certificate_authority_spec.rb +129 -134
- data/spec/unit/ssl/certificate_factory_spec.rb +18 -0
- data/spec/unit/ssl/certificate_request_attributes_spec.rb +61 -0
- data/spec/unit/ssl/certificate_request_spec.rb +103 -0
- data/spec/unit/ssl/certificate_spec.rb +31 -18
- data/spec/unit/ssl/host_spec.rb +34 -8
- data/spec/unit/ssl/inventory_spec.rb +27 -62
- data/spec/unit/ssl/key_spec.rb +4 -4
- data/spec/unit/ssl/oids_spec.rb +48 -0
- data/spec/unit/ssl/validator_spec.rb +49 -6
- data/spec/unit/status_spec.rb +9 -0
- data/spec/unit/transaction/event_spec.rb +1 -9
- data/spec/unit/transaction/report_spec.rb +20 -1
- data/spec/unit/transaction/resource_harness_spec.rb +60 -210
- data/spec/unit/transaction_spec.rb +54 -8
- data/spec/unit/type/component_spec.rb +2 -2
- data/spec/unit/type/exec_spec.rb +14 -7
- data/spec/unit/type/file/content_spec.rb +13 -2
- data/spec/unit/type/file/ctime_spec.rb +1 -1
- data/spec/unit/type/file/mode_spec.rb +48 -2
- data/spec/unit/type/file/mtime_spec.rb +1 -1
- data/spec/unit/type/file/source_spec.rb +177 -7
- data/spec/unit/type/file_spec.rb +63 -71
- data/spec/unit/type/group_spec.rb +20 -0
- data/spec/unit/type/k5login_spec.rb +3 -3
- data/spec/unit/type/mount_spec.rb +53 -0
- data/spec/unit/type/nagios_spec.rb +216 -0
- data/spec/unit/type/package_spec.rb +7 -1
- data/spec/unit/type/schedule_spec.rb +6 -0
- data/spec/unit/type/service_spec.rb +3 -3
- data/spec/unit/type/tidy_spec.rb +14 -14
- data/spec/unit/type/user_spec.rb +9 -0
- data/spec/unit/type_spec.rb +86 -4
- data/spec/unit/util/adsi_spec.rb +120 -12
- data/spec/unit/util/autoload_spec.rb +14 -14
- data/spec/unit/util/backups_spec.rb +29 -21
- data/spec/unit/util/checksums_spec.rb +2 -1
- data/spec/unit/util/command_line_spec.rb +41 -0
- data/spec/unit/util/docs_spec.rb +91 -0
- data/spec/unit/util/execution_spec.rb +26 -2
- data/spec/unit/util/filetype_spec.rb +7 -7
- data/spec/unit/util/lockfile_spec.rb +2 -2
- data/spec/unit/util/log/destinations_spec.rb +32 -0
- data/spec/unit/util/monkey_patches_spec.rb +41 -0
- data/spec/unit/util/pidlock_spec.rb +6 -6
- data/spec/unit/util/rdoc/parser_spec.rb +15 -13
- data/spec/unit/util/rdoc_spec.rb +18 -24
- data/spec/unit/util/resource_template_spec.rb +3 -3
- data/spec/unit/util/selinux_spec.rb +4 -2
- data/spec/unit/util/storage_spec.rb +4 -4
- data/spec/unit/util/suidmanager_spec.rb +7 -0
- data/spec/unit/util/tag_set_spec.rb +46 -0
- data/spec/unit/util/tagging_spec.rb +82 -45
- data/spec/unit/util/watcher_spec.rb +4 -1
- data/spec/unit/util/windows/access_control_entry_spec.rb +67 -0
- data/spec/unit/util/windows/access_control_list_spec.rb +133 -0
- data/spec/unit/util/windows/root_certs_spec.rb +10 -8
- data/spec/unit/util/windows/security_descriptor_spec.rb +117 -0
- data/spec/unit/util/windows/sid_spec.rb +69 -0
- data/spec/unit/util_spec.rb +7 -7
- data/tasks/ci.rake +17 -36
- metadata +2811 -2746
- checksums.yaml +0 -7
- data/examples/mac_automount.pp +0 -16
- data/examples/mcx_dock_absent.pp +0 -4
- data/examples/mcx_dock_default.pp +0 -118
- data/examples/mcx_dock_full.pp +0 -125
- data/examples/mcx_dock_invalid.pp +0 -9
- data/examples/mcx_nogroup.pp +0 -118
- data/examples/mcx_notexists_absent.pp +0 -4
- data/ext/rack/README +0 -58
- data/ext/rack/manifest.pp +0 -59
- data/lib/puppet/external/lock.rb +0 -63
- data/lib/puppet/indirector/hiera.rb +0 -39
- data/lib/puppet/parser/functions/foreach.rb +0 -95
- data/spec/integration/network/server/webrick_spec.rb +0 -76
- data/spec/integration/parser/functions_spec.rb +0 -16
- data/spec/unit/indirector/hiera_spec.rb +0 -154
- data/spec/unit/parser/methods/collect_spec.rb +0 -153
- data/spec/unit/parser/methods/foreach_spec.rb +0 -91
- data/spec/unit/parser/methods/reject_spec.rb +0 -73
- data/spec/unit/resource/resource_type.json +0 -34
data/spec/unit/type/file_spec.rb
CHANGED
@@ -10,7 +10,6 @@ describe Puppet::Type.type(:file) do
|
|
10
10
|
let(:catalog) { Puppet::Resource::Catalog.new }
|
11
11
|
|
12
12
|
before do
|
13
|
-
@real_posix = Puppet.features.posix?
|
14
13
|
Puppet.features.stubs("posix?").returns(true)
|
15
14
|
end
|
16
15
|
|
@@ -78,33 +77,29 @@ describe Puppet::Type.type(:file) do
|
|
78
77
|
end
|
79
78
|
|
80
79
|
describe "when using UNC filenames", :if => Puppet.features.microsoft_windows? do
|
81
|
-
before :each do
|
82
|
-
pending("UNC file paths not yet supported")
|
83
|
-
end
|
84
|
-
|
85
80
|
it "should remove trailing slashes" do
|
86
|
-
file[:path] = "//
|
87
|
-
file[:path].should == "//
|
81
|
+
file[:path] = "//localhost/foo/bar/baz/"
|
82
|
+
file[:path].should == "//localhost/foo/bar/baz"
|
88
83
|
end
|
89
84
|
|
90
85
|
it "should remove double slashes" do
|
91
|
-
file[:path] = "//
|
92
|
-
file[:path].should == "//
|
86
|
+
file[:path] = "//localhost/foo/bar//baz"
|
87
|
+
file[:path].should == "//localhost/foo/bar/baz"
|
93
88
|
end
|
94
89
|
|
95
90
|
it "should remove trailing double slashes" do
|
96
|
-
file[:path] = "//
|
97
|
-
file[:path].should == "//
|
91
|
+
file[:path] = "//localhost/foo/bar/baz//"
|
92
|
+
file[:path].should == "//localhost/foo/bar/baz"
|
98
93
|
end
|
99
94
|
|
100
95
|
it "should remove a trailing slash from a sharename" do
|
101
|
-
file[:path] = "//
|
102
|
-
file[:path].should == "//
|
96
|
+
file[:path] = "//localhost/foo/"
|
97
|
+
file[:path].should == "//localhost/foo"
|
103
98
|
end
|
104
99
|
|
105
100
|
it "should not modify a sharename" do
|
106
|
-
file[:path] = "//
|
107
|
-
file[:path].should == "//
|
101
|
+
file[:path] = "//localhost/foo"
|
102
|
+
file[:path].should == "//localhost/foo"
|
108
103
|
end
|
109
104
|
end
|
110
105
|
end
|
@@ -352,7 +347,7 @@ describe Puppet::Type.type(:file) do
|
|
352
347
|
file[:ensure].should == :file
|
353
348
|
end
|
354
349
|
|
355
|
-
it "should set a desired 'ensure' value if none is set and 'target' is set" do
|
350
|
+
it "should set a desired 'ensure' value if none is set and 'target' is set", :if => described_class.defaultprovider.feature?(:manages_symlinks) do
|
356
351
|
file = described_class.new(:path => path, :target => File.expand_path(__FILE__))
|
357
352
|
file[:ensure].should == :link
|
358
353
|
end
|
@@ -397,7 +392,7 @@ describe Puppet::Type.type(:file) do
|
|
397
392
|
:target => "some_target",
|
398
393
|
:source => File.expand_path("some_source"),
|
399
394
|
}.each do |param, value|
|
400
|
-
it "should omit the #{param} parameter" do
|
395
|
+
it "should omit the #{param} parameter", :if => described_class.defaultprovider.feature?(:manages_symlinks) do
|
401
396
|
# Make a new file, because we have to set the param at initialization
|
402
397
|
# or it wouldn't be copied regardless.
|
403
398
|
file = described_class.new(:path => path, param => value)
|
@@ -603,7 +598,7 @@ describe Puppet::Type.type(:file) do
|
|
603
598
|
file.recurse_link("first" => @resource)
|
604
599
|
end
|
605
600
|
|
606
|
-
it "should set the target to the full path of discovered file and set :ensure to :link if the file is not a directory" do
|
601
|
+
it "should set the target to the full path of discovered file and set :ensure to :link if the file is not a directory", :if => described_class.defaultprovider.feature?(:manages_symlinks) do
|
607
602
|
file.stubs(:perform_recursion).returns [@first, @second]
|
608
603
|
file.recurse_link("first" => @resource, "second" => file)
|
609
604
|
|
@@ -925,20 +920,20 @@ describe Puppet::Type.type(:file) do
|
|
925
920
|
|
926
921
|
file.remove_existing(:directory).should == true
|
927
922
|
|
928
|
-
File.
|
923
|
+
Puppet::FileSystem::File.exist?(file[:path]).should == false
|
929
924
|
end
|
930
925
|
|
931
|
-
it "should remove an existing link", :
|
926
|
+
it "should remove an existing link", :if => described_class.defaultprovider.feature?(:manages_symlinks) do
|
932
927
|
file.stubs(:perform_backup).returns true
|
933
928
|
|
934
929
|
target = tmpfile('link_target')
|
935
930
|
FileUtils.touch(target)
|
936
|
-
|
931
|
+
Puppet::FileSystem::File.new(target).symlink(path)
|
937
932
|
file[:target] = target
|
938
933
|
|
939
934
|
file.remove_existing(:directory).should == true
|
940
935
|
|
941
|
-
File.
|
936
|
+
Puppet::FileSystem::File.exist?(file[:path]).should == false
|
942
937
|
end
|
943
938
|
|
944
939
|
it "should fail if the file is not a file, link, or directory" do
|
@@ -952,7 +947,7 @@ describe Puppet::Type.type(:file) do
|
|
952
947
|
file.stat
|
953
948
|
file.stubs(:stat).returns stub('stat', :ftype => 'file')
|
954
949
|
|
955
|
-
File.stubs(:unlink)
|
950
|
+
Puppet::FileSystem::File.stubs(:unlink)
|
956
951
|
|
957
952
|
file.remove_existing(:directory).should == true
|
958
953
|
file.instance_variable_get(:@stat).should == :needs_stat
|
@@ -1010,11 +1005,11 @@ describe Puppet::Type.type(:file) do
|
|
1010
1005
|
end
|
1011
1006
|
end
|
1012
1007
|
|
1013
|
-
describe "#stat", :
|
1008
|
+
describe "#stat", :if => described_class.defaultprovider.feature?(:manages_symlinks) do
|
1014
1009
|
before do
|
1015
1010
|
target = tmpfile('link_target')
|
1016
1011
|
FileUtils.touch(target)
|
1017
|
-
|
1012
|
+
Puppet::FileSystem::File.new(target).symlink(path)
|
1018
1013
|
|
1019
1014
|
file[:target] = target
|
1020
1015
|
file[:links] = :manage # so we always use :lstat
|
@@ -1033,7 +1028,7 @@ describe Puppet::Type.type(:file) do
|
|
1033
1028
|
end
|
1034
1029
|
|
1035
1030
|
it "should return nil if the file does not exist" do
|
1036
|
-
file[:path] = '/foo/bar/baz/non-existent'
|
1031
|
+
file[:path] = make_absolute('/foo/bar/baz/non-existent')
|
1037
1032
|
|
1038
1033
|
file.stat.should be_nil
|
1039
1034
|
end
|
@@ -1207,7 +1202,7 @@ describe Puppet::Type.type(:file) do
|
|
1207
1202
|
|
1208
1203
|
describe "when autorequiring" do
|
1209
1204
|
describe "target" do
|
1210
|
-
it "should require file resource when specified with the target property" do
|
1205
|
+
it "should require file resource when specified with the target property", :if => described_class.defaultprovider.feature?(:manages_symlinks) do
|
1211
1206
|
file = described_class.new(:path => File.expand_path("/foo"), :ensure => :directory)
|
1212
1207
|
link = described_class.new(:path => File.expand_path("/bar"), :ensure => :link, :target => File.expand_path("/foo"))
|
1213
1208
|
catalog.add_resource file
|
@@ -1229,7 +1224,7 @@ describe Puppet::Type.type(:file) do
|
|
1229
1224
|
reqs[0].target.must == link
|
1230
1225
|
end
|
1231
1226
|
|
1232
|
-
it "should not require target if target is not managed" do
|
1227
|
+
it "should not require target if target is not managed", :if => described_class.defaultprovider.feature?(:manages_symlinks) do
|
1233
1228
|
link = described_class.new(:path => File.expand_path('/foo'), :ensure => :link, :target => '/bar')
|
1234
1229
|
catalog.add_resource link
|
1235
1230
|
link.autorequire.size.should == 0
|
@@ -1272,8 +1267,8 @@ describe Puppet::Type.type(:file) do
|
|
1272
1267
|
describe "on Windows systems", :if => Puppet.features.microsoft_windows? do
|
1273
1268
|
describe "when using UNC filenames" do
|
1274
1269
|
it "should autorequire its parent directory" do
|
1275
|
-
file[:path] = '//
|
1276
|
-
dir = described_class.new(:path => "//
|
1270
|
+
file[:path] = '//localhost/foo/bar/baz'
|
1271
|
+
dir = described_class.new(:path => "//localhost/foo/bar")
|
1277
1272
|
catalog.add_resource file
|
1278
1273
|
catalog.add_resource dir
|
1279
1274
|
reqs = file.autorequire
|
@@ -1282,9 +1277,9 @@ describe Puppet::Type.type(:file) do
|
|
1282
1277
|
end
|
1283
1278
|
|
1284
1279
|
it "should autorequire its nearest ancestor directory" do
|
1285
|
-
file = described_class.new(:path => "//
|
1286
|
-
dir = described_class.new(:path => "//
|
1287
|
-
grandparent = described_class.new(:path => "//
|
1280
|
+
file = described_class.new(:path => "//localhost/foo/bar/baz/qux")
|
1281
|
+
dir = described_class.new(:path => "//localhost/foo/bar/baz")
|
1282
|
+
grandparent = described_class.new(:path => "//localhost/foo/bar")
|
1288
1283
|
catalog.add_resource file
|
1289
1284
|
catalog.add_resource dir
|
1290
1285
|
catalog.add_resource grandparent
|
@@ -1295,13 +1290,13 @@ describe Puppet::Type.type(:file) do
|
|
1295
1290
|
end
|
1296
1291
|
|
1297
1292
|
it "should not autorequire anything when there is no nearest ancestor directory" do
|
1298
|
-
file = described_class.new(:path => "//
|
1293
|
+
file = described_class.new(:path => "//localhost/foo/bar/baz/qux")
|
1299
1294
|
catalog.add_resource file
|
1300
1295
|
file.autorequire.should be_empty
|
1301
1296
|
end
|
1302
1297
|
|
1303
1298
|
it "should not autorequire its parent dir if its parent dir is itself" do
|
1304
|
-
file = described_class.new(:path => "//
|
1299
|
+
file = described_class.new(:path => "//localhost/foo")
|
1305
1300
|
catalog.add_resource file
|
1306
1301
|
puts file.autorequire
|
1307
1302
|
file.autorequire.should be_empty
|
@@ -1311,49 +1306,46 @@ describe Puppet::Type.type(:file) do
|
|
1311
1306
|
end
|
1312
1307
|
end
|
1313
1308
|
|
1314
|
-
describe "when managing links" do
|
1309
|
+
describe "when managing links", :if => Puppet.features.manages_symlinks? do
|
1315
1310
|
require 'tempfile'
|
1316
1311
|
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
|
1326
|
-
|
1327
|
-
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1312
|
+
before :each do
|
1313
|
+
Dir.mkdir(path)
|
1314
|
+
@target = File.join(path, "target")
|
1315
|
+
@link = File.join(path, "link")
|
1316
|
+
|
1317
|
+
target = described_class.new(
|
1318
|
+
:ensure => :file, :path => @target,
|
1319
|
+
:catalog => catalog, :content => 'yayness',
|
1320
|
+
:mode => 0644)
|
1321
|
+
catalog.add_resource target
|
1322
|
+
|
1323
|
+
@link_resource = described_class.new(
|
1324
|
+
:ensure => :link, :path => @link,
|
1325
|
+
:target => @target, :catalog => catalog,
|
1326
|
+
:mode => 0755)
|
1327
|
+
catalog.add_resource @link_resource
|
1332
1328
|
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
(File.stat(@target).mode & 007777).to_s(8).should == '644'
|
1337
|
-
end
|
1329
|
+
# to prevent the catalog from trying to write state.yaml
|
1330
|
+
Puppet::Util::Storage.stubs(:store)
|
1331
|
+
end
|
1338
1332
|
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1333
|
+
it "should preserve the original file mode and ignore the one set by the link" do
|
1334
|
+
@link_resource[:links] = :manage # default
|
1335
|
+
catalog.apply
|
1342
1336
|
|
1343
|
-
|
1344
|
-
|
1345
|
-
end
|
1346
|
-
else # @real_posix
|
1347
|
-
# should recode tests using expectations instead of using the filesystem
|
1337
|
+
# I convert them to strings so they display correctly if there's an error.
|
1338
|
+
(Puppet::FileSystem::File.new(@target).stat.mode & 007777).to_s(8).should == '644'
|
1348
1339
|
end
|
1349
1340
|
|
1350
|
-
|
1351
|
-
|
1352
|
-
Puppet.features.
|
1353
|
-
|
1354
|
-
|
1341
|
+
it "should manage the mode of the followed link" do
|
1342
|
+
pending("Windows cannot presently manage the mode when following symlinks",
|
1343
|
+
:if => Puppet.features.microsoft_windows?) do
|
1344
|
+
@link_resource[:links] = :follow
|
1345
|
+
catalog.apply
|
1355
1346
|
|
1356
|
-
|
1347
|
+
(Puppet::FileSystem::File.new(@target).stat.mode & 007777).to_s(8).should == '755'
|
1348
|
+
end
|
1357
1349
|
end
|
1358
1350
|
end
|
1359
1351
|
|
@@ -1436,7 +1428,7 @@ describe Puppet::Type.type(:file) do
|
|
1436
1428
|
|
1437
1429
|
catalog.apply
|
1438
1430
|
|
1439
|
-
File.
|
1431
|
+
Puppet::FileSystem::File.exist?(path).should be_true
|
1440
1432
|
@logs.should_not be_any {|l| l.level != :notice }
|
1441
1433
|
end
|
1442
1434
|
end
|
@@ -61,4 +61,24 @@ describe Puppet::Type.type(:group) do
|
|
61
61
|
|
62
62
|
type.exists?.should == true
|
63
63
|
end
|
64
|
+
|
65
|
+
describe "should delegate :members implementation to the provider:" do
|
66
|
+
|
67
|
+
let (:provider) { @class.provide(:testing) { has_features :manages_members } }
|
68
|
+
let (:provider_instance) { provider.new }
|
69
|
+
let (:type) { @class.new(:name => "group", :provider => provider_instance, :members => ['user1']) }
|
70
|
+
|
71
|
+
it "insync? calls members_insync?" do
|
72
|
+
provider_instance.expects(:members_insync?).with(['user1'], ['user1']).returns true
|
73
|
+
type.property(:members).insync?(['user1']).should be_true
|
74
|
+
end
|
75
|
+
|
76
|
+
it "is_to_s and should_to_s call members_to_s" do
|
77
|
+
provider_instance.expects(:members_to_s).with(['user2', 'user1']).returns "user2 (), user1 ()"
|
78
|
+
provider_instance.expects(:members_to_s).with(['user1']).returns "user1 ()"
|
79
|
+
|
80
|
+
type.property(:members).is_to_s('user1').should == 'user1 ()'
|
81
|
+
type.property(:members).should_to_s('user2,user1').should == 'user2 (), user1 ()'
|
82
|
+
end
|
83
|
+
end
|
64
84
|
end
|
@@ -46,7 +46,7 @@ describe Puppet::Type.type(:k5login), :unless => Puppet.features.microsoft_windo
|
|
46
46
|
|
47
47
|
it "should create the file when synced" do
|
48
48
|
resource(:ensure => 'present').parameter(:ensure).sync
|
49
|
-
File.should
|
49
|
+
Puppet::FileSystem::File.exist?(path).should be_true
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -83,7 +83,7 @@ describe Puppet::Type.type(:k5login), :unless => Puppet.features.microsoft_windo
|
|
83
83
|
|
84
84
|
it "should remove the file ensure is absent" do
|
85
85
|
resource(:ensure => 'absent').property(:ensure).sync
|
86
|
-
File.
|
86
|
+
Puppet::FileSystem::File.exist?(path).should be_false
|
87
87
|
end
|
88
88
|
|
89
89
|
it "should write one principal to the file" do
|
@@ -106,7 +106,7 @@ describe Puppet::Type.type(:k5login), :unless => Puppet.features.microsoft_windo
|
|
106
106
|
it "should update the mode to #{mode}" do
|
107
107
|
resource(:mode => mode).property(:mode).sync
|
108
108
|
|
109
|
-
(File.
|
109
|
+
(Puppet::FileSystem::File.new(path).stat.mode & 07777).to_s(8).should == mode
|
110
110
|
end
|
111
111
|
end
|
112
112
|
end
|
@@ -536,4 +536,57 @@ describe Puppet::Type.type(:mount), :unless => Puppet.features.microsoft_windows
|
|
536
536
|
run_in_catalog(resource)
|
537
537
|
end
|
538
538
|
end
|
539
|
+
|
540
|
+
describe "establishing autorequires" do
|
541
|
+
|
542
|
+
def create_resource(path)
|
543
|
+
described_class.new(
|
544
|
+
:name => path,
|
545
|
+
:provider => providerclass.new(path)
|
546
|
+
)
|
547
|
+
end
|
548
|
+
|
549
|
+
def create_catalog(*resources)
|
550
|
+
catalog = Puppet::Resource::Catalog.new
|
551
|
+
resources.each do |resource|
|
552
|
+
catalog.add_resource resource
|
553
|
+
end
|
554
|
+
|
555
|
+
catalog
|
556
|
+
end
|
557
|
+
|
558
|
+
let(:root_mount) { create_resource("/") }
|
559
|
+
let(:var_mount) { create_resource("/var") }
|
560
|
+
let(:log_mount) { create_resource("/var/log") }
|
561
|
+
|
562
|
+
before do
|
563
|
+
create_catalog(root_mount, var_mount, log_mount)
|
564
|
+
end
|
565
|
+
|
566
|
+
it "adds no autorequires for the root mount" do
|
567
|
+
expect(root_mount.autorequire).to be_empty
|
568
|
+
end
|
569
|
+
|
570
|
+
it "adds the parent autorequire for a mount with one parent" do
|
571
|
+
parent_relationship = var_mount.autorequire[0]
|
572
|
+
|
573
|
+
expect(var_mount.autorequire).to have_exactly(1).item
|
574
|
+
|
575
|
+
expect(parent_relationship.source).to eq root_mount
|
576
|
+
expect(parent_relationship.target).to eq var_mount
|
577
|
+
end
|
578
|
+
|
579
|
+
it "adds both parent autorequires for a mount with two parents" do
|
580
|
+
grandparent_relationship = log_mount.autorequire[0]
|
581
|
+
parent_relationship = log_mount.autorequire[1]
|
582
|
+
|
583
|
+
expect(log_mount.autorequire).to have_exactly(2).items
|
584
|
+
|
585
|
+
expect(grandparent_relationship.source).to eq root_mount
|
586
|
+
expect(grandparent_relationship.target).to eq log_mount
|
587
|
+
|
588
|
+
expect(parent_relationship.source).to eq var_mount
|
589
|
+
expect(parent_relationship.target).to eq log_mount
|
590
|
+
end
|
591
|
+
end
|
539
592
|
end
|
@@ -3,6 +3,222 @@ require 'spec_helper'
|
|
3
3
|
|
4
4
|
require 'puppet/external/nagios'
|
5
5
|
|
6
|
+
describe "Nagios parser" do
|
7
|
+
|
8
|
+
NONESCAPED_SEMICOLON_COMMENT = <<-'EOL'
|
9
|
+
define host{
|
10
|
+
use linux-server ; Name of host template to use
|
11
|
+
host_name localhost
|
12
|
+
alias localhost
|
13
|
+
address 127.0.0.1
|
14
|
+
}
|
15
|
+
|
16
|
+
define command{
|
17
|
+
command_name notify-host-by-email
|
18
|
+
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
|
19
|
+
}
|
20
|
+
EOL
|
21
|
+
|
22
|
+
LINE_COMMENT_SNIPPET = <<-'EOL'
|
23
|
+
|
24
|
+
# This is a comment starting at the beginning of a line
|
25
|
+
|
26
|
+
define command{
|
27
|
+
|
28
|
+
# This is a comment starting at the beginning of a line
|
29
|
+
|
30
|
+
command_name command_name
|
31
|
+
|
32
|
+
# This is a comment starting at the beginning of a line
|
33
|
+
## --PUPPET_NAME-- (called '_naginator_name' in the manifest) command_name
|
34
|
+
|
35
|
+
command_line command_line
|
36
|
+
|
37
|
+
# This is a comment starting at the beginning of a line
|
38
|
+
|
39
|
+
}
|
40
|
+
|
41
|
+
# This is a comment starting at the beginning of a line
|
42
|
+
|
43
|
+
EOL
|
44
|
+
|
45
|
+
LINE_COMMENT_SNIPPET2 = <<-'EOL'
|
46
|
+
define host{
|
47
|
+
use linux-server ; Name of host template to use
|
48
|
+
host_name localhost
|
49
|
+
alias localhost
|
50
|
+
address 127.0.0.1
|
51
|
+
}
|
52
|
+
define command{
|
53
|
+
command_name command_name2
|
54
|
+
command_line command_line2
|
55
|
+
}
|
56
|
+
EOL
|
57
|
+
|
58
|
+
UNKNOWN_NAGIOS_OBJECT_DEFINITION = <<-'EOL'
|
59
|
+
define command2{
|
60
|
+
command_name notify-host-by-email
|
61
|
+
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
|
62
|
+
}
|
63
|
+
EOL
|
64
|
+
|
65
|
+
MISSING_CLOSING_CURLY_BRACKET = <<-'EOL'
|
66
|
+
define command{
|
67
|
+
command_name notify-host-by-email
|
68
|
+
command_line /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$
|
69
|
+
EOL
|
70
|
+
|
71
|
+
ESCAPED_SEMICOLON = <<-'EOL'
|
72
|
+
define command {
|
73
|
+
command_name nagios_table_size
|
74
|
+
command_line $USER3$/check_mysql_health --hostname localhost --username nagioschecks --password nagiosCheckPWD --mode sql --name "SELECT ROUND(Data_length/1024) as Data_kBytes from INFORMATION_SCHEMA.TABLES where TABLE_NAME=\"$ARG1$\"\;" --name2 "table size" --units kBytes -w $ARG2$ -c $ARG3$
|
75
|
+
}
|
76
|
+
EOL
|
77
|
+
|
78
|
+
POUND_SIGN_HASH_SYMBOL_NOT_IN_FIRST_COLUMN = <<-'EOL'
|
79
|
+
define command {
|
80
|
+
command_name notify-by-irc
|
81
|
+
command_line /usr/local/bin/riseup-nagios-client.pl "$HOSTNAME$ ($SERVICEDESC$) $NOTIFICATIONTYPE$ #$SERVICEATTEMPT$ $SERVICESTATETYPE$ $SERVICEEXECUTIONTIME$s $SERVICELATENCY$s $SERVICEOUTPUT$ $SERVICEPERFDATA$"
|
82
|
+
}
|
83
|
+
EOL
|
84
|
+
|
85
|
+
ANOTHER_ESCAPED_SEMICOLON = <<-EOL
|
86
|
+
define command {
|
87
|
+
\tcommand_line LC_ALL=en_US.UTF-8 /usr/lib/nagios/plugins/check_haproxy -u 'http://blah:blah@$HOSTADDRESS$:8080/haproxy?stats\\;csv'
|
88
|
+
\tcommand_name check_haproxy
|
89
|
+
}
|
90
|
+
EOL
|
91
|
+
|
92
|
+
it "should parse without error" do
|
93
|
+
parser = Nagios::Parser.new
|
94
|
+
expect {
|
95
|
+
results = parser.parse(NONESCAPED_SEMICOLON_COMMENT)
|
96
|
+
}.to_not raise_error
|
97
|
+
end
|
98
|
+
|
99
|
+
describe "when parsing a statement" do
|
100
|
+
parser = Nagios::Parser.new
|
101
|
+
results = parser.parse(NONESCAPED_SEMICOLON_COMMENT)
|
102
|
+
results.each do |obj|
|
103
|
+
it "should have the proper base type" do
|
104
|
+
obj.should be_a_kind_of(Nagios::Base)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
it "should raise an error when an incorrect object definition is present" do
|
110
|
+
parser = Nagios::Parser.new
|
111
|
+
expect {
|
112
|
+
results = parser.parse(UNKNOWN_NAGIOS_OBJECT_DEFINITION)
|
113
|
+
}.to raise_error Nagios::Base::UnknownNagiosType
|
114
|
+
end
|
115
|
+
|
116
|
+
it "should raise an error when syntax is not correct" do
|
117
|
+
parser = Nagios::Parser.new
|
118
|
+
expect {
|
119
|
+
results = parser.parse(MISSING_CLOSING_CURLY_BRACKET)
|
120
|
+
}.to raise_error Nagios::Parser::SyntaxError
|
121
|
+
end
|
122
|
+
|
123
|
+
describe "when encoutering ';'" do
|
124
|
+
it "should not throw an exception" do
|
125
|
+
parser = Nagios::Parser.new
|
126
|
+
expect {
|
127
|
+
results = parser.parse(ESCAPED_SEMICOLON)
|
128
|
+
}.to_not raise_error Nagios::Parser::SyntaxError
|
129
|
+
end
|
130
|
+
|
131
|
+
it "should ignore it if it is a comment" do
|
132
|
+
parser = Nagios::Parser.new
|
133
|
+
results = parser.parse(NONESCAPED_SEMICOLON_COMMENT)
|
134
|
+
results[0].use.should eql("linux-server")
|
135
|
+
end
|
136
|
+
|
137
|
+
it "should parse correctly if it is escaped" do
|
138
|
+
parser = Nagios::Parser.new
|
139
|
+
results = parser.parse(ESCAPED_SEMICOLON)
|
140
|
+
results[0].command_line.should eql("$USER3$/check_mysql_health --hostname localhost --username nagioschecks --password nagiosCheckPWD --mode sql --name \"SELECT ROUND(Data_length/1024) as Data_kBytes from INFORMATION_SCHEMA.TABLES where TABLE_NAME=\\\"$ARG1$\\\";\" --name2 \"table size\" --units kBytes -w $ARG2$ -c $ARG3$")
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
describe "when encountering '#'" do
|
145
|
+
|
146
|
+
it "should not throw an exception" do
|
147
|
+
parser = Nagios::Parser.new
|
148
|
+
expect {
|
149
|
+
results = parser.parse(POUND_SIGN_HASH_SYMBOL_NOT_IN_FIRST_COLUMN)
|
150
|
+
}.to_not raise_error Nagios::Parser::SyntaxError
|
151
|
+
end
|
152
|
+
|
153
|
+
|
154
|
+
it "should ignore it at the beginning of a line" do
|
155
|
+
parser = Nagios::Parser.new
|
156
|
+
results = parser.parse(LINE_COMMENT_SNIPPET)
|
157
|
+
results[0].command_line.should eql("command_line")
|
158
|
+
end
|
159
|
+
|
160
|
+
it "should let it go anywhere else" do
|
161
|
+
parser = Nagios::Parser.new
|
162
|
+
results = parser.parse(POUND_SIGN_HASH_SYMBOL_NOT_IN_FIRST_COLUMN)
|
163
|
+
results[0].command_line.should eql("/usr/local/bin/riseup-nagios-client.pl \"$HOSTNAME$ ($SERVICEDESC$) $NOTIFICATIONTYPE$ \#$SERVICEATTEMPT$ $SERVICESTATETYPE$ $SERVICEEXECUTIONTIME$s $SERVICELATENCY$s $SERVICEOUTPUT$ $SERVICEPERFDATA$\"")
|
164
|
+
end
|
165
|
+
|
166
|
+
end
|
167
|
+
|
168
|
+
describe "when encountering ';' again" do
|
169
|
+
it "should not throw an exception" do
|
170
|
+
parser = Nagios::Parser.new
|
171
|
+
expect {
|
172
|
+
results = parser.parse(ANOTHER_ESCAPED_SEMICOLON)
|
173
|
+
}.to_not raise_error Nagios::Parser::SyntaxError
|
174
|
+
end
|
175
|
+
|
176
|
+
it "should parse correctly" do
|
177
|
+
parser = Nagios::Parser.new
|
178
|
+
results = parser.parse(ANOTHER_ESCAPED_SEMICOLON)
|
179
|
+
results[0].command_line.should eql("LC_ALL=en_US.UTF-8 /usr/lib/nagios/plugins/check_haproxy -u 'http://blah:blah@$HOSTADDRESS$:8080/haproxy?stats;csv'")
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
|
184
|
+
it "should be idempotent" do
|
185
|
+
parser = Nagios::Parser.new
|
186
|
+
src = ANOTHER_ESCAPED_SEMICOLON.dup
|
187
|
+
results = parser.parse(src)
|
188
|
+
nagios_type = Nagios::Base.create(:command)
|
189
|
+
nagios_type.command_name = results[0].command_name
|
190
|
+
nagios_type.command_line = results[0].command_line
|
191
|
+
nagios_type.to_s.should eql(ANOTHER_ESCAPED_SEMICOLON)
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
195
|
+
|
196
|
+
describe "Nagios generator" do
|
197
|
+
|
198
|
+
it "should escape ';'" do
|
199
|
+
param = '$USER3$/check_mysql_health --hostname localhost --username nagioschecks --password nagiosCheckPWD --mode sql --name "SELECT ROUND(Data_length/1024) as Data_kBytes from INFORMATION_SCHEMA.TABLES where TABLE_NAME=\"$ARG1$\";" --name2 "table size" --units kBytes -w $ARG2$ -c $ARG3$'
|
200
|
+
nagios_type = Nagios::Base.create(:command)
|
201
|
+
nagios_type.command_line = param
|
202
|
+
nagios_type.to_s.should eql("define command {\n\tcommand_line $USER3$/check_mysql_health --hostname localhost --username nagioschecks --password nagiosCheckPWD --mode sql --name \"SELECT ROUND(Data_length/1024) as Data_kBytes from INFORMATION_SCHEMA.TABLES where TABLE_NAME=\\\"$ARG1$\\\"\\;\" --name2 \"table size\" --units kBytes -w $ARG2$ -c $ARG3$\n}\n")
|
203
|
+
end
|
204
|
+
|
205
|
+
it "should escape ';' if it is not already the case" do
|
206
|
+
param = "LC_ALL=en_US.UTF-8 /usr/lib/nagios/plugins/check_haproxy -u 'http://blah:blah@$HOSTADDRESS$:8080/haproxy?stats;csv'"
|
207
|
+
nagios_type = Nagios::Base.create(:command)
|
208
|
+
nagios_type.command_line = param
|
209
|
+
nagios_type.to_s.should eql("define command {\n\tcommand_line LC_ALL=en_US.UTF-8 /usr/lib/nagios/plugins/check_haproxy -u 'http://blah:blah@$HOSTADDRESS$:8080/haproxy?stats\\;csv'\n}\n")
|
210
|
+
end
|
211
|
+
|
212
|
+
it "should be idempotent" do
|
213
|
+
param = '$USER3$/check_mysql_health --hostname localhost --username nagioschecks --password nagiosCheckPWD --mode sql --name "SELECT ROUND(Data_length/1024) as Data_kBytes from INFORMATION_SCHEMA.TABLES where TABLE_NAME=\"$ARG1$\";" --name2 "table size" --units kBytes -w $ARG2$ -c $ARG3$'
|
214
|
+
nagios_type = Nagios::Base.create(:command)
|
215
|
+
nagios_type.command_line = param
|
216
|
+
parser = Nagios::Parser.new
|
217
|
+
results = parser.parse(nagios_type.to_s)
|
218
|
+
results[0].command_line.should eql(param)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
6
222
|
describe "Nagios resource types" do
|
7
223
|
Nagios::Base.eachtype do |name, nagios_type|
|
8
224
|
puppet_type = Puppet::Type.type("nagios_#{name}")
|