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
@@ -19,7 +19,7 @@ describe Puppet::Configurer::PluginHandler do
|
|
19
19
|
|
20
20
|
it "should use an Agent Downloader, with the name, source, destination, ignore, and environment set correctly, to download plugins when downloading is enabled" do
|
21
21
|
downloader = mock 'downloader'
|
22
|
-
|
22
|
+
Puppet.features.stubs(:external_facts?).returns(:true)
|
23
23
|
# This is needed in order to make sure we pass on windows
|
24
24
|
plugindest = File.expand_path("/tmp/pdest")
|
25
25
|
|
@@ -27,9 +27,14 @@ describe Puppet::Configurer::PluginHandler do
|
|
27
27
|
Puppet[:plugindest] = plugindest
|
28
28
|
Puppet[:pluginsignore] = "pignore"
|
29
29
|
|
30
|
+
Puppet[:pluginfactsource] = "psource"
|
31
|
+
Puppet[:pluginfactdest] = plugindest
|
32
|
+
|
33
|
+
Puppet::Configurer::Downloader.expects(:new).with("pluginfacts", plugindest, "psource", "pignore", "myenv").returns downloader
|
30
34
|
Puppet::Configurer::Downloader.expects(:new).with("plugin", plugindest, "psource", "pignore", "myenv").returns downloader
|
31
35
|
|
32
|
-
downloader.
|
36
|
+
downloader.stubs(:evaluate).returns([])
|
37
|
+
downloader.expects(:evaluate).twice
|
33
38
|
|
34
39
|
@pluginhandler.environment = "myenv"
|
35
40
|
@pluginhandler.download_plugins
|
@@ -110,6 +110,16 @@ describe Puppet::Configurer do
|
|
110
110
|
@agent.run.should == 0
|
111
111
|
end
|
112
112
|
|
113
|
+
it "applies a cached catalog when it can't connect to the master" do
|
114
|
+
error = Errno::ECONNREFUSED.new('Connection refused - connect(2)')
|
115
|
+
|
116
|
+
Puppet::Node.indirection.expects(:find).raises(error)
|
117
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entry(:ignore_cache => true)).raises(error)
|
118
|
+
Puppet::Resource::Catalog.indirection.expects(:find).with(anything, has_entry(:ignore_terminus => true)).returns(@catalog)
|
119
|
+
|
120
|
+
@agent.run.should == 0
|
121
|
+
end
|
122
|
+
|
113
123
|
it "should initialize a transaction report if one is not provided" do
|
114
124
|
report = Puppet::Transaction::Report.new("apply")
|
115
125
|
Puppet::Transaction::Report.expects(:new).returns report
|
@@ -341,12 +351,12 @@ describe Puppet::Configurer do
|
|
341
351
|
@agent.environment.should == "second_env"
|
342
352
|
end
|
343
353
|
|
344
|
-
it "should clear the
|
345
|
-
|
354
|
+
it "should clear the global caches" do
|
355
|
+
$env_module_directories = false
|
346
356
|
|
347
357
|
@agent.run
|
348
358
|
|
349
|
-
|
359
|
+
$env_module_directories.should == nil
|
350
360
|
end
|
351
361
|
|
352
362
|
describe "when not using a REST terminus for catalogs" do
|
@@ -454,7 +464,7 @@ describe Puppet::Configurer do
|
|
454
464
|
|
455
465
|
it "should write the last run file" do
|
456
466
|
@configurer.save_last_run_summary(@report)
|
457
|
-
|
467
|
+
Puppet::FileSystem::File.exist?(Puppet[:lastrunfile]).should be_true
|
458
468
|
end
|
459
469
|
|
460
470
|
it "should write the raw summary as yaml" do
|
@@ -486,7 +496,7 @@ describe Puppet::Configurer do
|
|
486
496
|
require 'puppet/util/windows/security'
|
487
497
|
mode = Puppet::Util::Windows::Security.get_mode(Puppet[:lastrunfile])
|
488
498
|
else
|
489
|
-
mode = File.
|
499
|
+
mode = Puppet::FileSystem::File.new(Puppet[:lastrunfile]).stat.mode
|
490
500
|
end
|
491
501
|
(mode & 0777).should == 0664
|
492
502
|
end
|
@@ -1,20 +1,20 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
require 'puppet/
|
4
|
+
require 'puppet/confine/exists'
|
5
5
|
|
6
|
-
describe Puppet::
|
6
|
+
describe Puppet::Confine::Exists do
|
7
7
|
before do
|
8
|
-
@confine = Puppet::
|
8
|
+
@confine = Puppet::Confine::Exists.new("/my/file")
|
9
9
|
@confine.label = "eh"
|
10
10
|
end
|
11
11
|
|
12
12
|
it "should be named :exists" do
|
13
|
-
Puppet::
|
13
|
+
Puppet::Confine::Exists.name.should == :exists
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should not pass if exists is nil" do
|
17
|
-
confine = Puppet::
|
17
|
+
confine = Puppet::Confine::Exists.new(nil)
|
18
18
|
confine.label = ":exists => nil"
|
19
19
|
confine.expects(:pass?).with(nil)
|
20
20
|
confine.should_not be_valid
|
@@ -30,12 +30,12 @@ describe Puppet::Provider::Confine::Exists do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
it "should return false if the value does not point to a file" do
|
33
|
-
|
33
|
+
Puppet::FileSystem::File.expects(:exist?).with("/my/file").returns false
|
34
34
|
@confine.pass?("/my/file").should be_false
|
35
35
|
end
|
36
36
|
|
37
37
|
it "should return true if the value points to a file" do
|
38
|
-
|
38
|
+
Puppet::FileSystem::File.expects(:exist?).with("/my/file").returns true
|
39
39
|
@confine.pass?("/my/file").should be_true
|
40
40
|
end
|
41
41
|
|
@@ -62,11 +62,11 @@ describe Puppet::Provider::Confine::Exists do
|
|
62
62
|
end
|
63
63
|
|
64
64
|
it "should produce a summary containing all missing files" do
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
Puppet::FileSystem::File.stubs(:exist?).returns true
|
66
|
+
Puppet::FileSystem::File.expects(:exist?).with("/two").returns false
|
67
|
+
Puppet::FileSystem::File.expects(:exist?).with("/four").returns false
|
68
68
|
|
69
|
-
confine = Puppet::
|
69
|
+
confine = Puppet::Confine::Exists.new %w{/one /two /three /four}
|
70
70
|
confine.summary.should == %w{/two /four}
|
71
71
|
end
|
72
72
|
|
@@ -75,6 +75,6 @@ describe Puppet::Provider::Confine::Exists do
|
|
75
75
|
c2 = mock '2', :summary => %w{two}
|
76
76
|
c3 = mock '3', :summary => %w{three}
|
77
77
|
|
78
|
-
Puppet::
|
78
|
+
Puppet::Confine::Exists.summarize([c1, c2, c3]).should == %w{one two three}
|
79
79
|
end
|
80
80
|
end
|
@@ -1,22 +1,22 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
require 'puppet/
|
4
|
+
require 'puppet/confine/false'
|
5
5
|
|
6
|
-
describe Puppet::
|
6
|
+
describe Puppet::Confine::False do
|
7
7
|
it "should be named :false" do
|
8
|
-
Puppet::
|
8
|
+
Puppet::Confine::False.name.should == :false
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should require a value" do
|
12
|
-
lambda { Puppet::
|
12
|
+
lambda { Puppet::Confine.new }.should raise_error(ArgumentError)
|
13
13
|
end
|
14
14
|
|
15
15
|
describe "when testing values" do
|
16
|
-
before { @confine = Puppet::
|
16
|
+
before { @confine = Puppet::Confine::False.new("foo") }
|
17
17
|
|
18
18
|
it "should use the 'pass?' method to test validity" do
|
19
|
-
@confine = Puppet::
|
19
|
+
@confine = Puppet::Confine::False.new("foo")
|
20
20
|
@confine.label = "eh"
|
21
21
|
@confine.expects(:pass?).with("foo")
|
22
22
|
@confine.valid?
|
@@ -31,13 +31,13 @@ describe Puppet::Provider::Confine::False do
|
|
31
31
|
end
|
32
32
|
|
33
33
|
it "should produce a message that a value is true" do
|
34
|
-
@confine = Puppet::
|
34
|
+
@confine = Puppet::Confine::False.new("foo")
|
35
35
|
@confine.message("eh").should be_include("true")
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should be able to produce a summary with the number of incorrectly true values" do
|
40
|
-
confine = Puppet::
|
40
|
+
confine = Puppet::Confine::False.new %w{one two three four}
|
41
41
|
confine.expects(:pass?).times(4).returns(true).returns(false).returns(true).returns(false)
|
42
42
|
confine.summary.should == 2
|
43
43
|
end
|
@@ -47,6 +47,6 @@ describe Puppet::Provider::Confine::False do
|
|
47
47
|
c2 = mock '2', :summary => 2
|
48
48
|
c3 = mock '3', :summary => 3
|
49
49
|
|
50
|
-
Puppet::
|
50
|
+
Puppet::Confine::False.summarize([c1, c2, c3]).should == 6
|
51
51
|
end
|
52
52
|
end
|
@@ -1,24 +1,24 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
require 'puppet/
|
4
|
+
require 'puppet/confine/feature'
|
5
5
|
|
6
|
-
describe Puppet::
|
6
|
+
describe Puppet::Confine::Feature do
|
7
7
|
it "should be named :feature" do
|
8
|
-
Puppet::
|
8
|
+
Puppet::Confine::Feature.name.should == :feature
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should require a value" do
|
12
|
-
lambda { Puppet::
|
12
|
+
lambda { Puppet::Confine::Feature.new }.should raise_error(ArgumentError)
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should always convert values to an array" do
|
16
|
-
Puppet::
|
16
|
+
Puppet::Confine::Feature.new("/some/file").values.should be_instance_of(Array)
|
17
17
|
end
|
18
18
|
|
19
19
|
describe "when testing values" do
|
20
20
|
before do
|
21
|
-
@confine = Puppet::
|
21
|
+
@confine = Puppet::Confine::Feature.new("myfeature")
|
22
22
|
@confine.label = "eh"
|
23
23
|
end
|
24
24
|
|
@@ -44,14 +44,14 @@ describe Puppet::Provider::Confine::Feature do
|
|
44
44
|
|
45
45
|
it "should summarize multiple instances by returning a flattened array of all missing features" do
|
46
46
|
confines = []
|
47
|
-
confines << Puppet::
|
48
|
-
confines << Puppet::
|
49
|
-
confines << Puppet::
|
47
|
+
confines << Puppet::Confine::Feature.new(%w{one two})
|
48
|
+
confines << Puppet::Confine::Feature.new(%w{two})
|
49
|
+
confines << Puppet::Confine::Feature.new(%w{three four})
|
50
50
|
|
51
51
|
features = mock 'feature'
|
52
52
|
features.stub_everything
|
53
53
|
Puppet.stubs(:features).returns features
|
54
54
|
|
55
|
-
Puppet::
|
55
|
+
Puppet::Confine::Feature.summarize(confines).sort.should == %w{one two three four}.sort
|
56
56
|
end
|
57
57
|
end
|
@@ -1,20 +1,20 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
require 'puppet/
|
4
|
+
require 'puppet/confine/true'
|
5
5
|
|
6
|
-
describe Puppet::
|
6
|
+
describe Puppet::Confine::True do
|
7
7
|
it "should be named :true" do
|
8
|
-
Puppet::
|
8
|
+
Puppet::Confine::True.name.should == :true
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should require a value" do
|
12
|
-
lambda { Puppet::
|
12
|
+
lambda { Puppet::Confine::True.new }.should raise_error(ArgumentError)
|
13
13
|
end
|
14
14
|
|
15
15
|
describe "when testing values" do
|
16
16
|
before do
|
17
|
-
@confine = Puppet::
|
17
|
+
@confine = Puppet::Confine::True.new("foo")
|
18
18
|
@confine.label = "eh"
|
19
19
|
end
|
20
20
|
|
@@ -37,7 +37,7 @@ describe Puppet::Provider::Confine::True do
|
|
37
37
|
end
|
38
38
|
|
39
39
|
it "should produce the number of false values when asked for a summary" do
|
40
|
-
@confine = Puppet::
|
40
|
+
@confine = Puppet::Confine::True.new %w{one two three four}
|
41
41
|
@confine.expects(:pass?).times(4).returns(true).returns(false).returns(true).returns(false)
|
42
42
|
@confine.summary.should == 2
|
43
43
|
end
|
@@ -47,6 +47,6 @@ describe Puppet::Provider::Confine::True do
|
|
47
47
|
c2 = mock '2', :summary => 2
|
48
48
|
c3 = mock '3', :summary => 3
|
49
49
|
|
50
|
-
Puppet::
|
50
|
+
Puppet::Confine::True.summarize([c1, c2, c3]).should == 6
|
51
51
|
end
|
52
52
|
end
|
@@ -1,28 +1,28 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
require 'puppet/
|
4
|
+
require 'puppet/confine/variable'
|
5
5
|
|
6
|
-
describe Puppet::
|
6
|
+
describe Puppet::Confine::Variable do
|
7
7
|
it "should be named :variable" do
|
8
|
-
Puppet::
|
8
|
+
Puppet::Confine::Variable.name.should == :variable
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should require a value" do
|
12
|
-
lambda { Puppet::
|
12
|
+
lambda { Puppet::Confine::Variable.new }.should raise_error(ArgumentError)
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should always convert values to an array" do
|
16
|
-
Puppet::
|
16
|
+
Puppet::Confine::Variable.new("/some/file").values.should be_instance_of(Array)
|
17
17
|
end
|
18
18
|
|
19
19
|
it "should have an accessor for its name" do
|
20
|
-
Puppet::
|
20
|
+
Puppet::Confine::Variable.new(:bar).should respond_to(:name)
|
21
21
|
end
|
22
22
|
|
23
23
|
describe "when testing values" do
|
24
24
|
before do
|
25
|
-
@confine = Puppet::
|
25
|
+
@confine = Puppet::Confine::Variable.new("foo")
|
26
26
|
@confine.name = :myvar
|
27
27
|
end
|
28
28
|
|
@@ -63,7 +63,7 @@ describe Puppet::Provider::Confine::Variable do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
it "should produce a message that the fact value is not correct" do
|
66
|
-
@confine = Puppet::
|
66
|
+
@confine = Puppet::Confine::Variable.new(%w{bar bee})
|
67
67
|
@confine.name = "eh"
|
68
68
|
message = @confine.message("value")
|
69
69
|
message.should be_include("facter")
|
@@ -71,7 +71,7 @@ describe Puppet::Provider::Confine::Variable do
|
|
71
71
|
end
|
72
72
|
|
73
73
|
it "should be valid if the test value matches any of the provided values" do
|
74
|
-
@confine = Puppet::
|
74
|
+
@confine = Puppet::Confine::Variable.new(%w{bar bee})
|
75
75
|
@confine.expects(:test_value).returns "bee"
|
76
76
|
@confine.should be_valid
|
77
77
|
end
|
@@ -79,28 +79,28 @@ describe Puppet::Provider::Confine::Variable do
|
|
79
79
|
|
80
80
|
describe "when summarizing multiple instances" do
|
81
81
|
it "should return a hash of failing variables and their values" do
|
82
|
-
c1 = Puppet::
|
82
|
+
c1 = Puppet::Confine::Variable.new("one")
|
83
83
|
c1.name = "uno"
|
84
84
|
c1.expects(:valid?).returns false
|
85
|
-
c2 = Puppet::
|
85
|
+
c2 = Puppet::Confine::Variable.new("two")
|
86
86
|
c2.name = "dos"
|
87
87
|
c2.expects(:valid?).returns true
|
88
|
-
c3 = Puppet::
|
88
|
+
c3 = Puppet::Confine::Variable.new("three")
|
89
89
|
c3.name = "tres"
|
90
90
|
c3.expects(:valid?).returns false
|
91
91
|
|
92
|
-
Puppet::
|
92
|
+
Puppet::Confine::Variable.summarize([c1, c2, c3]).should == {"uno" => %w{one}, "tres" => %w{three}}
|
93
93
|
end
|
94
94
|
|
95
95
|
it "should combine the values of multiple confines with the same fact" do
|
96
|
-
c1 = Puppet::
|
96
|
+
c1 = Puppet::Confine::Variable.new("one")
|
97
97
|
c1.name = "uno"
|
98
98
|
c1.expects(:valid?).returns false
|
99
|
-
c2 = Puppet::
|
99
|
+
c2 = Puppet::Confine::Variable.new("two")
|
100
100
|
c2.name = "uno"
|
101
101
|
c2.expects(:valid?).returns false
|
102
102
|
|
103
|
-
Puppet::
|
103
|
+
Puppet::Confine::Variable.summarize([c1, c2]).should == {"uno" => %w{one two}}
|
104
104
|
end
|
105
105
|
end
|
106
106
|
end
|
@@ -1,72 +1,72 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
2
|
require 'spec_helper'
|
3
3
|
|
4
|
-
require 'puppet/
|
4
|
+
require 'puppet/confine_collection'
|
5
5
|
|
6
|
-
describe Puppet::
|
6
|
+
describe Puppet::ConfineCollection do
|
7
7
|
it "should be able to add confines" do
|
8
|
-
Puppet::
|
8
|
+
Puppet::ConfineCollection.new("label").should respond_to(:confine)
|
9
9
|
end
|
10
10
|
|
11
11
|
it "should require a label at initialization" do
|
12
|
-
lambda { Puppet::
|
12
|
+
lambda { Puppet::ConfineCollection.new }.should raise_error(ArgumentError)
|
13
13
|
end
|
14
14
|
|
15
15
|
it "should make its label available" do
|
16
|
-
Puppet::
|
16
|
+
Puppet::ConfineCollection.new("mylabel").label.should == "mylabel"
|
17
17
|
end
|
18
18
|
|
19
19
|
describe "when creating confine instances" do
|
20
20
|
it "should create an instance of the named test with the provided values" do
|
21
21
|
test_class = mock 'test_class'
|
22
22
|
test_class.expects(:new).with(%w{my values}).returns(stub('confine', :label= => nil))
|
23
|
-
Puppet::
|
23
|
+
Puppet::Confine.expects(:test).with(:foo).returns test_class
|
24
24
|
|
25
|
-
Puppet::
|
25
|
+
Puppet::ConfineCollection.new("label").confine :foo => %w{my values}
|
26
26
|
end
|
27
27
|
|
28
28
|
it "should copy its label to the confine instance" do
|
29
29
|
confine = mock 'confine'
|
30
30
|
test_class = mock 'test_class'
|
31
31
|
test_class.expects(:new).returns confine
|
32
|
-
Puppet::
|
32
|
+
Puppet::Confine.expects(:test).returns test_class
|
33
33
|
|
34
34
|
confine.expects(:label=).with("label")
|
35
35
|
|
36
|
-
Puppet::
|
36
|
+
Puppet::ConfineCollection.new("label").confine :foo => %w{my values}
|
37
37
|
end
|
38
38
|
|
39
39
|
describe "and the test cannot be found" do
|
40
40
|
it "should create a Facter test with the provided values and set the name to the test name" do
|
41
|
-
confine = Puppet::
|
41
|
+
confine = Puppet::Confine.test(:variable).new(%w{my values})
|
42
42
|
confine.expects(:name=).with(:foo)
|
43
43
|
confine.class.expects(:new).with(%w{my values}).returns confine
|
44
|
-
Puppet::
|
44
|
+
Puppet::ConfineCollection.new("label").confine(:foo => %w{my values})
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
describe "and the 'for_binary' option was provided" do
|
49
49
|
it "should mark the test as a binary confine" do
|
50
|
-
confine = Puppet::
|
50
|
+
confine = Puppet::Confine.test(:exists).new(:bar)
|
51
51
|
confine.expects(:for_binary=).with true
|
52
|
-
Puppet::
|
53
|
-
Puppet::
|
52
|
+
Puppet::Confine.test(:exists).expects(:new).with(:bar).returns confine
|
53
|
+
Puppet::ConfineCollection.new("label").confine :exists => :bar, :for_binary => true
|
54
54
|
end
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
58
|
it "should be valid if no confines are present" do
|
59
|
-
Puppet::
|
59
|
+
Puppet::ConfineCollection.new("label").should be_valid
|
60
60
|
end
|
61
61
|
|
62
62
|
it "should be valid if all confines pass" do
|
63
63
|
c1 = stub 'c1', :valid? => true, :label= => nil
|
64
64
|
c2 = stub 'c2', :valid? => true, :label= => nil
|
65
65
|
|
66
|
-
Puppet::
|
67
|
-
Puppet::
|
66
|
+
Puppet::Confine.test(:true).expects(:new).returns(c1)
|
67
|
+
Puppet::Confine.test(:false).expects(:new).returns(c2)
|
68
68
|
|
69
|
-
confiner = Puppet::
|
69
|
+
confiner = Puppet::ConfineCollection.new("label")
|
70
70
|
confiner.confine :true => :bar, :false => :bee
|
71
71
|
|
72
72
|
confiner.should be_valid
|
@@ -76,10 +76,10 @@ describe Puppet::Provider::ConfineCollection do
|
|
76
76
|
c1 = stub 'c1', :valid? => true, :label= => nil
|
77
77
|
c2 = stub 'c2', :valid? => false, :label= => nil
|
78
78
|
|
79
|
-
Puppet::
|
80
|
-
Puppet::
|
79
|
+
Puppet::Confine.test(:true).expects(:new).returns(c1)
|
80
|
+
Puppet::Confine.test(:false).expects(:new).returns(c2)
|
81
81
|
|
82
|
-
confiner = Puppet::
|
82
|
+
confiner = Puppet::ConfineCollection.new("label")
|
83
83
|
confiner.confine :true => :bar, :false => :bee
|
84
84
|
|
85
85
|
confiner.should_not be_valid
|
@@ -87,7 +87,7 @@ describe Puppet::Provider::ConfineCollection do
|
|
87
87
|
|
88
88
|
describe "when providing a summary" do
|
89
89
|
before do
|
90
|
-
@confiner = Puppet::
|
90
|
+
@confiner = Puppet::ConfineCollection.new("label")
|
91
91
|
end
|
92
92
|
|
93
93
|
it "should return a hash" do
|
@@ -100,32 +100,32 @@ describe Puppet::Provider::ConfineCollection do
|
|
100
100
|
|
101
101
|
it "should add each test type's summary to the hash" do
|
102
102
|
@confiner.confine :true => :bar, :false => :bee
|
103
|
-
Puppet::
|
104
|
-
Puppet::
|
103
|
+
Puppet::Confine.test(:true).expects(:summarize).returns :tsumm
|
104
|
+
Puppet::Confine.test(:false).expects(:summarize).returns :fsumm
|
105
105
|
|
106
106
|
@confiner.summary.should == {:true => :tsumm, :false => :fsumm}
|
107
107
|
end
|
108
108
|
|
109
109
|
it "should not include tests that return 0" do
|
110
110
|
@confiner.confine :true => :bar, :false => :bee
|
111
|
-
Puppet::
|
112
|
-
Puppet::
|
111
|
+
Puppet::Confine.test(:true).expects(:summarize).returns 0
|
112
|
+
Puppet::Confine.test(:false).expects(:summarize).returns :fsumm
|
113
113
|
|
114
114
|
@confiner.summary.should == {:false => :fsumm}
|
115
115
|
end
|
116
116
|
|
117
117
|
it "should not include tests that return empty arrays" do
|
118
118
|
@confiner.confine :true => :bar, :false => :bee
|
119
|
-
Puppet::
|
120
|
-
Puppet::
|
119
|
+
Puppet::Confine.test(:true).expects(:summarize).returns []
|
120
|
+
Puppet::Confine.test(:false).expects(:summarize).returns :fsumm
|
121
121
|
|
122
122
|
@confiner.summary.should == {:false => :fsumm}
|
123
123
|
end
|
124
124
|
|
125
125
|
it "should not include tests that return empty hashes" do
|
126
126
|
@confiner.confine :true => :bar, :false => :bee
|
127
|
-
Puppet::
|
128
|
-
Puppet::
|
127
|
+
Puppet::Confine.test(:true).expects(:summarize).returns({})
|
128
|
+
Puppet::Confine.test(:false).expects(:summarize).returns :fsumm
|
129
129
|
|
130
130
|
@confiner.summary.should == {:false => :fsumm}
|
131
131
|
end
|