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
@@ -1,40 +1,40 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
require 'puppet/
|
4
|
+
require 'puppet/confine'
|
5
5
|
|
6
|
-
describe Puppet::
|
6
|
+
describe Puppet::Confine do
|
7
7
|
it "should require a value" do
|
8
|
-
lambda { Puppet::
|
8
|
+
lambda { Puppet::Confine.new }.should raise_error(ArgumentError)
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should always convert values to an array" do
|
12
|
-
Puppet::
|
12
|
+
Puppet::Confine.new("/some/file").values.should be_instance_of(Array)
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should have a 'true' test" do
|
16
|
-
Puppet::
|
16
|
+
Puppet::Confine.test(:true).should be_instance_of(Class)
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should have a 'false' test" do
|
20
|
-
Puppet::
|
20
|
+
Puppet::Confine.test(:false).should be_instance_of(Class)
|
21
21
|
end
|
22
22
|
|
23
23
|
it "should have a 'feature' test" do
|
24
|
-
Puppet::
|
24
|
+
Puppet::Confine.test(:feature).should be_instance_of(Class)
|
25
25
|
end
|
26
26
|
|
27
27
|
it "should have an 'exists' test" do
|
28
|
-
Puppet::
|
28
|
+
Puppet::Confine.test(:exists).should be_instance_of(Class)
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should have a 'variable' test" do
|
32
|
-
Puppet::
|
32
|
+
Puppet::Confine.test(:variable).should be_instance_of(Class)
|
33
33
|
end
|
34
34
|
|
35
35
|
describe "when testing all values" do
|
36
36
|
before do
|
37
|
-
@confine = Puppet::
|
37
|
+
@confine = Puppet::Confine.new(%w{a b c})
|
38
38
|
@confine.label = "foo"
|
39
39
|
end
|
40
40
|
|
@@ -64,7 +64,7 @@ describe Puppet::Provider::Confine do
|
|
64
64
|
end
|
65
65
|
|
66
66
|
describe "when testing the result of the values" do
|
67
|
-
before { @confine = Puppet::
|
67
|
+
before { @confine = Puppet::Confine.new(%w{a b c d}) }
|
68
68
|
|
69
69
|
it "should return an array with the result of the test for each value" do
|
70
70
|
@confine.stubs(:pass?).returns true
|
@@ -1,12 +1,12 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
require 'puppet/
|
4
|
+
require 'puppet/confiner'
|
5
5
|
|
6
|
-
describe Puppet::
|
6
|
+
describe Puppet::Confiner do
|
7
7
|
before do
|
8
8
|
@object = Object.new
|
9
|
-
@object.extend(Puppet::
|
9
|
+
@object.extend(Puppet::Confiner)
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should have a method for defining confines" do
|
@@ -29,7 +29,7 @@ describe Puppet::Provider::Confiner do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
it "should create a new confine collection if one does not exist" do
|
32
|
-
Puppet::
|
32
|
+
Puppet::ConfineCollection.expects(:new).with("mylabel").returns "mycoll"
|
33
33
|
@object.expects(:to_s).returns "mylabel"
|
34
34
|
@object.confine_collection.should == "mycoll"
|
35
35
|
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'puppet_spec/files'
|
3
|
+
|
4
|
+
require 'puppet/face'
|
5
|
+
|
6
|
+
describe Puppet::Face[:parser, :current] do
|
7
|
+
include PuppetSpec::Files
|
8
|
+
|
9
|
+
let(:parser) { Puppet::Face[:parser, :current] }
|
10
|
+
|
11
|
+
it "validates the configured site manifest when no files are given" do
|
12
|
+
Puppet[:manifest] = file_containing('site.pp', "{ invalid =>")
|
13
|
+
from_an_interactive_terminal
|
14
|
+
|
15
|
+
expect { parser.validate() }.to exit_with(1)
|
16
|
+
end
|
17
|
+
|
18
|
+
it "validates the given file" do
|
19
|
+
manifest = file_containing('site.pp', "{ invalid =>")
|
20
|
+
from_an_interactive_terminal
|
21
|
+
|
22
|
+
expect { parser.validate(manifest) }.to exit_with(1)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "validates the contents of STDIN when no files given and STDIN is not a tty" do
|
26
|
+
from_a_piped_input_of("{ invalid =>")
|
27
|
+
|
28
|
+
expect { parser.validate() }.to exit_with(1)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "runs error free when there are no validation errors" do
|
32
|
+
manifest = file_containing('site.pp', "notify { valid: }")
|
33
|
+
from_an_interactive_terminal
|
34
|
+
|
35
|
+
parser.validate(manifest)
|
36
|
+
end
|
37
|
+
|
38
|
+
it "reports missing files" do
|
39
|
+
from_an_interactive_terminal
|
40
|
+
|
41
|
+
expect do
|
42
|
+
parser.validate("missing.pp")
|
43
|
+
end.to raise_error(Puppet::Error, /One or more file\(s\) specified did not exist.*missing\.pp/m)
|
44
|
+
end
|
45
|
+
|
46
|
+
def from_an_interactive_terminal
|
47
|
+
STDIN.stubs(:tty?).returns(true)
|
48
|
+
end
|
49
|
+
|
50
|
+
def from_a_piped_input_of(contents)
|
51
|
+
STDIN.stubs(:tty?).returns(false)
|
52
|
+
STDIN.stubs(:read).returns(contents)
|
53
|
+
end
|
54
|
+
end
|
@@ -45,7 +45,7 @@ describe Puppet::FileBucket::Dipper do
|
|
45
45
|
Digest::MD5.hexdigest("my\r\ncontents").should == checksum
|
46
46
|
|
47
47
|
@dipper.backup(file).should == checksum
|
48
|
-
File.
|
48
|
+
Puppet::FileSystem::File.exist?("#{file_bucket}/f/0/d/7/d/4/e/4/f0d7d4e480ad698ed56aeec8b6bd6dea/contents").should == true
|
49
49
|
end
|
50
50
|
|
51
51
|
it "should not backup a file that is already in the bucket" do
|
@@ -123,7 +123,7 @@ describe Puppet::FileBucket::Dipper do
|
|
123
123
|
klass.any_instance.expects(:find).with { |r| request = r }.returns(Puppet::FileBucket::File.new(contents))
|
124
124
|
|
125
125
|
dipper.restore(dest, md5).should == md5
|
126
|
-
Digest::MD5.hexdigest(
|
126
|
+
Digest::MD5.hexdigest(Puppet::FileSystem::File.new(dest).binread).should == md5
|
127
127
|
|
128
128
|
request.key.should == "md5/#{md5}"
|
129
129
|
request.server.should == server
|
@@ -42,12 +42,12 @@ describe Puppet::FileServing::Base do
|
|
42
42
|
end
|
43
43
|
|
44
44
|
it "should allow specification of a path" do
|
45
|
-
|
45
|
+
Puppet::FileSystem::File.stubs(:exist?).returns(true)
|
46
46
|
Puppet::FileServing::Base.new(path, :path => file).path.should == file
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should allow specification of a relative path" do
|
50
|
-
|
50
|
+
Puppet::FileSystem::File.stubs(:exist?).returns(true)
|
51
51
|
Puppet::FileServing::Base.new(path, :relative_path => "my/file").relative_path.should == "my/file"
|
52
52
|
end
|
53
53
|
|
@@ -56,19 +56,22 @@ describe Puppet::FileServing::Base do
|
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should correctly indicate if the file is present" do
|
59
|
-
|
59
|
+
mock_file = mock(file, :lstat => stub('stat'))
|
60
|
+
Puppet::FileSystem::File.expects(:new).with(file).returns mock_file
|
60
61
|
Puppet::FileServing::Base.new(file).exist?.should be_true
|
61
62
|
end
|
62
63
|
|
63
64
|
it "should correctly indicate if the file is absent" do
|
64
|
-
|
65
|
+
mock_file = mock(file)
|
66
|
+
Puppet::FileSystem::File.expects(:new).with(file).returns mock_file
|
67
|
+
mock_file.expects(:lstat).raises RuntimeError
|
65
68
|
Puppet::FileServing::Base.new(file).exist?.should be_false
|
66
69
|
end
|
67
70
|
|
68
71
|
describe "when setting the relative path" do
|
69
72
|
it "should require that the relative path be unqualified" do
|
70
73
|
@file = Puppet::FileServing::Base.new(path)
|
71
|
-
|
74
|
+
Puppet::FileSystem::File.stubs(:exist?).returns(true)
|
72
75
|
proc { @file.relative_path = File.expand_path("/qualified/file") }.should raise_error(ArgumentError)
|
73
76
|
end
|
74
77
|
end
|
@@ -102,27 +105,47 @@ describe Puppet::FileServing::Base do
|
|
102
105
|
end
|
103
106
|
end
|
104
107
|
|
108
|
+
describe "when handling a UNC file path on Windows" do
|
109
|
+
let(:path) { '//server/share/filename' }
|
110
|
+
let(:file) { Puppet::FileServing::Base.new(path) }
|
111
|
+
|
112
|
+
it "should preserve double slashes at the beginning of the path" do
|
113
|
+
Puppet.features.stubs(:microsoft_windows?).returns(true)
|
114
|
+
file.full_path.should == path
|
115
|
+
end
|
116
|
+
|
117
|
+
it "should strip double slashes not at the beginning of the path" do
|
118
|
+
Puppet.features.stubs(:microsoft_windows?).returns(true)
|
119
|
+
file = Puppet::FileServing::Base.new('//server//share//filename')
|
120
|
+
file.full_path.should == path
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
|
105
125
|
describe "when stat'ing files" do
|
106
126
|
let(:path) { File.expand_path('/this/file') }
|
107
127
|
let(:file) { Puppet::FileServing::Base.new(path) }
|
128
|
+
let(:stat) { stub('stat', :ftype => 'file' ) }
|
129
|
+
let(:stubbed_file) { stub(path, :stat => stat, :lstat => stat)}
|
108
130
|
|
109
131
|
it "should stat the file's full path" do
|
110
|
-
File.expects(:
|
132
|
+
Puppet::FileSystem::File.expects(:new).with(path).returns stubbed_file
|
111
133
|
file.stat
|
112
134
|
end
|
113
135
|
|
114
136
|
it "should fail if the file does not exist" do
|
115
|
-
File.expects(:
|
137
|
+
Puppet::FileSystem::File.expects(:new).with(path).returns stubbed_file
|
138
|
+
stubbed_file.expects(:lstat).raises(Errno::ENOENT)
|
116
139
|
proc { file.stat }.should raise_error(Errno::ENOENT)
|
117
140
|
end
|
118
141
|
|
119
142
|
it "should use :lstat if :links is set to :manage" do
|
120
|
-
File.expects(:
|
143
|
+
Puppet::FileSystem::File.expects(:new).with(path).returns stubbed_file
|
121
144
|
file.stat
|
122
145
|
end
|
123
146
|
|
124
147
|
it "should use :stat if :links is set to :follow" do
|
125
|
-
File.expects(:
|
148
|
+
Puppet::FileSystem::File.expects(:new).with(path).returns stubbed_file
|
126
149
|
file.links = :follow
|
127
150
|
file.stat
|
128
151
|
end
|
@@ -27,12 +27,12 @@ describe Puppet::FileServing::Configuration do
|
|
27
27
|
describe "when initializing" do
|
28
28
|
|
29
29
|
it "should work without a configuration file" do
|
30
|
-
|
30
|
+
Puppet::FileSystem::File.stubs(:exist?).with(@path).returns(false)
|
31
31
|
expect { Puppet::FileServing::Configuration.configuration }.to_not raise_error
|
32
32
|
end
|
33
33
|
|
34
34
|
it "should parse the configuration file if present" do
|
35
|
-
|
35
|
+
Puppet::FileSystem::File.stubs(:exist?).with(@path).returns(true)
|
36
36
|
@parser = mock 'parser'
|
37
37
|
@parser.expects(:parse).returns({})
|
38
38
|
Puppet::FileServing::Configuration::Parser.stubs(:new).returns(@parser)
|
@@ -47,7 +47,7 @@ describe Puppet::FileServing::Configuration do
|
|
47
47
|
describe "when parsing the configuration file" do
|
48
48
|
|
49
49
|
before do
|
50
|
-
|
50
|
+
Puppet::FileSystem::File.stubs(:exist?).with(@path).returns(true)
|
51
51
|
@parser = mock 'parser'
|
52
52
|
Puppet::FileServing::Configuration::Parser.stubs(:new).returns(@parser)
|
53
53
|
end
|
@@ -84,14 +84,14 @@ describe Puppet::FileServing::Configuration do
|
|
84
84
|
end
|
85
85
|
|
86
86
|
it "should add modules and plugins mounts even if the file does not exist" do
|
87
|
-
|
87
|
+
Puppet::FileSystem::File.expects(:exist?).returns false # the file doesn't exist
|
88
88
|
config = Puppet::FileServing::Configuration.configuration
|
89
89
|
config.mounted?("modules").should be_true
|
90
90
|
config.mounted?("plugins").should be_true
|
91
91
|
end
|
92
92
|
|
93
93
|
it "should allow all access to modules and plugins if no fileserver.conf exists" do
|
94
|
-
|
94
|
+
Puppet::FileSystem::File.expects(:exist?).returns false # the file doesn't exist
|
95
95
|
modules = stub 'modules', :empty? => true
|
96
96
|
Puppet::FileServing::Mount::Modules.stubs(:new).returns(modules)
|
97
97
|
modules.expects(:allow).with('*')
|
@@ -104,7 +104,7 @@ describe Puppet::FileServing::Configuration do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
it "should not allow access from all to modules and plugins if the fileserver.conf provided some rules" do
|
107
|
-
|
107
|
+
Puppet::FileSystem::File.expects(:exist?).returns false # the file doesn't exist
|
108
108
|
|
109
109
|
modules = stub 'modules', :empty? => false
|
110
110
|
Puppet::FileServing::Mount::Modules.stubs(:new).returns(modules)
|
@@ -119,7 +119,7 @@ describe Puppet::FileServing::Configuration do
|
|
119
119
|
|
120
120
|
it "should add modules and plugins mounts even if they are not returned by the parser" do
|
121
121
|
@parser.expects(:parse).returns("one" => mock("mount"))
|
122
|
-
|
122
|
+
Puppet::FileSystem::File.expects(:exist?).returns true # the file doesn't exist
|
123
123
|
config = Puppet::FileServing::Configuration.configuration
|
124
124
|
config.mounted?("modules").should be_true
|
125
125
|
config.mounted?("plugins").should be_true
|
@@ -26,7 +26,8 @@ describe Puppet::FileServing::Content do
|
|
26
26
|
content = Puppet::FileServing::Content.new(path)
|
27
27
|
|
28
28
|
result = "foo"
|
29
|
-
|
29
|
+
stub_file = stub(path, :lstat => stub('stat', :ftype => "file"))
|
30
|
+
Puppet::FileSystem::File.expects(:new).with(path).returns stub_file
|
30
31
|
File.expects(:read).with(path).never
|
31
32
|
content.collect
|
32
33
|
|
@@ -37,7 +38,8 @@ describe Puppet::FileServing::Content do
|
|
37
38
|
content = Puppet::FileServing::Content.new(path)
|
38
39
|
|
39
40
|
result = "foo"
|
40
|
-
|
41
|
+
stub_file = stub(path, :lstat => stub('stat', :ftype => "directory"))
|
42
|
+
Puppet::FileSystem::File.expects(:new).with(path).returns stub_file
|
41
43
|
File.expects(:read).with(path).never
|
42
44
|
content.collect
|
43
45
|
|
@@ -83,7 +85,8 @@ describe Puppet::FileServing::Content, "when returning the contents" do
|
|
83
85
|
|
84
86
|
it "should fail if the file is a symlink and links are set to :manage" do
|
85
87
|
content.links = :manage
|
86
|
-
|
88
|
+
stub_file = stub(path, :lstat => stub("stat", :ftype => "symlink"))
|
89
|
+
Puppet::FileSystem::File.expects(:new).with(path).returns stub_file
|
87
90
|
proc { content.content }.should raise_error(ArgumentError)
|
88
91
|
end
|
89
92
|
|
@@ -97,14 +100,16 @@ describe Puppet::FileServing::Content, "when returning the contents" do
|
|
97
100
|
end
|
98
101
|
|
99
102
|
it "should return the contents of the path if the file exists" do
|
100
|
-
|
101
|
-
|
103
|
+
mocked_file = mock(path, :stat => stub('stat', :ftype => 'file'))
|
104
|
+
Puppet::FileSystem::File.expects(:new).with(path).twice.returns(mocked_file)
|
105
|
+
mocked_file.expects(:binread).returns(:mycontent)
|
102
106
|
content.content.should == :mycontent
|
103
107
|
end
|
104
108
|
|
105
109
|
it "should cache the returned contents" do
|
106
|
-
|
107
|
-
|
110
|
+
mocked_file = mock(path, :stat => stub('stat', :ftype => 'file'))
|
111
|
+
Puppet::FileSystem::File.expects(:new).with(path).twice.returns(mocked_file)
|
112
|
+
mocked_file.expects(:binread).returns(:mycontent)
|
108
113
|
content.content
|
109
114
|
# The second run would throw a failure if the content weren't being cached.
|
110
115
|
content.content
|
@@ -18,49 +18,58 @@ describe Puppet::FileServing::Fileset do
|
|
18
18
|
|
19
19
|
it "removes a trailing file path separator" do
|
20
20
|
path_with_separator = "#{somefile}#{File::SEPARATOR}"
|
21
|
-
|
21
|
+
stub_file = stub(somefile, :lstat => stub('stat'))
|
22
|
+
Puppet::FileSystem::File.expects(:new).with(somefile).returns stub_file
|
22
23
|
fileset = Puppet::FileServing::Fileset.new(path_with_separator)
|
23
24
|
fileset.path.should == somefile
|
24
25
|
end
|
25
26
|
|
26
27
|
it "can be created from the root directory" do
|
27
28
|
path = File.expand_path(File::SEPARATOR)
|
28
|
-
|
29
|
+
stub_file = stub(path, :lstat => stub('stat'))
|
30
|
+
Puppet::FileSystem::File.expects(:new).with(path).returns stub_file
|
29
31
|
fileset = Puppet::FileServing::Fileset.new(path)
|
30
32
|
fileset.path.should == path
|
31
33
|
end
|
32
34
|
|
33
35
|
it "fails if its path does not exist" do
|
34
|
-
|
36
|
+
mock_file = mock(somefile)
|
37
|
+
Puppet::FileSystem::File.expects(:new).with(somefile).returns mock_file
|
38
|
+
mock_file.expects(:lstat).raises(Errno::ENOENT)
|
35
39
|
expect { Puppet::FileServing::Fileset.new(somefile) }.to raise_error(ArgumentError, "Fileset paths must exist")
|
36
40
|
end
|
37
41
|
|
38
42
|
it "accepts a 'recurse' option" do
|
39
|
-
|
43
|
+
stub_file = stub(somefile, :lstat => stub('stat'))
|
44
|
+
Puppet::FileSystem::File.expects(:new).with(somefile).returns stub_file
|
40
45
|
set = Puppet::FileServing::Fileset.new(somefile, :recurse => true)
|
41
46
|
set.recurse.should be_true
|
42
47
|
end
|
43
48
|
|
44
49
|
it "accepts a 'recurselimit' option" do
|
45
|
-
|
50
|
+
stub_file = stub(somefile, :lstat => stub('stat'))
|
51
|
+
Puppet::FileSystem::File.expects(:new).with(somefile).returns stub_file
|
46
52
|
set = Puppet::FileServing::Fileset.new(somefile, :recurselimit => 3)
|
47
53
|
set.recurselimit.should == 3
|
48
54
|
end
|
49
55
|
|
50
56
|
it "accepts an 'ignore' option" do
|
51
|
-
|
57
|
+
stub_file = stub(somefile, :lstat => stub('stat'))
|
58
|
+
Puppet::FileSystem::File.expects(:new).with(somefile).returns stub_file
|
52
59
|
set = Puppet::FileServing::Fileset.new(somefile, :ignore => ".svn")
|
53
60
|
set.ignore.should == [".svn"]
|
54
61
|
end
|
55
62
|
|
56
63
|
it "accepts a 'links' option" do
|
57
|
-
|
64
|
+
stub_file = stub(somefile, :lstat => stub('stat'))
|
65
|
+
Puppet::FileSystem::File.expects(:new).with(somefile).returns stub_file
|
58
66
|
set = Puppet::FileServing::Fileset.new(somefile, :links => :manage)
|
59
67
|
set.links.should == :manage
|
60
68
|
end
|
61
69
|
|
62
70
|
it "accepts a 'checksum_type' option" do
|
63
|
-
|
71
|
+
stub_file = stub(somefile, :lstat => stub('stat'))
|
72
|
+
Puppet::FileSystem::File.expects(:new).with(somefile).returns stub_file
|
64
73
|
set = Puppet::FileServing::Fileset.new(somefile, :checksum_type => :test)
|
65
74
|
set.checksum_type.should == :test
|
66
75
|
end
|
@@ -70,30 +79,35 @@ describe Puppet::FileServing::Fileset do
|
|
70
79
|
end
|
71
80
|
|
72
81
|
it "defaults to 'false' for recurse" do
|
73
|
-
|
82
|
+
stub_file = stub(somefile, :lstat => stub('stat'))
|
83
|
+
Puppet::FileSystem::File.expects(:new).with(somefile).returns stub_file
|
74
84
|
Puppet::FileServing::Fileset.new(somefile).recurse.should == false
|
75
85
|
end
|
76
86
|
|
77
87
|
it "defaults to :infinite for recurselimit" do
|
78
|
-
|
88
|
+
stub_file = stub(somefile, :lstat => stub('stat'))
|
89
|
+
Puppet::FileSystem::File.expects(:new).with(somefile).returns stub_file
|
79
90
|
Puppet::FileServing::Fileset.new(somefile).recurselimit.should == :infinite
|
80
91
|
end
|
81
92
|
|
82
93
|
it "defaults to an empty ignore list" do
|
83
|
-
|
94
|
+
stub_file = stub(somefile, :lstat => stub('stat'))
|
95
|
+
Puppet::FileSystem::File.expects(:new).with(somefile).returns stub_file
|
84
96
|
Puppet::FileServing::Fileset.new(somefile).ignore.should == []
|
85
97
|
end
|
86
98
|
|
87
99
|
it "defaults to :manage for links" do
|
88
|
-
|
100
|
+
stub_file = stub(somefile, :lstat => stub('stat'))
|
101
|
+
Puppet::FileSystem::File.expects(:new).with(somefile).returns stub_file
|
89
102
|
Puppet::FileServing::Fileset.new(somefile).links.should == :manage
|
90
103
|
end
|
91
104
|
|
92
105
|
describe "using an indirector request" do
|
93
106
|
let(:values) { { :links => :manage, :ignore => %w{a b}, :recurse => true, :recurselimit => 1234 } }
|
107
|
+
let(:stub_file) { stub(somefile, :lstat => stub('stat')) }
|
94
108
|
|
95
109
|
before :each do
|
96
|
-
File.
|
110
|
+
Puppet::FileSystem::File.expects(:new).with(somefile).returns stub_file
|
97
111
|
end
|
98
112
|
|
99
113
|
[:recurse, :recurselimit, :ignore, :links].each do |option|
|
@@ -130,7 +144,8 @@ describe Puppet::FileServing::Fileset do
|
|
130
144
|
context "when recursing" do
|
131
145
|
before do
|
132
146
|
@path = make_absolute("/my/path")
|
133
|
-
|
147
|
+
@stub_file = stub(@path, :lstat => stub('stat', :directory? => true))
|
148
|
+
Puppet::FileSystem::File.stubs(:new).with(@path).returns @stub_file
|
134
149
|
@fileset = Puppet::FileServing::Fileset.new(@path)
|
135
150
|
|
136
151
|
@dirstat = stub 'dirstat', :directory? => true
|
@@ -138,7 +153,7 @@ describe Puppet::FileServing::Fileset do
|
|
138
153
|
end
|
139
154
|
|
140
155
|
def mock_dir_structure(path, stat_method = :lstat)
|
141
|
-
|
156
|
+
@stub_file.stubs(stat_method).returns(@dirstat)
|
142
157
|
Dir.stubs(:entries).with(path).returns(%w{one two .svn CVS})
|
143
158
|
|
144
159
|
# Keep track of the files we're stubbing.
|
@@ -147,11 +162,14 @@ describe Puppet::FileServing::Fileset do
|
|
147
162
|
%w{one two .svn CVS}.each do |subdir|
|
148
163
|
@files << subdir # relative path
|
149
164
|
subpath = File.join(path, subdir)
|
150
|
-
|
165
|
+
stub_subpath = stub(subpath, stat_method => @dirstat)
|
166
|
+
Puppet::FileSystem::File.stubs(:new).with(subpath).returns stub_subpath
|
151
167
|
Dir.stubs(:entries).with(subpath).returns(%w{.svn CVS file1 file2})
|
152
168
|
%w{file1 file2 .svn CVS}.each do |file|
|
153
169
|
@files << File.join(subdir, file) # relative path
|
154
|
-
File.
|
170
|
+
subfile_path = File.join(subpath, file)
|
171
|
+
stub_subfile_path = stub(subfile_path, stat_method => @filestat)
|
172
|
+
Puppet::FileSystem::File.stubs(:new).with(subfile_path).returns stub_subfile_path
|
155
173
|
end
|
156
174
|
end
|
157
175
|
end
|
@@ -165,8 +183,10 @@ describe Puppet::FileServing::Fileset do
|
|
165
183
|
|
166
184
|
MockDirectory = Struct.new(:name, :entries) do
|
167
185
|
def mock(base_path)
|
186
|
+
extend Mocha::API
|
168
187
|
path = File.join(base_path, name)
|
169
|
-
|
188
|
+
stub_dir = stub(path, :lstat => MockStat.new(path, true))
|
189
|
+
Puppet::FileSystem::File.stubs(:new).with(path).returns stub_dir
|
170
190
|
Dir.stubs(:entries).with(path).returns(['.', '..'] + entries.map(&:name))
|
171
191
|
entries.each do |entry|
|
172
192
|
entry.mock(path)
|
@@ -176,8 +196,10 @@ describe Puppet::FileServing::Fileset do
|
|
176
196
|
|
177
197
|
MockFile = Struct.new(:name) do
|
178
198
|
def mock(base_path)
|
199
|
+
extend Mocha::API
|
179
200
|
path = File.join(base_path, name)
|
180
|
-
|
201
|
+
stub_file = stub(path, :lstat => MockStat.new(path, false))
|
202
|
+
Puppet::FileSystem::File.stubs(:new).with(path).returns stub_file
|
181
203
|
end
|
182
204
|
end
|
183
205
|
|
@@ -239,14 +261,14 @@ describe Puppet::FileServing::Fileset do
|
|
239
261
|
@fileset.files.find { |file| file.include?(".svn") or file.include?("CVS") }.should be_nil
|
240
262
|
end
|
241
263
|
|
242
|
-
it "uses File
|
264
|
+
it "uses Puppet::FileSystem::File#stat if :links is set to :follow" do
|
243
265
|
mock_dir_structure(@path, :stat)
|
244
266
|
@fileset.recurse = true
|
245
267
|
@fileset.links = :follow
|
246
268
|
@fileset.files.sort.should == @files.sort
|
247
269
|
end
|
248
270
|
|
249
|
-
it "uses File
|
271
|
+
it "uses Puppet::FileSystem::File#lstat if :links is set to :manage" do
|
250
272
|
mock_dir_structure(@path, :lstat)
|
251
273
|
@fileset.recurse = true
|
252
274
|
@fileset.links = :manage
|
@@ -255,7 +277,9 @@ describe Puppet::FileServing::Fileset do
|
|
255
277
|
|
256
278
|
it "works when paths have regexp significant characters" do
|
257
279
|
@path = make_absolute("/my/path/rV1x2DafFr0R6tGG+1bbk++++TM")
|
258
|
-
|
280
|
+
stat = stub('dir_stat', :directory? => true)
|
281
|
+
stub_file = stub(@path, :stat => stat, :lstat => stat)
|
282
|
+
Puppet::FileSystem::File.expects(:new).with(@path).twice.returns stub_file
|
259
283
|
@fileset = Puppet::FileServing::Fileset.new(@path)
|
260
284
|
mock_dir_structure(@path)
|
261
285
|
@fileset.recurse = true
|
@@ -267,9 +291,13 @@ describe Puppet::FileServing::Fileset do
|
|
267
291
|
path = make_absolute("/my/path")
|
268
292
|
stat = stub 'stat', :directory? => true
|
269
293
|
|
270
|
-
|
271
|
-
File.expects(:
|
272
|
-
|
294
|
+
mock_file = mock(path, :lstat => stat, :stat => stat)
|
295
|
+
Puppet::FileSystem::File.expects(:new).with(path).twice.returns mock_file
|
296
|
+
|
297
|
+
link_path = File.join(path, "mylink")
|
298
|
+
mock_link = mock(link_path)
|
299
|
+
Puppet::FileSystem::File.expects(:new).with(link_path).returns mock_link
|
300
|
+
mock_link.expects(:stat).raises(Errno::ENOENT)
|
273
301
|
|
274
302
|
Dir.stubs(:entries).with(path).returns(["mylink"])
|
275
303
|
|
@@ -284,10 +312,12 @@ describe Puppet::FileServing::Fileset do
|
|
284
312
|
context "when merging other filesets" do
|
285
313
|
before do
|
286
314
|
@paths = [make_absolute("/first/path"), make_absolute("/second/path"), make_absolute("/third/path")]
|
287
|
-
|
315
|
+
stub_file = stub(:lstat => stub('stat', :directory? => false))
|
316
|
+
Puppet::FileSystem::File.stubs(:new).returns stub_file
|
288
317
|
|
289
318
|
@filesets = @paths.collect do |path|
|
290
|
-
|
319
|
+
stub_dir = stub(path, :lstat => stub('stat', :directory? => true))
|
320
|
+
Puppet::FileSystem::File.stubs(:new).with(path).returns stub_dir
|
291
321
|
Puppet::FileServing::Fileset.new(path, :recurse => true)
|
292
322
|
end
|
293
323
|
|