puppet 2.6.18 → 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +733 -187
- data/LICENSE +13 -13
- data/README.md +5 -9
- data/Rakefile +1 -1
- data/conf/auth.conf +8 -3
- data/conf/redhat/puppet.spec +21 -110
- data/conf/solaris/pkginfo +3 -4
- data/conf/suse/puppet.spec +1 -1
- data/ext/cert_inspector +140 -0
- data/ext/nagios/naggen +12 -5
- data/ext/puppet-test +11 -5
- data/ext/vim/README +1 -2
- data/ext/yaml_nodes.rb +11 -5
- data/install.rb +1 -54
- data/lib/puppet.rb +6 -10
- data/lib/puppet/application.rb +23 -32
- data/lib/puppet/application/agent.rb +228 -7
- data/lib/puppet/application/apply.rb +108 -36
- data/lib/puppet/application/catalog.rb +4 -0
- data/lib/puppet/application/cert.rb +128 -17
- data/lib/puppet/application/certificate.rb +18 -0
- data/lib/puppet/application/certificate_request.rb +4 -0
- data/lib/puppet/application/certificate_revocation_list.rb +4 -0
- data/lib/puppet/application/config.rb +4 -0
- data/lib/puppet/application/describe.rb +53 -0
- data/lib/puppet/application/device.rb +255 -0
- data/lib/puppet/application/doc.rb +92 -6
- data/lib/puppet/application/face_base.rb +246 -0
- data/lib/puppet/application/facts.rb +4 -0
- data/lib/puppet/application/file.rb +4 -0
- data/lib/puppet/application/filebucket.rb +102 -0
- data/lib/puppet/application/help.rb +4 -0
- data/lib/puppet/application/indirection_base.rb +4 -0
- data/lib/puppet/application/inspect.rb +21 -23
- data/lib/puppet/application/key.rb +4 -0
- data/lib/puppet/application/kick.rb +131 -4
- data/lib/puppet/application/man.rb +4 -0
- data/lib/puppet/application/master.rb +108 -40
- data/lib/puppet/application/node.rb +4 -0
- data/lib/puppet/application/parser.rb +5 -0
- data/lib/puppet/application/plugin.rb +3 -0
- data/lib/puppet/application/queue.rb +75 -13
- data/lib/puppet/application/report.rb +4 -0
- data/lib/puppet/application/resource.rb +115 -23
- data/lib/puppet/application/resource_type.rb +4 -0
- data/lib/puppet/application/secret_agent.rb +6 -0
- data/lib/puppet/application/status.rb +4 -0
- data/lib/puppet/configurer.rb +57 -61
- data/lib/puppet/configurer/fact_handler.rb +1 -6
- data/lib/puppet/daemon.rb +2 -2
- data/lib/puppet/defaults.rb +30 -88
- data/lib/puppet/dsl/resource_type_api.rb +19 -31
- data/lib/puppet/external/nagios/parser.rb +1 -1
- data/lib/puppet/face.rb +12 -0
- data/lib/puppet/face/catalog.rb +130 -0
- data/lib/puppet/face/catalog/select.rb +49 -0
- data/lib/puppet/face/certificate.rb +115 -0
- data/lib/puppet/face/certificate_request.rb +55 -0
- data/lib/puppet/face/certificate_revocation_list.rb +60 -0
- data/lib/puppet/face/config.rb +45 -0
- data/lib/puppet/face/facts.rb +81 -0
- data/lib/puppet/face/file.rb +47 -0
- data/lib/puppet/face/file/download.rb +54 -0
- data/lib/puppet/face/file/store.rb +21 -0
- data/lib/puppet/face/help.rb +131 -0
- data/lib/puppet/face/help/action.erb +53 -0
- data/lib/puppet/face/help/face.erb +79 -0
- data/lib/puppet/face/help/global.erb +19 -0
- data/lib/puppet/face/help/man.erb +136 -0
- data/lib/puppet/face/key.rb +15 -0
- data/lib/puppet/face/man.rb +93 -0
- data/lib/puppet/face/node.rb +43 -0
- data/lib/puppet/face/parser.rb +42 -0
- data/lib/puppet/face/plugin.rb +55 -0
- data/lib/puppet/face/report.rb +56 -0
- data/lib/puppet/face/resource.rb +53 -0
- data/lib/puppet/face/resource_type.rb +81 -0
- data/lib/puppet/face/secret_agent.rb +54 -0
- data/lib/puppet/face/status.rb +52 -0
- data/lib/puppet/feature/ssh.rb +4 -0
- data/lib/puppet/file_bucket/dipper.rb +3 -3
- data/lib/puppet/file_bucket/file.rb +6 -5
- data/lib/puppet/file_bucket/file/indirection_hooks.rb +9 -0
- data/lib/puppet/file_serving/configuration.rb +1 -2
- data/lib/puppet/file_serving/content.rb +2 -1
- data/lib/puppet/file_serving/{terminus_selector.rb → indirection_hooks.rb} +3 -2
- data/lib/puppet/file_serving/metadata.rb +2 -1
- data/lib/puppet/file_serving/mount/modules.rb +5 -4
- data/lib/puppet/indirector.rb +16 -43
- data/lib/puppet/indirector/catalog/active_record.rb +1 -1
- data/lib/puppet/indirector/catalog/compiler.rb +5 -15
- data/lib/puppet/indirector/catalog/static_compiler.rb +137 -0
- data/lib/puppet/indirector/certificate_request/ca.rb +8 -0
- data/lib/puppet/indirector/certificate_status.rb +4 -0
- data/lib/puppet/indirector/certificate_status/file.rb +82 -0
- data/lib/puppet/indirector/certificate_status/rest.rb +10 -0
- data/lib/puppet/indirector/couch.rb +5 -3
- data/lib/puppet/indirector/exec.rb +3 -3
- data/lib/puppet/indirector/face.rb +127 -0
- data/lib/puppet/indirector/facts/network_device.rb +25 -0
- data/lib/puppet/indirector/file.rb +79 -0
- data/lib/puppet/indirector/file_bucket_file/file.rb +0 -4
- data/lib/puppet/indirector/indirection.rb +1 -2
- data/lib/puppet/indirector/inventory/yaml.rb +81 -0
- data/lib/puppet/indirector/report/processor.rb +0 -2
- data/lib/puppet/indirector/request.rb +0 -4
- data/lib/puppet/indirector/resource/ral.rb +0 -4
- data/lib/puppet/indirector/resource_type/parser.rb +19 -3
- data/lib/puppet/indirector/rest.rb +11 -5
- data/lib/puppet/indirector/run/local.rb +0 -4
- data/lib/puppet/indirector/ssl_file.rb +1 -5
- data/lib/puppet/indirector/terminus.rb +3 -26
- data/lib/puppet/indirector/yaml.rb +0 -5
- data/lib/puppet/interface.rb +156 -0
- data/lib/puppet/interface/action.rb +284 -0
- data/lib/puppet/interface/action_builder.rb +74 -0
- data/lib/puppet/interface/action_manager.rb +70 -0
- data/lib/puppet/interface/documentation.rb +230 -0
- data/lib/puppet/interface/face_collection.rb +137 -0
- data/lib/puppet/interface/option.rb +108 -0
- data/lib/puppet/interface/option_builder.rb +54 -0
- data/lib/puppet/interface/option_manager.rb +67 -0
- data/lib/puppet/metatype/manager.rb +20 -7
- data/lib/puppet/module.rb +1 -1
- data/lib/puppet/network/client.rb +179 -0
- data/lib/puppet/network/client/ca.rb +56 -0
- data/lib/puppet/network/client/file.rb +6 -0
- data/lib/puppet/network/client/proxy.rb +27 -0
- data/lib/puppet/network/client/report.rb +26 -0
- data/lib/puppet/network/client/runner.rb +10 -0
- data/lib/puppet/network/client/status.rb +4 -0
- data/lib/puppet/network/format.rb +1 -1
- data/lib/puppet/network/formats.rb +63 -0
- data/lib/puppet/network/handler/ca.rb +106 -16
- data/lib/puppet/network/handler/filebucket.rb +2 -4
- data/lib/puppet/network/handler/fileserver.rb +3 -2
- data/lib/puppet/network/handler/master.rb +5 -3
- data/lib/puppet/network/handler/report.rb +0 -2
- data/lib/puppet/network/handler/runner.rb +0 -2
- data/lib/puppet/network/handler/status.rb +0 -2
- data/lib/puppet/network/http/api/v1.rb +11 -3
- data/lib/puppet/network/http/handler.rb +26 -35
- data/lib/puppet/network/http/rack/rest.rb +2 -7
- data/lib/puppet/network/http/webrick.rb +1 -2
- data/lib/puppet/network/http_pool.rb +8 -17
- data/lib/puppet/network/http_server/mongrel.rb +1 -0
- data/lib/puppet/network/http_server/webrick.rb +155 -0
- data/lib/puppet/network/rest_authconfig.rb +4 -3
- data/lib/puppet/network/rest_authorization.rb +2 -2
- data/lib/puppet/network/rights.rb +4 -9
- data/lib/puppet/network/server.rb +1 -1
- data/lib/puppet/network/xmlrpc/client.rb +211 -0
- data/lib/puppet/node.rb +2 -1
- data/lib/puppet/node/environment.rb +30 -3
- data/lib/puppet/node/facts.rb +15 -15
- data/lib/puppet/node/inventory.rb +7 -0
- data/lib/puppet/parser/ast.rb +6 -2
- data/lib/puppet/parser/ast/astarray.rb +12 -23
- data/lib/puppet/parser/ast/caseopt.rb +12 -24
- data/lib/puppet/parser/ast/definition.rb +17 -0
- data/lib/puppet/parser/ast/hostclass.rb +29 -0
- data/lib/puppet/parser/ast/leaf.rb +2 -2
- data/lib/puppet/parser/ast/node.rb +20 -0
- data/lib/puppet/parser/ast/resource.rb +42 -50
- data/lib/puppet/parser/ast/resource_instance.rb +9 -0
- data/lib/puppet/parser/ast/resource_override.rb +2 -3
- data/lib/puppet/parser/ast/resource_reference.rb +1 -1
- data/lib/puppet/parser/ast/top_level_construct.rb +4 -0
- data/lib/puppet/parser/ast/vardef.rb +1 -1
- data/lib/puppet/parser/compiler.rb +16 -17
- data/lib/puppet/parser/functions/create_resources.rb +47 -0
- data/lib/puppet/parser/functions/extlookup.rb +2 -7
- data/lib/puppet/parser/functions/fqdn_rand.rb +2 -2
- data/lib/puppet/parser/functions/sha1.rb +1 -1
- data/lib/puppet/parser/grammar.ra +67 -144
- data/lib/puppet/parser/lexer.rb +1 -1
- data/lib/puppet/parser/parser.rb +1190 -1262
- data/lib/puppet/parser/parser_support.rb +48 -73
- data/lib/puppet/parser/resource.rb +2 -19
- data/lib/puppet/parser/scope.rb +33 -103
- data/lib/puppet/parser/templatewrapper.rb +21 -22
- data/lib/puppet/parser/type_loader.rb +60 -35
- data/lib/puppet/provider/aixobject.rb +393 -0
- data/lib/puppet/provider/augeas/augeas.rb +37 -15
- data/lib/puppet/provider/cisco.rb +9 -0
- data/lib/puppet/provider/cron/crontab.rb +1 -7
- data/lib/puppet/provider/exec/posix.rb +3 -6
- data/lib/puppet/provider/exec/shell.rb +2 -11
- data/lib/puppet/provider/file/posix.rb +1 -1
- data/lib/puppet/provider/file/win32.rb +1 -1
- data/lib/puppet/provider/group/aix.rb +141 -0
- data/lib/puppet/provider/group/directoryservice.rb +0 -14
- data/lib/puppet/provider/host/parsed.rb +23 -55
- data/lib/puppet/provider/interface/base.rb +0 -0
- data/lib/puppet/provider/interface/cisco.rb +27 -0
- data/lib/puppet/provider/mcx/mcxcontent.rb +57 -96
- data/lib/puppet/provider/mount/parsed.rb +1 -1
- data/lib/puppet/provider/naginator.rb +1 -9
- data/lib/puppet/provider/nameservice/directoryservice.rb +41 -26
- data/lib/puppet/provider/network_device.rb +68 -0
- data/lib/puppet/provider/package/appdmg.rb +13 -13
- data/lib/puppet/provider/package/aptitude.rb +0 -1
- data/lib/puppet/provider/package/pip.rb +109 -0
- data/lib/puppet/provider/package/pkgdmg.rb +24 -32
- data/lib/puppet/provider/package/pkgutil.rb +175 -0
- data/lib/puppet/provider/package/yum.rb +8 -1
- data/lib/puppet/provider/service/daemontools.rb +1 -1
- data/lib/puppet/provider/service/launchd.rb +1 -1
- data/lib/puppet/provider/service/smf.rb +3 -3
- data/lib/puppet/provider/service/upstart.rb +73 -0
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +9 -10
- data/lib/puppet/provider/user/aix.rb +353 -0
- data/lib/puppet/provider/user/directoryservice.rb +0 -14
- data/lib/puppet/provider/user/user_role_add.rb +17 -32
- data/lib/puppet/provider/vlan/cisco.rb +28 -0
- data/lib/puppet/provider/zfs/solaris.rb +1 -1
- data/lib/puppet/provider/zone/solaris.rb +3 -0
- data/lib/puppet/provider/zpool/solaris.rb +7 -5
- data/lib/puppet/rails.rb +1 -1
- data/lib/puppet/rails/benchmark.rb +1 -1
- data/lib/puppet/rails/fact_name.rb +1 -0
- data/lib/puppet/rails/host.rb +0 -7
- data/lib/puppet/reference/configuration.rb +26 -101
- data/lib/puppet/reports/store.rb +3 -7
- data/lib/puppet/resource.rb +1 -1
- data/lib/puppet/resource/catalog.rb +86 -36
- data/lib/puppet/resource/type.rb +10 -15
- data/lib/puppet/resource/type_collection.rb +55 -63
- data/lib/puppet/simple_graph.rb +370 -269
- data/lib/puppet/ssl/base.rb +0 -8
- data/lib/puppet/ssl/certificate.rb +0 -6
- data/lib/puppet/ssl/certificate_authority.rb +24 -109
- data/lib/puppet/ssl/certificate_authority/interface.rb +19 -66
- data/lib/puppet/ssl/certificate_factory.rb +91 -112
- data/lib/puppet/ssl/certificate_request.rb +15 -98
- data/lib/puppet/ssl/certificate_revocation_list.rb +1 -1
- data/lib/puppet/ssl/host.rb +85 -51
- data/lib/puppet/ssl/inventory.rb +1 -1
- data/lib/puppet/sslcertificates.rb +146 -0
- data/lib/puppet/sslcertificates/ca.rb +375 -0
- data/lib/puppet/sslcertificates/certificate.rb +255 -0
- data/lib/puppet/sslcertificates/inventory.rb +38 -0
- data/lib/puppet/sslcertificates/support.rb +146 -0
- data/lib/puppet/status.rb +1 -1
- data/lib/puppet/transaction.rb +163 -94
- data/lib/puppet/transaction/event.rb +1 -1
- data/lib/puppet/transaction/event_manager.rb +19 -3
- data/lib/puppet/transaction/report.rb +9 -3
- data/lib/puppet/type.rb +107 -62
- data/lib/puppet/type/augeas.rb +10 -14
- data/lib/puppet/type/cron.rb +13 -14
- data/lib/puppet/type/exec.rb +0 -9
- data/lib/puppet/type/file.rb +20 -29
- data/lib/puppet/type/file/ctime.rb +1 -1
- data/lib/puppet/type/file/ensure.rb +1 -1
- data/lib/puppet/type/file/group.rb +1 -1
- data/lib/puppet/type/file/mode.rb +1 -1
- data/lib/puppet/type/file/mtime.rb +1 -1
- data/lib/puppet/type/file/selcontext.rb +1 -1
- data/lib/puppet/type/file/source.rb +3 -3
- data/lib/puppet/type/file/type.rb +1 -1
- data/lib/puppet/type/group.rb +36 -0
- data/lib/puppet/type/host.rb +18 -43
- data/lib/puppet/type/interface.rb +109 -0
- data/lib/puppet/type/k5login.rb +1 -4
- data/lib/puppet/type/macauthorization.rb +3 -3
- data/lib/puppet/type/mcx.rb +2 -21
- data/lib/puppet/type/router.rb +14 -0
- data/lib/puppet/type/schedule.rb +2 -0
- data/lib/puppet/type/service.rb +2 -0
- data/lib/puppet/type/sshkey.rb +6 -1
- data/lib/puppet/type/tidy.rb +12 -12
- data/lib/puppet/type/user.rb +36 -9
- data/lib/puppet/type/vlan.rb +26 -0
- data/lib/puppet/type/whit.rb +13 -1
- data/lib/puppet/type/zfs.rb +100 -8
- data/lib/puppet/type/zone.rb +45 -1
- data/lib/puppet/type/zpool.rb +1 -0
- data/lib/puppet/util.rb +63 -91
- data/lib/puppet/util/autoload.rb +16 -14
- data/lib/puppet/util/classgen.rb +13 -1
- data/lib/puppet/util/command_line.rb +109 -22
- data/lib/puppet/util/log.rb +1 -0
- data/lib/puppet/util/log/destinations.rb +16 -4
- data/lib/puppet/util/logging.rb +11 -0
- data/lib/puppet/util/monkey_patches.rb +7 -77
- data/lib/puppet/util/network_device.rb +17 -0
- data/lib/puppet/util/network_device/base.rb +27 -0
- data/lib/puppet/util/network_device/cisco.rb +4 -0
- data/lib/puppet/util/network_device/cisco/device.rb +256 -0
- data/lib/puppet/util/network_device/cisco/facts.rb +72 -0
- data/lib/puppet/util/network_device/cisco/interface.rb +82 -0
- data/lib/puppet/util/network_device/config.rb +93 -0
- data/lib/puppet/util/network_device/ipcalc.rb +68 -0
- data/lib/puppet/util/network_device/transport.rb +3 -0
- data/lib/puppet/util/network_device/transport/base.rb +26 -0
- data/lib/puppet/util/network_device/transport/ssh.rb +121 -0
- data/lib/puppet/util/network_device/transport/telnet.rb +42 -0
- data/lib/puppet/util/rdoc.rb +4 -10
- data/lib/puppet/util/rdoc/parser.rb +34 -23
- data/lib/puppet/util/reference.rb +7 -8
- data/lib/puppet/util/selinux.rb +2 -2
- data/lib/puppet/util/settings.rb +1 -6
- data/lib/puppet/util/settings/file_setting.rb +0 -1
- data/lib/puppet/util/suidmanager.rb +30 -79
- data/lib/puppet/util/zaml.rb +41 -40
- data/man/man5/puppet.conf.5 +291 -873
- data/man/man8/filebucket.8 +47 -71
- data/man/man8/pi.8 +44 -10
- data/man/man8/puppet-agent.8 +154 -0
- data/man/man8/puppet-apply.8 +75 -0
- data/man/man8/puppet-catalog.8 +286 -0
- data/man/man8/puppet-cert.8 +97 -0
- data/man/man8/puppet-certificate.8 +229 -0
- data/man/man8/puppet-certificate_request.8 +168 -0
- data/man/man8/puppet-certificate_revocation_list.8 +165 -0
- data/man/man8/puppet-config.8 +80 -0
- data/man/man8/puppet-describe.8 +51 -0
- data/man/man8/puppet-device.8 +86 -0
- data/man/man8/puppet-doc.8 +101 -0
- data/man/man8/puppet-facts.8 +217 -0
- data/man/man8/puppet-file.8 +225 -0
- data/man/man8/puppet-filebucket.8 +81 -0
- data/man/man8/puppet-help.8 +71 -0
- data/man/man8/puppet-inspect.8 +28 -0
- data/man/man8/puppet-key.8 +126 -0
- data/man/man8/puppet-kick.8 +95 -0
- data/man/man8/puppet-man.8 +74 -0
- data/man/man8/puppet-master.8 +74 -0
- data/man/man8/puppet-node.8 +171 -0
- data/man/man8/puppet-parser.8 +71 -0
- data/man/man8/puppet-plugin.8 +77 -0
- data/man/man8/puppet-queue.8 +55 -0
- data/man/man8/puppet-report.8 +187 -0
- data/man/man8/puppet-resource.8 +84 -0
- data/man/man8/puppet-resource_type.8 +214 -0
- data/man/man8/puppet-secret_agent.8 +74 -0
- data/man/man8/puppet-status.8 +150 -0
- data/man/man8/puppet.8 +2 -2
- data/man/man8/puppetca.8 +64 -136
- data/man/man8/puppetd.8 +99 -228
- data/man/man8/puppetdoc.8 +41 -48
- data/man/man8/puppetmasterd.8 +54 -32
- data/man/man8/puppetqd.8 +45 -10
- data/man/man8/puppetrun.8 +56 -134
- data/man/man8/ralsh.8 +48 -49
- data/spec/fixtures/faulty_face/puppet/face/syntax.rb +8 -0
- data/spec/fixtures/integration/provider/mailalias/aliases/test1 +28 -0
- data/spec/fixtures/unit/parser/lexer/aliastest.pp +16 -0
- data/spec/fixtures/unit/parser/lexer/append.pp +11 -0
- data/spec/fixtures/unit/parser/lexer/argumentdefaults.pp +14 -0
- data/spec/fixtures/unit/parser/lexer/arithmetic_expression.pp +8 -0
- data/spec/fixtures/unit/parser/lexer/arraytrailingcomma.pp +3 -0
- data/spec/fixtures/unit/parser/lexer/casestatement.pp +65 -0
- data/spec/fixtures/unit/parser/lexer/classheirarchy.pp +15 -0
- data/spec/fixtures/unit/parser/lexer/classincludes.pp +17 -0
- data/spec/fixtures/unit/parser/lexer/classpathtest.pp +11 -0
- data/spec/fixtures/unit/parser/lexer/collection.pp +10 -0
- data/spec/fixtures/unit/parser/lexer/collection_override.pp +8 -0
- data/spec/fixtures/unit/parser/lexer/collection_within_virtual_definitions.pp +20 -0
- data/spec/fixtures/unit/parser/lexer/componentmetaparams.pp +11 -0
- data/spec/fixtures/unit/parser/lexer/componentrequire.pp +8 -0
- data/spec/fixtures/unit/parser/lexer/deepclassheirarchy.pp +23 -0
- data/spec/fixtures/unit/parser/lexer/defineoverrides.pp +17 -0
- data/spec/fixtures/unit/parser/lexer/emptyclass.pp +9 -0
- data/spec/fixtures/unit/parser/lexer/emptyexec.pp +3 -0
- data/spec/fixtures/unit/parser/lexer/emptyifelse.pp +9 -0
- data/spec/fixtures/unit/parser/lexer/falsevalues.pp +3 -0
- data/spec/fixtures/unit/parser/lexer/filecreate.pp +11 -0
- data/spec/fixtures/unit/parser/lexer/fqdefinition.pp +5 -0
- data/spec/fixtures/unit/parser/lexer/fqparents.pp +11 -0
- data/spec/fixtures/unit/parser/lexer/funccomma.pp +5 -0
- data/spec/fixtures/unit/parser/lexer/hash.pp +33 -0
- data/spec/fixtures/unit/parser/lexer/ifexpression.pp +12 -0
- data/spec/fixtures/unit/parser/lexer/implicititeration.pp +15 -0
- data/spec/fixtures/unit/parser/lexer/multilinecomments.pp +10 -0
- data/spec/fixtures/unit/parser/lexer/multipleclass.pp +9 -0
- data/spec/fixtures/unit/parser/lexer/multipleinstances.pp +7 -0
- data/spec/fixtures/unit/parser/lexer/multisubs.pp +13 -0
- data/spec/fixtures/unit/parser/lexer/namevartest.pp +9 -0
- data/spec/fixtures/unit/parser/lexer/scopetest.pp +13 -0
- data/spec/fixtures/unit/parser/lexer/selectorvalues.pp +49 -0
- data/spec/fixtures/unit/parser/lexer/simpledefaults.pp +5 -0
- data/spec/fixtures/unit/parser/lexer/simpleselector.pp +38 -0
- data/spec/fixtures/unit/parser/lexer/singleary.pp +19 -0
- data/spec/fixtures/unit/parser/lexer/singlequote.pp +11 -0
- data/spec/fixtures/unit/parser/lexer/singleselector.pp +22 -0
- data/spec/fixtures/unit/parser/lexer/subclass_name_duplication.pp +11 -0
- data/spec/fixtures/unit/parser/lexer/tag.pp +9 -0
- data/spec/fixtures/unit/parser/lexer/tagged.pp +35 -0
- data/spec/fixtures/unit/parser/lexer/virtualresources.pp +14 -0
- data/spec/fixtures/unit/provider/host/parsed/valid_hosts +19 -0
- data/spec/fixtures/unit/provider/mount/parsed/aix.filesystems +144 -0
- data/spec/fixtures/unit/provider/mount/parsed/aix.mount +7 -0
- data/spec/fixtures/unit/provider/mount/parsed/darwin.mount +6 -0
- data/spec/fixtures/unit/provider/mount/parsed/freebsd.fstab +8 -0
- data/spec/fixtures/unit/provider/mount/parsed/freebsd.mount +3 -0
- data/spec/fixtures/unit/provider/mount/parsed/hpux.mount +17 -0
- data/spec/fixtures/unit/provider/mount/parsed/linux.fstab +11 -0
- data/spec/fixtures/unit/provider/mount/parsed/linux.mount +5 -0
- data/spec/fixtures/unit/provider/mount/parsed/netbsd.fstab +9 -0
- data/spec/fixtures/unit/provider/mount/parsed/netbsd.mount +8 -0
- data/spec/fixtures/unit/provider/mount/parsed/openbsd.fstab +4 -0
- data/spec/fixtures/unit/provider/mount/parsed/openbsd.mount +4 -0
- data/spec/fixtures/unit/provider/mount/parsed/solaris.fstab +11 -0
- data/spec/fixtures/unit/provider/mount/parsed/solaris.mount +6 -0
- data/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys +7 -0
- data/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys1 +3 -0
- data/spec/fixtures/unit/provider/ssh_authorized_key/parsed/authorized_keys2 +1 -0
- data/spec/fixtures/unit/reports/tagmail/tagmail_failers.conf +3 -0
- data/spec/fixtures/unit/reports/tagmail/tagmail_passers.conf +30 -0
- data/spec/fixtures/unit/util/rdoc/basic.pp +16 -0
- data/spec/integration/application/apply_spec.rb +2 -5
- data/spec/integration/application/doc_spec.rb +5 -6
- data/spec/integration/configurer_spec.rb +10 -6
- data/spec/integration/defaults_spec.rb +18 -52
- data/spec/integration/faces/documentation_spec.rb +55 -0
- data/spec/integration/file_serving/content_spec.rb +10 -3
- data/spec/integration/file_serving/fileset_spec.rb +2 -3
- data/spec/integration/file_serving/metadata_spec.rb +10 -3
- data/spec/integration/file_serving/terminus_helper_spec.rb +2 -3
- data/spec/integration/indirector/catalog/compiler_spec.rb +7 -12
- data/spec/integration/indirector/catalog/queue_spec.rb +3 -4
- data/spec/integration/indirector/direct_file_server_spec.rb +2 -2
- data/spec/integration/indirector/file_content/file_server_spec.rb +7 -7
- data/spec/integration/indirector/file_metadata/file_server_spec.rb +2 -2
- data/spec/integration/indirector/node/ldap_spec.rb +3 -4
- data/spec/integration/network/client_spec.rb +18 -0
- data/spec/integration/network/formats_spec.rb +3 -4
- data/spec/integration/network/handler_spec.rb +3 -4
- data/spec/integration/network/server/mongrel_spec.rb +3 -4
- data/spec/integration/network/server/webrick_spec.rb +4 -4
- data/spec/integration/node/environment_spec.rb +2 -3
- data/spec/integration/node/facts_spec.rb +6 -6
- data/spec/integration/node_spec.rb +16 -16
- data/spec/integration/parser/collector_spec.rb +3 -4
- data/spec/integration/parser/compiler_spec.rb +43 -3
- data/spec/integration/parser/functions/require_spec.rb +2 -3
- data/spec/integration/parser/functions_spec.rb +3 -4
- data/spec/integration/parser/parser_spec.rb +7 -6
- data/spec/integration/parser/ruby_manifest_spec.rb +2 -3
- data/spec/integration/provider/mailalias/aliases_spec.rb +5 -19
- data/spec/integration/provider/mount_spec.rb +2 -2
- data/spec/integration/provider/package_spec.rb +3 -4
- data/spec/integration/provider/service/init_spec.rb +4 -6
- data/spec/integration/reference/providers_spec.rb +2 -3
- data/spec/integration/reports_spec.rb +2 -2
- data/spec/integration/resource/catalog_spec.rb +6 -7
- data/spec/integration/resource/type_collection_spec.rb +2 -3
- data/spec/integration/ssl/certificate_authority_spec.rb +7 -7
- data/spec/integration/ssl/certificate_request_spec.rb +7 -7
- data/spec/integration/ssl/certificate_revocation_list_spec.rb +2 -2
- data/spec/integration/ssl/host_spec.rb +4 -4
- data/spec/integration/transaction/report_spec.rb +3 -3
- data/spec/integration/transaction_spec.rb +61 -6
- data/spec/integration/type/file_spec.rb +10 -8
- data/spec/integration/type/package_spec.rb +2 -3
- data/spec/integration/type/tidy_spec.rb +2 -3
- data/spec/integration/type_spec.rb +2 -14
- data/spec/integration/util/autoload_spec.rb +2 -3
- data/spec/integration/util/feature_spec.rb +2 -3
- data/spec/integration/util/file_locking_spec.rb +3 -4
- data/spec/integration/util/rdoc/parser_spec.rb +3 -4
- data/spec/integration/util/settings_spec.rb +2 -3
- data/spec/lib/matchers/json.rb +111 -0
- data/spec/lib/puppet/face/basetest.rb +46 -0
- data/spec/lib/puppet/face/huzzah.rb +7 -0
- data/spec/lib/puppet/face/version_matching.rb +12 -0
- data/spec/lib/puppet_spec/files.rb +38 -5
- data/spec/lib/puppet_spec/fixtures.rb +28 -0
- data/spec/lib/puppet_spec/matchers.rb +87 -0
- data/spec/lib/puppet_spec/verbose.rb +0 -0
- data/spec/monkey_patches/alias_should_to_must.rb +0 -0
- data/spec/monkey_patches/publicize_methods.rb +0 -0
- data/spec/shared_behaviours/all_parsedfile_providers.rb +21 -0
- data/spec/shared_behaviours/an_indirector_face.rb +6 -0
- data/spec/shared_behaviours/documentation_on_faces.rb +263 -0
- data/spec/shared_behaviours/file_server_terminus.rb +1 -1
- data/spec/shared_behaviours/file_serving.rb +61 -70
- data/spec/shared_behaviours/memory_terminus.rb +0 -0
- data/spec/shared_behaviours/path_parameters.rb +0 -0
- data/spec/shared_behaviours/things_that_declare_options.rb +150 -0
- data/spec/spec.opts +0 -2
- data/spec/spec_helper.rb +33 -75
- data/spec/unit/agent/locker_spec.rb +2 -3
- data/spec/unit/agent_spec.rb +2 -2
- data/spec/unit/application/agent_spec.rb +51 -76
- data/spec/unit/application/apply_spec.rb +86 -150
- data/spec/unit/application/cert_spec.rb +8 -30
- data/spec/unit/application/certificate_spec.rb +20 -0
- data/spec/unit/application/config_spec.rb +9 -0
- data/spec/unit/application/describe_spec.rb +2 -3
- data/spec/unit/application/device_spec.rb +342 -0
- data/spec/unit/application/doc_spec.rb +11 -18
- data/spec/unit/application/face_base_spec.rb +360 -0
- data/spec/unit/application/facts_spec.rb +27 -0
- data/spec/unit/application/filebucket_spec.rb +7 -18
- data/spec/unit/application/indirection_base_spec.rb +42 -0
- data/spec/unit/application/inspect_spec.rb +7 -13
- data/spec/unit/application/kick_spec.rb +15 -38
- data/spec/unit/application/master_spec.rb +25 -81
- data/spec/unit/application/queue_spec.rb +12 -22
- data/spec/unit/application/resource_spec.rb +19 -53
- data/spec/unit/application/secret_agent_spec.rb +32 -0
- data/spec/unit/application_spec.rb +65 -34
- data/spec/unit/configurer/downloader_spec.rb +2 -3
- data/spec/unit/configurer/fact_handler_spec.rb +39 -46
- data/spec/unit/configurer/plugin_handler_spec.rb +2 -3
- data/spec/unit/configurer_spec.rb +329 -411
- data/spec/unit/daemon_spec.rb +7 -14
- data/spec/unit/dsl/resource_api_spec.rb +2 -3
- data/spec/unit/dsl/resource_type_api_spec.rb +24 -37
- data/spec/unit/face/catalog_spec.rb +7 -0
- data/spec/unit/face/certificate_request_spec.rb +7 -0
- data/spec/unit/face/certificate_revocation_list_spec.rb +7 -0
- data/spec/unit/face/certificate_spec.rb +23 -0
- data/spec/unit/face/config_spec.rb +24 -0
- data/spec/unit/face/facts_spec.rb +23 -0
- data/spec/unit/face/file_spec.rb +12 -0
- data/spec/unit/face/help_spec.rb +129 -0
- data/spec/unit/face/key_spec.rb +7 -0
- data/spec/unit/face/node_spec.rb +7 -0
- data/spec/unit/face/plugin_spec.rb +10 -0
- data/spec/unit/face/report_spec.rb +7 -0
- data/spec/unit/face/resource_spec.rb +7 -0
- data/spec/unit/face/resource_type_spec.rb +7 -0
- data/spec/unit/face/secret_agent_spec.rb +25 -0
- data/spec/unit/face_spec.rb +1 -0
- data/spec/unit/file_bucket/dipper_spec.rb +7 -8
- data/spec/unit/file_bucket/file_spec.rb +7 -16
- data/spec/unit/file_collection/lookup_spec.rb +2 -3
- data/spec/unit/file_collection_spec.rb +2 -3
- data/spec/unit/file_serving/base_spec.rb +2 -3
- data/spec/unit/file_serving/configuration/parser_spec.rb +2 -3
- data/spec/unit/file_serving/configuration_spec.rb +31 -40
- data/spec/unit/file_serving/content_spec.rb +6 -3
- data/spec/unit/file_serving/fileset_spec.rb +2 -3
- data/spec/unit/file_serving/{terminus_selector_spec.rb → indirection_hooks_spec.rb} +14 -13
- data/spec/unit/file_serving/metadata_spec.rb +6 -3
- data/spec/unit/file_serving/mount/file_spec.rb +2 -3
- data/spec/unit/file_serving/mount/modules_spec.rb +2 -11
- data/spec/unit/file_serving/mount/plugins_spec.rb +2 -3
- data/spec/unit/file_serving/mount_spec.rb +2 -3
- data/spec/unit/file_serving/terminus_helper_spec.rb +2 -2
- data/spec/unit/indirector/active_record_spec.rb +5 -7
- data/spec/unit/indirector/catalog/active_record_spec.rb +2 -3
- data/spec/unit/indirector/catalog/compiler_spec.rb +30 -50
- data/spec/unit/indirector/catalog/queue_spec.rb +2 -3
- data/spec/unit/indirector/catalog/rest_spec.rb +2 -3
- data/spec/unit/indirector/catalog/yaml_spec.rb +2 -3
- data/spec/unit/indirector/certificate/ca_spec.rb +2 -2
- data/spec/unit/indirector/certificate/file_spec.rb +2 -2
- data/spec/unit/indirector/certificate/rest_spec.rb +2 -3
- data/spec/unit/indirector/certificate_request/ca_spec.rb +47 -2
- data/spec/unit/indirector/certificate_request/file_spec.rb +2 -2
- data/spec/unit/indirector/certificate_request/rest_spec.rb +2 -3
- data/spec/unit/indirector/certificate_revocation_list/ca_spec.rb +2 -2
- data/spec/unit/indirector/certificate_revocation_list/file_spec.rb +2 -2
- data/spec/unit/indirector/certificate_revocation_list/rest_spec.rb +2 -3
- data/spec/unit/indirector/certificate_status/file_spec.rb +187 -0
- data/spec/unit/indirector/certificate_status/rest_spec.rb +14 -0
- data/spec/unit/indirector/code_spec.rb +6 -8
- data/spec/unit/indirector/direct_file_server_spec.rb +6 -7
- data/spec/unit/indirector/envelope_spec.rb +2 -3
- data/spec/unit/indirector/exec_spec.rb +12 -13
- data/spec/unit/indirector/face_spec.rb +68 -0
- data/spec/unit/indirector/facts/active_record_spec.rb +2 -3
- data/spec/unit/indirector/facts/couch_spec.rb +71 -66
- data/spec/unit/indirector/facts/facter_spec.rb +2 -2
- data/spec/unit/indirector/facts/inventory_active_record_spec.rb +20 -20
- data/spec/unit/indirector/facts/network_device_spec.rb +89 -0
- data/spec/unit/indirector/facts/rest_spec.rb +2 -3
- data/spec/unit/indirector/facts/yaml_spec.rb +2 -3
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +17 -18
- data/spec/unit/indirector/file_bucket_file/rest_spec.rb +2 -3
- data/spec/unit/indirector/file_content/file_server_spec.rb +2 -2
- data/spec/unit/indirector/file_content/file_spec.rb +2 -2
- data/spec/unit/indirector/file_content/rest_spec.rb +2 -3
- data/spec/unit/indirector/file_metadata/file_server_spec.rb +2 -2
- data/spec/unit/indirector/file_metadata/file_spec.rb +2 -2
- data/spec/unit/indirector/file_metadata/rest_spec.rb +2 -3
- data/spec/unit/indirector/file_server_spec.rb +8 -7
- data/spec/unit/indirector/file_spec.rb +179 -0
- data/spec/unit/indirector/indirection_spec.rb +3 -24
- data/spec/unit/indirector/inventory/yaml_spec.rb +220 -0
- data/spec/unit/indirector/key/ca_spec.rb +2 -2
- data/spec/unit/indirector/key/file_spec.rb +2 -2
- data/spec/unit/indirector/ldap_spec.rb +6 -8
- data/spec/unit/indirector/memory_spec.rb +5 -7
- data/spec/unit/indirector/node/active_record_spec.rb +2 -3
- data/spec/unit/indirector/node/exec_spec.rb +3 -4
- data/spec/unit/indirector/node/ldap_spec.rb +3 -4
- data/spec/unit/indirector/node/memory_spec.rb +2 -3
- data/spec/unit/indirector/node/plain_spec.rb +2 -3
- data/spec/unit/indirector/node/rest_spec.rb +2 -3
- data/spec/unit/indirector/node/yaml_spec.rb +2 -3
- data/spec/unit/indirector/plain_spec.rb +5 -7
- data/spec/unit/indirector/queue_spec.rb +11 -14
- data/spec/unit/indirector/report/processor_spec.rb +7 -9
- data/spec/unit/indirector/report/rest_spec.rb +2 -3
- data/spec/unit/indirector/report/yaml_spec.rb +3 -4
- data/spec/unit/indirector/request_spec.rb +3 -25
- data/spec/unit/indirector/resource/ral_spec.rb +3 -4
- data/spec/unit/indirector/resource/rest_spec.rb +2 -3
- data/spec/unit/indirector/resource_type/parser_spec.rb +87 -13
- data/spec/unit/indirector/resource_type/rest_spec.rb +2 -3
- data/spec/unit/indirector/rest_spec.rb +45 -16
- data/spec/unit/indirector/run/local_spec.rb +2 -3
- data/spec/unit/indirector/run/rest_spec.rb +2 -3
- data/spec/unit/indirector/ssl_file_spec.rb +9 -27
- data/spec/unit/indirector/status/rest_spec.rb +2 -3
- data/spec/unit/indirector/terminus_spec.rb +180 -187
- data/spec/unit/indirector/yaml_spec.rb +9 -23
- data/spec/unit/indirector_spec.rb +61 -79
- data/spec/unit/interface/action_builder_spec.rb +214 -0
- data/spec/unit/interface/action_manager_spec.rb +282 -0
- data/spec/unit/interface/action_spec.rb +545 -0
- data/spec/unit/interface/documentation_spec.rb +34 -0
- data/spec/unit/interface/face_collection_spec.rb +180 -0
- data/spec/unit/interface/option_builder_spec.rb +77 -0
- data/spec/unit/interface/option_spec.rb +100 -0
- data/spec/unit/interface_spec.rb +228 -0
- data/spec/unit/module_spec.rb +34 -10
- data/spec/unit/network/authconfig_spec.rb +3 -4
- data/spec/unit/network/authstore_spec.rb +3 -4
- data/spec/unit/network/client_spec.rb +45 -0
- data/spec/unit/network/format_handler_spec.rb +2 -3
- data/spec/unit/network/format_spec.rb +2 -3
- data/spec/unit/network/formats_spec.rb +107 -3
- data/spec/unit/network/handler/fileserver_spec.rb +3 -4
- data/spec/unit/network/http/api/v1_spec.rb +61 -27
- data/spec/unit/network/http/compression_spec.rb +2 -3
- data/spec/unit/network/http/handler_spec.rb +78 -109
- data/spec/unit/network/http/mongrel/rest_spec.rb +3 -4
- data/spec/unit/network/http/mongrel_spec.rb +6 -6
- data/spec/unit/network/http/rack/rest_spec.rb +2 -20
- data/spec/unit/network/http/rack/xmlrpc_spec.rb +2 -3
- data/spec/unit/network/http/rack_spec.rb +2 -3
- data/spec/unit/network/http/webrick/rest_spec.rb +3 -4
- data/spec/unit/network/http/webrick_spec.rb +4 -8
- data/spec/unit/network/http_pool_spec.rb +82 -95
- data/spec/unit/network/http_spec.rb +2 -2
- data/spec/unit/network/rest_authconfig_spec.rb +9 -42
- data/spec/unit/network/rights_spec.rb +6 -7
- data/spec/unit/network/server_spec.rb +2 -2
- data/spec/unit/network/xmlrpc/client_spec.rb +172 -0
- data/spec/unit/node/environment_spec.rb +63 -7
- data/spec/unit/node/facts_spec.rb +9 -13
- data/spec/unit/node_spec.rb +5 -13
- data/spec/unit/other/selinux_spec.rb +2 -3
- data/spec/unit/other/transbucket_spec.rb +2 -3
- data/spec/unit/other/transobject_spec.rb +2 -3
- data/spec/unit/parameter/path_spec.rb +2 -2
- data/spec/unit/parameter/value_collection_spec.rb +2 -3
- data/spec/unit/parameter/value_spec.rb +2 -3
- data/spec/unit/parameter_spec.rb +2 -3
- data/spec/unit/parser/ast/arithmetic_operator_spec.rb +2 -13
- data/spec/unit/parser/ast/astarray_spec.rb +18 -36
- data/spec/unit/parser/ast/asthash_spec.rb +4 -4
- data/spec/unit/parser/ast/boolean_operator_spec.rb +2 -3
- data/spec/unit/parser/ast/casestatement_spec.rb +17 -14
- data/spec/unit/parser/ast/collection_spec.rb +2 -3
- data/spec/unit/parser/ast/collexpr_spec.rb +2 -3
- data/spec/unit/parser/ast/comparison_operator_spec.rb +4 -5
- data/spec/unit/parser/ast/definition_spec.rb +21 -0
- data/spec/unit/parser/ast/function_spec.rb +3 -4
- data/spec/unit/parser/ast/hostclass_spec.rb +72 -0
- data/spec/unit/parser/ast/ifstatement_spec.rb +2 -3
- data/spec/unit/parser/ast/in_operator_spec.rb +2 -3
- data/spec/unit/parser/ast/leaf_spec.rb +23 -19
- data/spec/unit/parser/ast/match_operator_spec.rb +2 -3
- data/spec/unit/parser/ast/minus_spec.rb +2 -3
- data/spec/unit/parser/ast/node_spec.rb +30 -0
- data/spec/unit/parser/ast/nop_spec.rb +2 -3
- data/spec/unit/parser/ast/not_spec.rb +2 -3
- data/spec/unit/parser/ast/relationship_spec.rb +2 -3
- data/spec/unit/parser/ast/resource_defaults_spec.rb +2 -3
- data/spec/unit/parser/ast/resource_override_spec.rb +2 -3
- data/spec/unit/parser/ast/resource_reference_spec.rb +21 -8
- data/spec/unit/parser/ast/resource_spec.rb +24 -13
- data/spec/unit/parser/ast/selector_spec.rb +3 -4
- data/spec/unit/parser/ast/vardef_spec.rb +15 -9
- data/spec/unit/parser/ast_spec.rb +2 -3
- data/spec/unit/parser/collector_spec.rb +2 -3
- data/spec/unit/parser/compiler_spec.rb +62 -35
- data/spec/unit/parser/files_spec.rb +2 -3
- data/spec/unit/parser/functions/create_resources_spec.rb +137 -0
- data/spec/unit/parser/functions/defined_spec.rb +5 -3
- data/spec/unit/parser/functions/extlookup_spec.rb +10 -10
- data/spec/unit/parser/functions/fqdn_rand_spec.rb +15 -13
- data/spec/unit/parser/functions/generate_spec.rb +5 -3
- data/spec/unit/parser/functions/include_spec.rb +5 -3
- data/spec/unit/parser/functions/inline_template_spec.rb +6 -17
- data/spec/unit/parser/functions/realize_spec.rb +5 -3
- data/spec/unit/parser/functions/regsubst_spec.rb +5 -3
- data/spec/unit/parser/functions/require_spec.rb +5 -3
- data/spec/unit/parser/functions/shellquote_spec.rb +8 -6
- data/spec/unit/parser/functions/split_spec.rb +5 -3
- data/spec/unit/parser/functions/sprintf_spec.rb +5 -3
- data/spec/unit/parser/functions/tag_spec.rb +5 -3
- data/spec/unit/parser/functions/template_spec.rb +6 -21
- data/spec/unit/parser/functions/versioncmp_spec.rb +5 -3
- data/spec/unit/parser/functions_spec.rb +2 -3
- data/spec/unit/parser/lexer_spec.rb +3 -7
- data/spec/unit/parser/parser_spec.rb +71 -90
- data/spec/unit/parser/relationship_spec.rb +2 -3
- data/spec/unit/parser/resource_spec.rb +6 -65
- data/spec/unit/parser/scope_spec.rb +28 -179
- data/spec/unit/parser/templatewrapper_spec.rb +25 -43
- data/spec/unit/parser/type_loader_spec.rb +120 -78
- data/spec/unit/property/ensure_spec.rb +2 -3
- data/spec/unit/property/keyvalue_spec.rb +4 -8
- data/spec/unit/property/list_spec.rb +2 -3
- data/spec/unit/property/ordered_list_spec.rb +2 -3
- data/spec/unit/property_spec.rb +2 -3
- data/spec/unit/provider/augeas/augeas_spec.rb +80 -3
- data/spec/unit/provider/cisco_spec.rb +16 -0
- data/spec/unit/provider/confine/exists_spec.rb +2 -3
- data/spec/unit/provider/confine/false_spec.rb +2 -3
- data/spec/unit/provider/confine/feature_spec.rb +2 -3
- data/spec/unit/provider/confine/true_spec.rb +2 -3
- data/spec/unit/provider/confine/variable_spec.rb +2 -3
- data/spec/unit/provider/confine_collection_spec.rb +2 -3
- data/spec/unit/provider/confine_spec.rb +2 -3
- data/spec/unit/provider/confiner_spec.rb +2 -3
- data/spec/unit/provider/exec/posix_spec.rb +2 -2
- data/spec/unit/provider/exec/shell_spec.rb +2 -2
- data/spec/unit/provider/group/groupadd_spec.rb +2 -3
- data/spec/unit/provider/group/ldap_spec.rb +2 -2
- data/spec/unit/provider/host/parsed_spec.rb +197 -0
- data/spec/unit/provider/interface/cisco_spec.rb +58 -0
- data/spec/unit/provider/ldap_spec.rb +2 -2
- data/spec/unit/provider/macauthorization_spec.rb +2 -2
- data/spec/unit/provider/mcx/mcxcontent_spec.rb +2 -21
- data/spec/unit/provider/mount/parsed_spec.rb +61 -86
- data/spec/unit/provider/mount_spec.rb +2 -3
- data/spec/unit/provider/naginator_spec.rb +2 -3
- data/spec/unit/provider/nameservice/directoryservice_spec.rb +2 -63
- data/spec/unit/provider/network_device_spec.rb +153 -0
- data/spec/unit/provider/package/aix_spec.rb +2 -3
- data/spec/unit/provider/package/apt_spec.rb +2 -3
- data/spec/unit/provider/package/dpkg_spec.rb +2 -3
- data/spec/unit/provider/package/freebsd_spec.rb +2 -3
- data/spec/unit/provider/package/gem_spec.rb +2 -3
- data/spec/unit/provider/package/hpux_spec.rb +2 -3
- data/spec/unit/provider/package/macports_spec.rb +2 -2
- data/spec/unit/provider/package/nim_spec.rb +2 -3
- data/spec/unit/provider/package/pip_spec.rb +180 -0
- data/spec/unit/provider/package/pkg_spec.rb +2 -3
- data/spec/unit/provider/package/pkgdmg_spec.rb +49 -56
- data/spec/unit/provider/package/pkgutil_spec.rb +182 -0
- data/spec/unit/provider/package/yum_spec.rb +66 -0
- data/spec/unit/provider/package/zypper_spec.rb +2 -3
- data/spec/unit/provider/parsedfile_spec.rb +2 -3
- data/spec/unit/provider/selboolean_spec.rb +2 -3
- data/spec/unit/provider/selmodule_spec.rb +2 -2
- data/spec/unit/provider/service/daemontools_spec.rb +2 -2
- data/spec/unit/provider/service/debian_spec.rb +2 -2
- data/spec/unit/provider/service/freebsd_spec.rb +2 -3
- data/spec/unit/provider/service/init_spec.rb +3 -3
- data/spec/unit/provider/service/launchd_spec.rb +2 -2
- data/spec/unit/provider/service/redhat_spec.rb +2 -2
- data/spec/unit/provider/service/runit_spec.rb +2 -2
- data/spec/unit/provider/service/smf_spec.rb +137 -0
- data/spec/unit/provider/service/src_spec.rb +7 -7
- data/spec/unit/provider/service/upstart.rb +48 -0
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +28 -47
- data/spec/unit/provider/sshkey/parsed_spec.rb +2 -3
- data/spec/unit/provider/user/hpux_spec.rb +2 -3
- data/spec/unit/provider/user/ldap_spec.rb +2 -2
- data/spec/unit/provider/user/user_role_add_spec.rb +15 -53
- data/spec/unit/provider/user/useradd_spec.rb +2 -3
- data/spec/unit/provider/vlan/cisco_spec.rb +56 -0
- data/spec/unit/provider/zfs/solaris_spec.rb +4 -4
- data/spec/unit/provider/zone/solaris_spec.rb +2 -3
- data/spec/unit/provider/zpool/solaris_spec.rb +33 -4
- data/spec/unit/provider_spec.rb +2 -3
- data/spec/unit/puppet/provider/README.markdown +4 -0
- data/spec/unit/puppet/type/README.markdown +4 -0
- data/spec/unit/puppet_spec.rb +2 -2
- data/spec/unit/rails/host_spec.rb +2 -11
- data/spec/unit/rails/param_value_spec.rb +2 -3
- data/spec/unit/rails/resource_spec.rb +2 -3
- data/spec/unit/rails_spec.rb +2 -3
- data/spec/unit/relationship_spec.rb +2 -2
- data/spec/unit/reports/http_spec.rb +2 -3
- data/spec/unit/reports/rrdgraph_spec.rb +2 -3
- data/spec/unit/reports/store_spec.rb +2 -17
- data/spec/unit/reports/tagmail_spec.rb +4 -8
- data/spec/unit/reports_spec.rb +2 -3
- data/spec/unit/resource/catalog_spec.rb +15 -74
- data/spec/unit/resource/status_spec.rb +3 -4
- data/spec/unit/resource/type_collection_helper_spec.rb +2 -3
- data/spec/unit/resource/type_collection_spec.rb +69 -81
- data/spec/unit/resource/type_spec.rb +26 -44
- data/spec/unit/resource_spec.rb +3 -4
- data/spec/unit/run_spec.rb +2 -3
- data/spec/unit/simple_graph_spec.rb +434 -80
- data/spec/unit/ssl/base_spec.rb +3 -4
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +56 -96
- data/spec/unit/ssl/certificate_authority_spec.rb +71 -246
- data/spec/unit/ssl/certificate_factory_spec.rb +72 -93
- data/spec/unit/ssl/certificate_request_spec.rb +11 -76
- data/spec/unit/ssl/certificate_revocation_list_spec.rb +4 -5
- data/spec/unit/ssl/certificate_spec.rb +2 -34
- data/spec/unit/ssl/host_spec.rb +202 -207
- data/spec/unit/ssl/inventory_spec.rb +4 -5
- data/spec/unit/ssl/key_spec.rb +2 -3
- data/spec/unit/sslcertificates/ca_spec.rb +110 -0
- data/spec/unit/status_spec.rb +8 -5
- data/spec/unit/transaction/event_manager_spec.rb +2 -3
- data/spec/unit/transaction/event_spec.rb +7 -8
- data/spec/unit/transaction/report_spec.rb +25 -14
- data/spec/unit/transaction/resource_harness_spec.rb +2 -4
- data/spec/unit/transaction_spec.rb +31 -28
- data/spec/unit/transportable_spec.rb +0 -0
- data/spec/unit/type/augeas_spec.rb +3 -4
- data/spec/unit/type/component_spec.rb +2 -3
- data/spec/unit/type/computer_spec.rb +2 -3
- data/spec/unit/type/cron_spec.rb +12 -3
- data/spec/unit/type/exec_spec.rb +2 -32
- data/spec/unit/type/file/checksum_spec.rb +2 -3
- data/spec/unit/type/file/content_spec.rb +2 -3
- data/spec/unit/type/file/ctime.rb +2 -3
- data/spec/unit/type/file/ensure_spec.rb +2 -3
- data/spec/unit/type/file/group_spec.rb +2 -3
- data/spec/unit/type/file/mtime.rb +2 -3
- data/spec/unit/type/file/owner_spec.rb +2 -3
- data/spec/unit/type/file/selinux_spec.rb +2 -3
- data/spec/unit/type/file/source_spec.rb +9 -10
- data/spec/unit/type/file/type.rb +2 -3
- data/spec/unit/type/file_spec.rb +15 -30
- data/spec/unit/type/filebucket_spec.rb +2 -3
- data/spec/unit/type/group_spec.rb +4 -5
- data/spec/unit/type/host_spec.rb +129 -0
- data/spec/unit/type/interface_spec.rb +98 -0
- data/spec/unit/type/macauthorization_spec.rb +2 -3
- data/spec/unit/type/maillist_spec.rb +2 -3
- data/spec/unit/type/mcx_spec.rb +2 -23
- data/spec/unit/type/mount_spec.rb +41 -18
- data/spec/unit/type/nagios_spec.rb +2 -3
- data/spec/unit/type/noop_metaparam_spec.rb +2 -3
- data/spec/unit/type/package_spec.rb +2 -3
- data/spec/unit/type/resources_spec.rb +3 -4
- data/spec/unit/type/schedule_spec.rb +19 -12
- data/spec/unit/type/selboolean_spec.rb +2 -3
- data/spec/unit/type/selmodule_spec.rb +2 -3
- data/spec/unit/type/service_spec.rb +6 -3
- data/spec/unit/type/ssh_authorized_key_spec.rb +2 -3
- data/spec/unit/type/sshkey_spec.rb +70 -0
- data/spec/unit/type/stage_spec.rb +2 -3
- data/spec/unit/type/tidy_spec.rb +4 -4
- data/spec/unit/type/user_spec.rb +2 -11
- data/spec/unit/type/vlan_spec.rb +45 -0
- data/spec/unit/type/whit_spec.rb +4 -5
- data/spec/unit/type/zfs_spec.rb +2 -3
- data/spec/unit/type/zone_spec.rb +22 -3
- data/spec/unit/type/zpool_spec.rb +2 -3
- data/spec/unit/type_spec.rb +2 -69
- data/spec/unit/util/autoload/file_cache_spec.rb +2 -3
- data/spec/unit/util/autoload_spec.rb +6 -7
- data/spec/unit/util/backups_spec.rb +2 -3
- data/spec/unit/util/cache_accumulator_spec.rb +2 -3
- data/spec/unit/util/cacher_spec.rb +3 -4
- data/spec/unit/util/checksums_spec.rb +2 -2
- data/spec/unit/util/command_line_spec.rb +11 -8
- data/spec/unit/util/constant_inflector_spec.rb +2 -2
- data/spec/unit/util/errors_spec.rb +2 -3
- data/spec/unit/util/execution_spec.rb +2 -3
- data/spec/unit/util/execution_stub_spec.rb +2 -3
- data/spec/unit/util/feature_spec.rb +2 -3
- data/spec/unit/util/file_locking_spec.rb +4 -5
- data/spec/unit/util/filetype_spec.rb +2 -3
- data/spec/unit/util/inline_docs_spec.rb +2 -3
- data/spec/unit/util/ldap/connection_spec.rb +2 -2
- data/spec/unit/util/ldap/generator_spec.rb +2 -2
- data/spec/unit/util/ldap/manager_spec.rb +2 -2
- data/spec/unit/util/loadedfile_spec.rb +2 -3
- data/spec/unit/util/log/destinations_spec.rb +2 -3
- data/spec/unit/util/log_spec.rb +6 -7
- data/spec/unit/util/logging_spec.rb +27 -3
- data/spec/unit/util/metric_spec.rb +2 -3
- data/spec/unit/util/monkey_patches_spec.rb +48 -10
- data/spec/unit/util/nagios_maker_spec.rb +2 -2
- data/spec/unit/util/network_device/cisco/device_spec.rb +408 -0
- data/spec/unit/util/network_device/cisco/facts_spec.rb +63 -0
- data/spec/unit/util/network_device/cisco/interface_spec.rb +89 -0
- data/spec/unit/util/network_device/config_spec.rb +102 -0
- data/spec/unit/util/network_device/ipcalc_spec.rb +63 -0
- data/spec/unit/util/network_device/transport/base_spec.rb +42 -0
- data/spec/unit/util/network_device/transport/ssh_spec.rb +219 -0
- data/spec/unit/util/network_device/transport/telnet_spec.rb +76 -0
- data/spec/unit/util/network_device_spec.rb +50 -0
- data/spec/unit/util/package_spec.rb +2 -3
- data/spec/unit/util/posix_spec.rb +2 -3
- data/spec/unit/util/pson_spec.rb +3 -4
- data/spec/unit/util/queue/stomp_spec.rb +4 -5
- data/spec/unit/util/queue_spec.rb +2 -3
- data/spec/unit/util/rdoc/parser_spec.rb +17 -12
- data/spec/unit/util/rdoc_spec.rb +19 -58
- data/spec/unit/util/reference_serializer_spec.rb +2 -3
- data/spec/unit/util/resource_template_spec.rb +2 -3
- data/spec/unit/util/run_mode_spec.rb +2 -3
- data/spec/unit/util/selinux_spec.rb +4 -5
- data/spec/unit/util/settings/file_setting_spec.rb +2 -7
- data/spec/unit/util/settings_spec.rb +2 -24
- data/spec/unit/util/storage_spec.rb +2 -3
- data/spec/unit/util/tagging_spec.rb +2 -2
- data/spec/unit/util/user_attr_spec.rb +2 -3
- data/spec/unit/util/warnings_spec.rb +2 -3
- data/spec/unit/util/zaml_spec.rb +23 -53
- data/spec/watchr.rb +146 -0
- data/tasks/rake/gem.rake +5 -4
- data/tasks/rake/git_workflow.rake +62 -51
- data/tasks/rake/manpages.rake +69 -0
- data/test/certmgr/certmgr.rb +308 -0
- data/test/certmgr/inventory.rb +69 -0
- data/test/certmgr/support.rb +105 -0
- data/test/data/providers/host/parsed/valid_hosts +19 -0
- data/test/language/ast.rb +1 -1
- data/test/language/ast/variable.rb +1 -1
- data/test/language/functions.rb +8 -9
- data/test/language/parser.rb +44 -52
- data/test/language/scope.rb +13 -24
- data/test/language/snippets.rb +11 -2
- data/test/language/transportable.rb +1 -1
- data/test/lib/puppettest.rb +2 -2
- data/test/lib/puppettest/exetest.rb +1 -1
- data/test/lib/puppettest/parsertesting.rb +5 -8
- data/test/lib/puppettest/servertest.rb +1 -0
- data/test/lib/puppettest/support/assertions.rb +6 -1
- data/test/lib/puppettest/support/utils.rb +0 -19
- data/test/network/authconfig.rb +1 -1
- data/test/network/authorization.rb +1 -1
- data/test/network/authstore.rb +1 -1
- data/test/network/client/ca.rb +69 -0
- data/test/network/client/dipper.rb +34 -0
- data/test/network/client_request.rb +1 -1
- data/test/network/handler/ca.rb +273 -0
- data/test/network/handler/fileserver.rb +1 -1
- data/test/network/handler/master.rb +13 -9
- data/test/network/handler/report.rb +1 -1
- data/test/network/handler/runner.rb +1 -1
- data/test/network/rights.rb +1 -1
- data/test/network/server/mongrel_test.rb +99 -0
- data/test/network/server/webrick.rb +128 -0
- data/test/network/xmlrpc/client.rb +45 -0
- data/test/network/xmlrpc/processor.rb +1 -1
- data/test/network/xmlrpc/server.rb +1 -1
- data/test/network/xmlrpc/webrick_servlet.rb +1 -1
- data/test/other/provider.rb +1 -1
- data/test/other/puppet.rb +1 -1
- data/test/other/relationships.rb +11 -18
- data/test/other/report.rb +1 -1
- data/test/other/transactions.rb +2 -35
- data/test/puppet/defaults.rb +1 -1
- data/test/puppet/errortest.rb +1 -1
- data/test/puppet/tc_suidmanager.rb +120 -0
- data/test/rails/rails.rb +2 -1
- data/test/rails/railsparameter.rb +2 -2
- data/test/ral/manager/attributes.rb +1 -1
- data/test/ral/manager/instances.rb +1 -1
- data/test/ral/manager/manager.rb +1 -1
- data/test/ral/manager/provider.rb +1 -1
- data/test/ral/manager/type.rb +1 -1
- data/test/ral/providers/cron/crontab.rb +1 -1
- data/test/ral/providers/group.rb +1 -1
- data/test/ral/providers/host/parsed.rb +1 -203
- data/test/ral/providers/mailalias/aliases.rb +1 -1
- data/test/ral/providers/nameservice.rb +1 -1
- data/test/ral/providers/package.rb +1 -1
- data/test/ral/providers/package/aptitude.rb +1 -1
- data/test/ral/providers/package/aptrpm.rb +1 -1
- data/test/ral/providers/parsedfile.rb +1 -1
- data/test/ral/providers/port/parsed.rb +1 -1
- data/test/ral/providers/provider.rb +1 -1
- data/test/ral/providers/service/base.rb +1 -1
- data/test/ral/providers/sshkey/parsed.rb +1 -1
- data/test/ral/providers/user.rb +1 -1
- data/test/ral/providers/user/useradd.rb +1 -1
- data/test/ral/type/cron.rb +1 -1
- data/test/ral/type/exec.rb +1 -42
- data/test/ral/type/file.rb +1 -1
- data/test/ral/type/file/target.rb +6 -19
- data/test/ral/type/fileignoresource.rb +1 -1
- data/test/ral/type/filesources.rb +61 -1
- data/test/ral/type/host.rb +1 -1
- data/test/ral/type/mailalias.rb +1 -1
- data/test/ral/type/port.rb +1 -1
- data/test/ral/type/resources.rb +1 -1
- data/test/ral/type/service.rb +1 -1
- data/test/ral/type/sshkey.rb +1 -1
- data/test/ral/type/user.rb +1 -1
- data/test/ral/type/yumrepo.rb +1 -1
- data/test/ral/type/zone.rb +1 -1
- data/test/test +2 -2
- data/test/util/classgen.rb +1 -1
- data/test/util/execution.rb +1 -1
- data/test/util/fileparsing.rb +1 -1
- data/test/util/inifile.rb +1 -1
- data/test/util/instance_loader.rb +1 -1
- data/test/util/log.rb +1 -1
- data/test/util/metrics.rb +1 -1
- data/test/util/package.rb +1 -1
- data/test/util/pidlock.rb +1 -1
- data/test/util/settings.rb +1 -1
- data/test/util/storage.rb +1 -1
- data/test/util/subclass_loader.rb +1 -1
- data/test/util/utiltest.rb +1 -1
- metadata +312 -48
- data/CHANGELOG.old +0 -1705
- data/CONTRIBUTING.md +0 -299
- data/COPYING +0 -340
- data/README.queueing +0 -126
- data/ext/upload_facts.rb +0 -120
- data/ext/vim/ftplugin/puppet.vim +0 -94
- data/ext/vim/indent/puppet.vim +0 -76
- data/lib/puppet/indirector/errors.rb +0 -5
- data/lib/puppet/indirector/facts/inventory_service.rb +0 -20
- data/lib/puppet/indirector/file_bucket_file/selector.rb +0 -53
- data/lib/puppet/indirector/file_content/selector.rb +0 -30
- data/lib/puppet/indirector/file_metadata/selector.rb +0 -30
- data/lib/puppet/indirector/resource/validator.rb +0 -8
- data/lib/puppet/util/command_line/filebucket +0 -97
- data/lib/puppet/util/command_line/pi +0 -48
- data/lib/puppet/util/command_line/puppet +0 -73
- data/lib/puppet/util/command_line/puppetca +0 -131
- data/lib/puppet/util/command_line/puppetd +0 -188
- data/lib/puppet/util/command_line/puppetdoc +0 -67
- data/lib/puppet/util/command_line/puppetmasterd +0 -70
- data/lib/puppet/util/command_line/puppetqd +0 -53
- data/lib/puppet/util/command_line/puppetrun +0 -125
- data/lib/puppet/util/command_line/ralsh +0 -89
- data/spec/integration/file_bucket/file_spec.rb +0 -44
- data/spec/integration/indirector/bucket_file/rest_spec.rb +0 -77
- data/spec/integration/indirector/certificate/rest_spec.rb +0 -69
- data/spec/integration/indirector/certificate_request/rest_spec.rb +0 -89
- data/spec/integration/indirector/certificate_revocation_list/rest_spec.rb +0 -85
- data/spec/integration/indirector/report/rest_spec.rb +0 -93
- data/spec/shared_behaviours/file_serving_model.rb +0 -73
- data/spec/unit/indirector/facts/inventory_service_spec.rb +0 -22
- data/spec/unit/indirector/file_bucket_file/selector_spec.rb +0 -29
- data/spec/unit/indirector/file_content/selector_spec.rb +0 -10
- data/spec/unit/indirector/file_metadata/selector_spec.rb +0 -11
- data/spec/unit/network/handler/ca_spec.rb +0 -87
- data/spec/unit/network/rest_authorization_spec.rb +0 -43
- data/spec/unit/provider/package/appdmg_spec.rb +0 -42
- data/spec/unit/type/k5login_spec.rb +0 -115
- data/spec/unit/util/suidmanager_spec.rb +0 -220
- data/spec/unit/util_spec.rb +0 -104
@@ -1,127 +1,106 @@
|
|
1
|
-
#!/usr/bin/env
|
2
|
-
|
3
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
require 'spec_helper'
|
4
3
|
|
5
4
|
require 'puppet/ssl/certificate_factory'
|
6
5
|
|
7
6
|
describe Puppet::SSL::CertificateFactory do
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
csr
|
16
|
-
end
|
17
|
-
let :issuer do
|
18
|
-
cert = OpenSSL::X509::Certificate.new
|
19
|
-
cert.subject = OpenSSL::X509::Name.new([["CN", 'issuer.local']])
|
20
|
-
cert
|
7
|
+
before do
|
8
|
+
@cert_type = mock 'cert_type'
|
9
|
+
@name = mock 'name'
|
10
|
+
@csr = stub 'csr', :subject => @name
|
11
|
+
@issuer = mock 'issuer'
|
12
|
+
@serial = mock 'serial'
|
13
|
+
|
14
|
+
@factory = Puppet::SSL::CertificateFactory.new(@cert_type, @csr, @issuer, @serial)
|
21
15
|
end
|
22
16
|
|
23
|
-
describe "when
|
24
|
-
it "should
|
25
|
-
|
26
|
-
subject.build(:server, csr, issuer, serial)
|
17
|
+
describe "when initializing" do
|
18
|
+
it "should set its :cert_type to its first argument" do
|
19
|
+
@factory.cert_type.should equal(@cert_type)
|
27
20
|
end
|
28
21
|
|
29
|
-
it "should set
|
30
|
-
|
22
|
+
it "should set its :csr to its second argument" do
|
23
|
+
@factory.csr.should equal(@csr)
|
31
24
|
end
|
32
25
|
|
33
|
-
it "should set
|
34
|
-
|
35
|
-
cert.subject.should eql x509_name
|
26
|
+
it "should set its :issuer to its third argument" do
|
27
|
+
@factory.issuer.should equal(@issuer)
|
36
28
|
end
|
37
29
|
|
38
|
-
it "should set
|
39
|
-
|
40
|
-
cert.issuer.should eql issuer.subject
|
30
|
+
it "should set its :serial to its fourth argument" do
|
31
|
+
@factory.serial.should equal(@serial)
|
41
32
|
end
|
42
33
|
|
43
|
-
it "should set
|
44
|
-
|
45
|
-
cert.public_key.should be_public
|
46
|
-
cert.public_key.to_s.should == csr.content.public_key.to_s
|
34
|
+
it "should set its name to the subject of the csr" do
|
35
|
+
@factory.name.should equal(@name)
|
47
36
|
end
|
37
|
+
end
|
48
38
|
|
49
|
-
|
50
|
-
|
51
|
-
cert
|
52
|
-
end
|
39
|
+
describe "when generating the certificate" do
|
40
|
+
before do
|
41
|
+
@cert = mock 'cert'
|
53
42
|
|
54
|
-
|
55
|
-
cert = subject.build(:server, csr, issuer, serial)
|
56
|
-
cert.not_before.should be_within(1).of(Time.now - 24*60*60)
|
57
|
-
end
|
43
|
+
@cert.stub_everything
|
58
44
|
|
59
|
-
|
60
|
-
ttl = Puppet::SSL::CertificateFactory.ttl
|
61
|
-
cert = subject.build(:server, csr, issuer, serial)
|
62
|
-
cert.not_after.should be_within(1).of(Time.now + ttl)
|
63
|
-
end
|
45
|
+
@factory.stubs :build_extensions
|
64
46
|
|
65
|
-
|
66
|
-
Puppet[:ca_ttl] = 12
|
67
|
-
cert = subject.build(:server, csr, issuer, serial)
|
68
|
-
cert.not_after.should be_within(1).of(Time.now + 12)
|
69
|
-
end
|
47
|
+
@factory.stubs :set_ttl
|
70
48
|
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
49
|
+
@issuer_name = mock 'issuer_name'
|
50
|
+
@issuer.stubs(:subject).returns @issuer_name
|
51
|
+
|
52
|
+
@public_key = mock 'public_key'
|
53
|
+
@csr.stubs(:public_key).returns @public_key
|
54
|
+
|
55
|
+
OpenSSL::X509::Certificate.stubs(:new).returns @cert
|
77
56
|
end
|
78
57
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
Puppet[:dns_alt_names] = 'one, two'
|
84
|
-
# Verify the CSR still has no extReq, just in case...
|
85
|
-
csr.request_extensions.should == []
|
86
|
-
cert = subject.build(:server, csr, issuer, serial)
|
58
|
+
it "should return a new X509 certificate" do
|
59
|
+
OpenSSL::X509::Certificate.expects(:new).returns @cert
|
60
|
+
@factory.result.should equal(@cert)
|
61
|
+
end
|
87
62
|
|
88
|
-
|
63
|
+
it "should set the certificate's version to 2" do
|
64
|
+
@cert.expects(:version=).with 2
|
65
|
+
@factory.result
|
89
66
|
end
|
90
67
|
|
91
|
-
it "should
|
92
|
-
|
68
|
+
it "should set the certificate's subject to the CSR's subject" do
|
69
|
+
@cert.expects(:subject=).with @name
|
70
|
+
@factory.result
|
71
|
+
end
|
93
72
|
|
94
|
-
|
73
|
+
it "should set the certificate's issuer to the Issuer's subject" do
|
74
|
+
@cert.expects(:issuer=).with @issuer_name
|
75
|
+
@factory.result
|
76
|
+
end
|
95
77
|
|
96
|
-
|
97
|
-
|
78
|
+
it "should set the certificate's public key to the CSR's public key" do
|
79
|
+
@cert.expects(:public_key=).with @public_key
|
80
|
+
@factory.result
|
81
|
+
end
|
98
82
|
|
99
|
-
|
100
|
-
|
83
|
+
it "should set the certificate's serial number to the provided serial number" do
|
84
|
+
@cert.expects(:serial=).with @serial
|
85
|
+
@factory.result
|
86
|
+
end
|
101
87
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
expect.each do |name|
|
106
|
-
san.value.should =~ /DNS:#{name}\b/i
|
107
|
-
end
|
88
|
+
it "should build extensions for the certificate" do
|
89
|
+
@factory.expects(:build_extensions)
|
90
|
+
@factory.result
|
108
91
|
end
|
109
92
|
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
{ :ca => 'CA:TRUE',
|
114
|
-
:terminalsubca => ['CA:TRUE', 'pathlen:0'],
|
115
|
-
:server => 'CA:FALSE',
|
116
|
-
:ocsp => 'CA:FALSE',
|
117
|
-
:client => 'CA:FALSE',
|
118
|
-
}.each do |name, value|
|
119
|
-
it "should set basicConstraints for #{name} #{value.inspect}" do
|
120
|
-
cert = subject.build(name, csr, issuer, serial)
|
121
|
-
bc = cert.extensions.find {|x| x.oid == 'basicConstraints' }
|
122
|
-
bc.should be
|
123
|
-
bc.value.split(/\s*,\s*/).should =~ Array(value)
|
124
|
-
end
|
93
|
+
it "should set the ttl of the certificate" do
|
94
|
+
@factory.expects(:set_ttl)
|
95
|
+
@factory.result
|
125
96
|
end
|
126
97
|
end
|
98
|
+
|
99
|
+
describe "when building extensions" do
|
100
|
+
it "should have tests"
|
101
|
+
end
|
102
|
+
|
103
|
+
describe "when setting the ttl" do
|
104
|
+
it "should have tests"
|
105
|
+
end
|
127
106
|
end
|
@@ -1,6 +1,5 @@
|
|
1
|
-
#!/usr/bin/env
|
2
|
-
|
3
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
require 'spec_helper'
|
4
3
|
|
5
4
|
require 'puppet/ssl/certificate_request'
|
6
5
|
require 'puppet/ssl/key'
|
@@ -126,7 +125,7 @@ describe Puppet::SSL::CertificateRequest do
|
|
126
125
|
|
127
126
|
it "should set the CN to the :ca_name setting when the CSR is for a CA" do
|
128
127
|
subject = mock 'subject'
|
129
|
-
Puppet
|
128
|
+
Puppet.settings.expects(:value).with(:ca_name).returns "mycertname"
|
130
129
|
OpenSSL::X509::Name.expects(:new).with { |subject| subject[0][1] == "mycertname" }.returns(subject)
|
131
130
|
@request.expects(:subject=).with(subject)
|
132
131
|
Puppet::SSL::CertificateRequest.new(Puppet::SSL::CA_NAME).generate(@key)
|
@@ -145,67 +144,6 @@ describe Puppet::SSL::CertificateRequest do
|
|
145
144
|
@instance.generate(@key)
|
146
145
|
end
|
147
146
|
|
148
|
-
context "without subjectAltName / dns_alt_names" do
|
149
|
-
before :each do
|
150
|
-
Puppet[:dns_alt_names] = ""
|
151
|
-
end
|
152
|
-
|
153
|
-
["extreq", "msExtReq"].each do |name|
|
154
|
-
it "should not add any #{name} attribute" do
|
155
|
-
@request.expects(:add_attribute).never
|
156
|
-
@request.expects(:attributes=).never
|
157
|
-
@instance.generate(@key)
|
158
|
-
end
|
159
|
-
|
160
|
-
it "should return no subjectAltNames" do
|
161
|
-
@instance.generate(@key)
|
162
|
-
@instance.subject_alt_names.should be_empty
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
context "with dns_alt_names" do
|
168
|
-
before :each do
|
169
|
-
Puppet[:dns_alt_names] = "one, two, three"
|
170
|
-
end
|
171
|
-
|
172
|
-
["extreq", "msExtReq"].each do |name|
|
173
|
-
it "should not add any #{name} attribute" do
|
174
|
-
@request.expects(:add_attribute).never
|
175
|
-
@request.expects(:attributes=).never
|
176
|
-
@instance.generate(@key)
|
177
|
-
end
|
178
|
-
|
179
|
-
it "should return no subjectAltNames" do
|
180
|
-
@instance.generate(@key)
|
181
|
-
@instance.subject_alt_names.should be_empty
|
182
|
-
end
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
context "with subjectAltName to generate request" do
|
187
|
-
before :each do
|
188
|
-
Puppet[:dns_alt_names] = ""
|
189
|
-
end
|
190
|
-
|
191
|
-
it "should add an extreq attribute" do
|
192
|
-
@request.expects(:add_attribute).with do |arg|
|
193
|
-
arg.value.value.all? do |x|
|
194
|
-
x.value.all? do |y|
|
195
|
-
y.value[0].value == "subjectAltName"
|
196
|
-
end
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
200
|
-
@instance.generate(@key, :dns_alt_names => 'one, two')
|
201
|
-
end
|
202
|
-
|
203
|
-
it "should return the subjectAltName values" do
|
204
|
-
@instance.generate(@key, :dns_alt_names => 'one,two')
|
205
|
-
@instance.subject_alt_names.should =~ ["DNS:myname", "DNS:one", "DNS:two"]
|
206
|
-
end
|
207
|
-
end
|
208
|
-
|
209
147
|
it "should sign the csr with the provided key and a digest" do
|
210
148
|
digest = mock 'digest'
|
211
149
|
OpenSSL::Digest::MD5.expects(:new).returns(digest)
|
@@ -248,22 +186,17 @@ describe Puppet::SSL::CertificateRequest do
|
|
248
186
|
end
|
249
187
|
|
250
188
|
describe "when a CSR is saved" do
|
251
|
-
it "should allow arguments" do
|
252
|
-
csr = Puppet::SSL::CertificateRequest.new("me")
|
253
|
-
csr.class.indirection.stubs(:save)
|
254
|
-
|
255
|
-
lambda { csr.save :ipaddress => "foo" }.should_not raise_error
|
256
|
-
end
|
257
|
-
|
258
189
|
describe "and a CA is available" do
|
259
190
|
it "should save the CSR and trigger autosigning" do
|
260
191
|
ca = mock 'ca', :autosign
|
261
192
|
Puppet::SSL::CertificateAuthority.expects(:instance).returns ca
|
262
193
|
|
263
194
|
csr = Puppet::SSL::CertificateRequest.new("me")
|
264
|
-
|
195
|
+
terminus = mock 'terminus'
|
196
|
+
Puppet::SSL::CertificateRequest.indirection.expects(:prepare).returns(terminus)
|
197
|
+
terminus.expects(:save).with { |request| request.instance == csr && request.key == "me" }
|
265
198
|
|
266
|
-
|
199
|
+
Puppet::SSL::CertificateRequest.indirection.save(csr)
|
267
200
|
end
|
268
201
|
end
|
269
202
|
|
@@ -272,9 +205,11 @@ describe Puppet::SSL::CertificateRequest do
|
|
272
205
|
Puppet::SSL::CertificateAuthority.expects(:instance).returns nil
|
273
206
|
|
274
207
|
csr = Puppet::SSL::CertificateRequest.new("me")
|
275
|
-
|
208
|
+
terminus = mock 'terminus'
|
209
|
+
Puppet::SSL::CertificateRequest.indirection.expects(:prepare).returns(terminus)
|
210
|
+
terminus.expects(:save).with { |request| request.instance == csr && request.key == "me" }
|
276
211
|
|
277
|
-
|
212
|
+
Puppet::SSL::CertificateRequest.indirection.save(csr)
|
278
213
|
end
|
279
214
|
end
|
280
215
|
end
|
@@ -1,6 +1,5 @@
|
|
1
|
-
#!/usr/bin/env
|
2
|
-
|
3
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
require 'spec_helper'
|
4
3
|
|
5
4
|
require 'puppet/ssl/certificate_revocation_list'
|
6
5
|
|
@@ -119,7 +118,7 @@ describe Puppet::SSL::CertificateRevocationList do
|
|
119
118
|
@crl.generate(@cert, @key)
|
120
119
|
@crl.content.stubs(:sign)
|
121
120
|
|
122
|
-
|
121
|
+
Puppet::SSL::CertificateRevocationList.indirection.stubs :save
|
123
122
|
|
124
123
|
@key = mock 'key'
|
125
124
|
end
|
@@ -161,7 +160,7 @@ describe Puppet::SSL::CertificateRevocationList do
|
|
161
160
|
end
|
162
161
|
|
163
162
|
it "should save the CRL" do
|
164
|
-
|
163
|
+
Puppet::SSL::CertificateRevocationList.indirection.expects(:save).with(@crl, nil)
|
165
164
|
@crl.revoke(1, @key)
|
166
165
|
end
|
167
166
|
end
|
@@ -1,6 +1,5 @@
|
|
1
|
-
#!/usr/bin/env
|
2
|
-
|
3
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
require 'spec_helper'
|
4
3
|
|
5
4
|
require 'puppet/ssl/certificate'
|
6
5
|
|
@@ -90,37 +89,6 @@ describe Puppet::SSL::Certificate do
|
|
90
89
|
@certificate.should respond_to(:content)
|
91
90
|
end
|
92
91
|
|
93
|
-
describe "#subject_alt_names" do
|
94
|
-
it "should list all alternate names when the extension is present" do
|
95
|
-
key = Puppet::SSL::Key.new('quux')
|
96
|
-
key.generate
|
97
|
-
|
98
|
-
csr = Puppet::SSL::CertificateRequest.new('quux')
|
99
|
-
csr.generate(key, :dns_alt_names => 'foo, bar,baz')
|
100
|
-
|
101
|
-
raw_csr = csr.content
|
102
|
-
|
103
|
-
cert = Puppet::SSL::CertificateFactory.build('server', csr, raw_csr, 14)
|
104
|
-
certificate = @class.from_s(cert.to_pem)
|
105
|
-
certificate.subject_alt_names.
|
106
|
-
should =~ ['DNS:foo', 'DNS:bar', 'DNS:baz', 'DNS:quux']
|
107
|
-
end
|
108
|
-
|
109
|
-
it "should return an empty list of names if the extension is absent" do
|
110
|
-
key = Puppet::SSL::Key.new('quux')
|
111
|
-
key.generate
|
112
|
-
|
113
|
-
csr = Puppet::SSL::CertificateRequest.new('quux')
|
114
|
-
csr.generate(key)
|
115
|
-
|
116
|
-
raw_csr = csr.content
|
117
|
-
|
118
|
-
cert = Puppet::SSL::CertificateFactory.build('client', csr, raw_csr, 14)
|
119
|
-
certificate = @class.from_s(cert.to_pem)
|
120
|
-
certificate.subject_alt_names.should be_empty
|
121
|
-
end
|
122
|
-
end
|
123
|
-
|
124
92
|
it "should return a nil expiration if there is no actual certificate" do
|
125
93
|
@certificate.stubs(:content).returns nil
|
126
94
|
|
data/spec/unit/ssl/host_spec.rb
CHANGED
@@ -1,20 +1,20 @@
|
|
1
|
-
#!/usr/bin/env
|
2
|
-
|
3
|
-
require File.dirname(__FILE__) + '/../../spec_helper'
|
1
|
+
#!/usr/bin/env rspec
|
2
|
+
require 'spec_helper'
|
4
3
|
|
5
4
|
require 'puppet/ssl/host'
|
5
|
+
require 'puppet/sslcertificates'
|
6
|
+
require 'puppet/sslcertificates/ca'
|
6
7
|
|
7
8
|
describe Puppet::SSL::Host do
|
8
|
-
include PuppetSpec::Files
|
9
|
-
|
10
9
|
before do
|
11
|
-
|
12
|
-
@host =
|
10
|
+
Puppet::SSL::Host.indirection.terminus_class = :file
|
11
|
+
@host = Puppet::SSL::Host.new("myname")
|
13
12
|
end
|
14
13
|
|
15
14
|
after do
|
16
15
|
# Cleaned out any cached localhost instance.
|
17
16
|
Puppet::Util::Cacher.expire
|
17
|
+
Puppet::SSL::Host.ca_location = :none
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should use any provided name as its name" do
|
@@ -24,7 +24,7 @@ describe Puppet::SSL::Host do
|
|
24
24
|
it "should retrieve its public key from its private key" do
|
25
25
|
realkey = mock 'realkey'
|
26
26
|
key = stub 'key', :content => realkey
|
27
|
-
Puppet::SSL::Key.stubs(:find).returns(key)
|
27
|
+
Puppet::SSL::Key.indirection.stubs(:find).returns(key)
|
28
28
|
pubkey = mock 'public_key'
|
29
29
|
realkey.expects(:public_key).returns pubkey
|
30
30
|
|
@@ -66,95 +66,6 @@ describe Puppet::SSL::Host do
|
|
66
66
|
Puppet::SSL::Host.localhost.should equal(host)
|
67
67
|
end
|
68
68
|
|
69
|
-
it "should create a localhost cert if no cert is available and it is a CA with autosign and it is using DNS alt names" do
|
70
|
-
Puppet[:autosign] = true
|
71
|
-
Puppet[:confdir] = tmpdir('conf')
|
72
|
-
Puppet[:dns_alt_names] = "foo,bar,baz"
|
73
|
-
ca = Puppet::SSL::CertificateAuthority.new
|
74
|
-
Puppet::SSL::CertificateAuthority.stubs(:instance).returns ca
|
75
|
-
|
76
|
-
localhost = Puppet::SSL::Host.localhost
|
77
|
-
cert = localhost.certificate
|
78
|
-
|
79
|
-
cert.should be_a(Puppet::SSL::Certificate)
|
80
|
-
cert.subject_alt_names.should =~ %W[DNS:#{Puppet[:certname]} DNS:foo DNS:bar DNS:baz]
|
81
|
-
end
|
82
|
-
|
83
|
-
context "with dns_alt_names" do
|
84
|
-
before :each do
|
85
|
-
@key = stub('key content')
|
86
|
-
key = stub('key', :generate => true, :save => true, :content => @key)
|
87
|
-
Puppet::SSL::Key.stubs(:new).returns key
|
88
|
-
|
89
|
-
@cr = stub('certificate request', :save => true)
|
90
|
-
Puppet::SSL::CertificateRequest.stubs(:new).returns @cr
|
91
|
-
end
|
92
|
-
|
93
|
-
describe "explicitly specified" do
|
94
|
-
before :each do
|
95
|
-
Puppet[:dns_alt_names] = 'one, two'
|
96
|
-
end
|
97
|
-
|
98
|
-
it "should not include subjectAltName if not the local node" do
|
99
|
-
@cr.expects(:generate).with(@key, {})
|
100
|
-
|
101
|
-
Puppet::SSL::Host.new('not-the-' + Puppet[:certname]).generate
|
102
|
-
end
|
103
|
-
|
104
|
-
it "should include subjectAltName if I am a CA" do
|
105
|
-
@cr.expects(:generate).
|
106
|
-
with(@key, { :dns_alt_names => Puppet[:dns_alt_names] })
|
107
|
-
|
108
|
-
Puppet::SSL::Host.localhost
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
describe "implicitly defaulted" do
|
113
|
-
let(:ca) { stub('ca', :sign => nil) }
|
114
|
-
|
115
|
-
before :each do
|
116
|
-
Puppet[:dns_alt_names] = ''
|
117
|
-
|
118
|
-
Puppet::SSL::CertificateAuthority.stubs(:instance).returns ca
|
119
|
-
end
|
120
|
-
|
121
|
-
it "should not include defaults if we're not the CA" do
|
122
|
-
Puppet::SSL::CertificateAuthority.stubs(:ca?).returns false
|
123
|
-
|
124
|
-
@cr.expects(:generate).with(@key, {})
|
125
|
-
|
126
|
-
Puppet::SSL::Host.localhost
|
127
|
-
end
|
128
|
-
|
129
|
-
it "should not include defaults if not the local node" do
|
130
|
-
Puppet::SSL::CertificateAuthority.stubs(:ca?).returns true
|
131
|
-
|
132
|
-
@cr.expects(:generate).with(@key, {})
|
133
|
-
|
134
|
-
Puppet::SSL::Host.new('not-the-' + Puppet[:certname]).generate
|
135
|
-
end
|
136
|
-
|
137
|
-
it "should not include defaults if we can't resolve our fqdn" do
|
138
|
-
Puppet::SSL::CertificateAuthority.stubs(:ca?).returns true
|
139
|
-
Facter.stubs(:value).with(:fqdn).returns nil
|
140
|
-
|
141
|
-
@cr.expects(:generate).with(@key, {})
|
142
|
-
|
143
|
-
Puppet::SSL::Host.localhost
|
144
|
-
end
|
145
|
-
|
146
|
-
it "should provide defaults if we're bootstrapping the local master" do
|
147
|
-
Puppet::SSL::CertificateAuthority.stubs(:ca?).returns true
|
148
|
-
Facter.stubs(:value).with(:fqdn).returns 'web.foo.com'
|
149
|
-
Facter.stubs(:value).with(:domain).returns 'foo.com'
|
150
|
-
|
151
|
-
@cr.expects(:generate).with(@key, {:dns_alt_names => "puppet, web.foo.com, puppet.foo.com"})
|
152
|
-
|
153
|
-
Puppet::SSL::Host.localhost
|
154
|
-
end
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
69
|
it "should always read the key for the localhost instance in from disk" do
|
159
70
|
host = stub 'host', :certificate => "eh"
|
160
71
|
Puppet::SSL::Host.expects(:new).returns host
|
@@ -231,13 +142,6 @@ describe Puppet::SSL::Host do
|
|
231
142
|
end
|
232
143
|
|
233
144
|
describe "when specifying the CA location" do
|
234
|
-
before do
|
235
|
-
[Puppet::SSL::Key, Puppet::SSL::Certificate, Puppet::SSL::CertificateRequest, Puppet::SSL::CertificateRevocationList].each do |klass|
|
236
|
-
klass.stubs(:terminus_class=)
|
237
|
-
klass.stubs(:cache_class=)
|
238
|
-
end
|
239
|
-
end
|
240
|
-
|
241
145
|
it "should support the location ':local'" do
|
242
146
|
lambda { Puppet::SSL::Host.ca_location = :local }.should_not raise_error
|
243
147
|
end
|
@@ -259,80 +163,88 @@ describe Puppet::SSL::Host do
|
|
259
163
|
end
|
260
164
|
|
261
165
|
describe "as 'local'" do
|
262
|
-
|
263
|
-
Puppet::SSL::Certificate.expects(:cache_class=).with :file
|
264
|
-
Puppet::SSL::CertificateRequest.expects(:cache_class=).with :file
|
265
|
-
Puppet::SSL::CertificateRevocationList.expects(:cache_class=).with :file
|
266
|
-
|
166
|
+
before do
|
267
167
|
Puppet::SSL::Host.ca_location = :local
|
268
168
|
end
|
269
169
|
|
270
|
-
it "should set the
|
271
|
-
Puppet::SSL::
|
170
|
+
it "should set the cache class for Certificate, CertificateRevocationList, and CertificateRequest as :file" do
|
171
|
+
Puppet::SSL::Certificate.indirection.cache_class.should == :file
|
172
|
+
Puppet::SSL::CertificateRequest.indirection.cache_class.should == :file
|
173
|
+
Puppet::SSL::CertificateRevocationList.indirection.cache_class.should == :file
|
174
|
+
end
|
272
175
|
|
273
|
-
|
176
|
+
it "should set the terminus class for Key and Host as :file" do
|
177
|
+
Puppet::SSL::Key.indirection.terminus_class.should == :file
|
178
|
+
Puppet::SSL::Host.indirection.terminus_class.should == :file
|
274
179
|
end
|
275
180
|
|
276
181
|
it "should set the terminus class for Certificate, CertificateRevocationList, and CertificateRequest as :ca" do
|
277
|
-
Puppet::SSL::Certificate.
|
278
|
-
Puppet::SSL::CertificateRequest.
|
279
|
-
Puppet::SSL::CertificateRevocationList.
|
280
|
-
|
281
|
-
Puppet::SSL::Host.ca_location = :local
|
182
|
+
Puppet::SSL::Certificate.indirection.terminus_class.should == :ca
|
183
|
+
Puppet::SSL::CertificateRequest.indirection.terminus_class.should == :ca
|
184
|
+
Puppet::SSL::CertificateRevocationList.indirection.terminus_class.should == :ca
|
282
185
|
end
|
283
186
|
end
|
284
187
|
|
285
188
|
describe "as 'remote'" do
|
286
|
-
|
287
|
-
Puppet::SSL::Certificate.expects(:cache_class=).with :file
|
288
|
-
Puppet::SSL::CertificateRequest.expects(:cache_class=).with :file
|
289
|
-
Puppet::SSL::CertificateRevocationList.expects(:cache_class=).with :file
|
290
|
-
|
189
|
+
before do
|
291
190
|
Puppet::SSL::Host.ca_location = :remote
|
292
191
|
end
|
293
192
|
|
294
|
-
it "should set the
|
295
|
-
Puppet::SSL::
|
296
|
-
|
297
|
-
Puppet::SSL::
|
193
|
+
it "should set the cache class for Certificate, CertificateRevocationList, and CertificateRequest as :file" do
|
194
|
+
Puppet::SSL::Certificate.indirection.cache_class.should == :file
|
195
|
+
Puppet::SSL::CertificateRequest.indirection.cache_class.should == :file
|
196
|
+
Puppet::SSL::CertificateRevocationList.indirection.cache_class.should == :file
|
298
197
|
end
|
299
198
|
|
300
|
-
it "should set the terminus class for
|
301
|
-
Puppet::SSL::
|
302
|
-
|
303
|
-
Puppet::SSL::CertificateRevocationList.expects(:terminus_class=).with :rest
|
199
|
+
it "should set the terminus class for Key as :file" do
|
200
|
+
Puppet::SSL::Key.indirection.terminus_class.should == :file
|
201
|
+
end
|
304
202
|
|
305
|
-
|
203
|
+
it "should set the terminus class for Host, Certificate, CertificateRevocationList, and CertificateRequest as :rest" do
|
204
|
+
Puppet::SSL::Host.indirection.terminus_class.should == :rest
|
205
|
+
Puppet::SSL::Certificate.indirection.terminus_class.should == :rest
|
206
|
+
Puppet::SSL::CertificateRequest.indirection.terminus_class.should == :rest
|
207
|
+
Puppet::SSL::CertificateRevocationList.indirection.terminus_class.should == :rest
|
306
208
|
end
|
307
209
|
end
|
308
210
|
|
309
211
|
describe "as 'only'" do
|
310
|
-
|
311
|
-
Puppet::SSL::Key.expects(:terminus_class=).with :ca
|
312
|
-
Puppet::SSL::Certificate.expects(:terminus_class=).with :ca
|
313
|
-
Puppet::SSL::CertificateRequest.expects(:terminus_class=).with :ca
|
314
|
-
Puppet::SSL::CertificateRevocationList.expects(:terminus_class=).with :ca
|
315
|
-
|
212
|
+
before do
|
316
213
|
Puppet::SSL::Host.ca_location = :only
|
317
214
|
end
|
318
215
|
|
319
|
-
it "should
|
320
|
-
Puppet::SSL::
|
321
|
-
Puppet::SSL::
|
322
|
-
Puppet::SSL::
|
216
|
+
it "should set the terminus class for Key, Certificate, CertificateRevocationList, and CertificateRequest as :ca" do
|
217
|
+
Puppet::SSL::Key.indirection.terminus_class.should == :ca
|
218
|
+
Puppet::SSL::Certificate.indirection.terminus_class.should == :ca
|
219
|
+
Puppet::SSL::CertificateRequest.indirection.terminus_class.should == :ca
|
220
|
+
Puppet::SSL::CertificateRevocationList.indirection.terminus_class.should == :ca
|
221
|
+
end
|
323
222
|
|
324
|
-
|
223
|
+
it "should set the cache class for Certificate, CertificateRevocationList, and CertificateRequest to nil" do
|
224
|
+
Puppet::SSL::Certificate.indirection.cache_class.should be_nil
|
225
|
+
Puppet::SSL::CertificateRequest.indirection.cache_class.should be_nil
|
226
|
+
Puppet::SSL::CertificateRevocationList.indirection.cache_class.should be_nil
|
227
|
+
end
|
228
|
+
|
229
|
+
it "should set the terminus class for Host to :file" do
|
230
|
+
Puppet::SSL::Host.indirection.terminus_class.should == :file
|
325
231
|
end
|
326
232
|
end
|
327
233
|
|
328
234
|
describe "as 'none'" do
|
235
|
+
before do
|
236
|
+
Puppet::SSL::Host.ca_location = :none
|
237
|
+
end
|
238
|
+
|
329
239
|
it "should set the terminus class for Key, Certificate, CertificateRevocationList, and CertificateRequest as :file" do
|
330
|
-
Puppet::SSL::Key.
|
331
|
-
Puppet::SSL::Certificate.
|
332
|
-
Puppet::SSL::CertificateRequest.
|
333
|
-
Puppet::SSL::CertificateRevocationList.
|
240
|
+
Puppet::SSL::Key.indirection.terminus_class.should == :file
|
241
|
+
Puppet::SSL::Certificate.indirection.terminus_class.should == :file
|
242
|
+
Puppet::SSL::CertificateRequest.indirection.terminus_class.should == :file
|
243
|
+
Puppet::SSL::CertificateRevocationList.indirection.terminus_class.should == :file
|
244
|
+
end
|
334
245
|
|
335
|
-
|
246
|
+
it "should set the terminus class for Host to 'none'" do
|
247
|
+
lambda { Puppet::SSL::Host.indirection.terminus_class }.should raise_error(Puppet::DevError)
|
336
248
|
end
|
337
249
|
end
|
338
250
|
end
|
@@ -343,27 +255,27 @@ describe Puppet::SSL::Host do
|
|
343
255
|
|
344
256
|
describe "when destroying a host's SSL files" do
|
345
257
|
before do
|
346
|
-
Puppet::SSL::Key.stubs(:destroy).returns false
|
347
|
-
Puppet::SSL::Certificate.stubs(:destroy).returns false
|
348
|
-
Puppet::SSL::CertificateRequest.stubs(:destroy).returns false
|
258
|
+
Puppet::SSL::Key.indirection.stubs(:destroy).returns false
|
259
|
+
Puppet::SSL::Certificate.indirection.stubs(:destroy).returns false
|
260
|
+
Puppet::SSL::CertificateRequest.indirection.stubs(:destroy).returns false
|
349
261
|
end
|
350
262
|
|
351
263
|
it "should destroy its certificate, certificate request, and key" do
|
352
|
-
Puppet::SSL::Key.expects(:destroy).with("myhost")
|
353
|
-
Puppet::SSL::Certificate.expects(:destroy).with("myhost")
|
354
|
-
Puppet::SSL::CertificateRequest.expects(:destroy).with("myhost")
|
264
|
+
Puppet::SSL::Key.indirection.expects(:destroy).with("myhost")
|
265
|
+
Puppet::SSL::Certificate.indirection.expects(:destroy).with("myhost")
|
266
|
+
Puppet::SSL::CertificateRequest.indirection.expects(:destroy).with("myhost")
|
355
267
|
|
356
268
|
Puppet::SSL::Host.destroy("myhost")
|
357
269
|
end
|
358
270
|
|
359
271
|
it "should return true if any of the classes returned true" do
|
360
|
-
Puppet::SSL::Certificate.expects(:destroy).with("myhost").returns true
|
272
|
+
Puppet::SSL::Certificate.indirection.expects(:destroy).with("myhost").returns true
|
361
273
|
|
362
274
|
Puppet::SSL::Host.destroy("myhost").should be_true
|
363
275
|
end
|
364
276
|
|
365
|
-
it "should
|
366
|
-
Puppet::SSL::Host.destroy("myhost").should
|
277
|
+
it "should report that nothing was deleted if none of the classes returned true" do
|
278
|
+
Puppet::SSL::Host.destroy("myhost").should == "Nothing was deleted"
|
367
279
|
end
|
368
280
|
end
|
369
281
|
|
@@ -392,16 +304,17 @@ describe Puppet::SSL::Host do
|
|
392
304
|
describe "when managing its private key" do
|
393
305
|
before do
|
394
306
|
@realkey = "mykey"
|
395
|
-
@key =
|
307
|
+
@key = Puppet::SSL::Key.new("mykey")
|
308
|
+
@key.content = @realkey
|
396
309
|
end
|
397
310
|
|
398
311
|
it "should return nil if the key is not set and cannot be found" do
|
399
|
-
Puppet::SSL::Key.expects(:find).with("myname").returns(nil)
|
312
|
+
Puppet::SSL::Key.indirection.expects(:find).with("myname").returns(nil)
|
400
313
|
@host.key.should be_nil
|
401
314
|
end
|
402
315
|
|
403
316
|
it "should find the key in the Key class and return the Puppet instance" do
|
404
|
-
Puppet::SSL::Key.expects(:find).with("myname").returns(@key)
|
317
|
+
Puppet::SSL::Key.indirection.expects(:find).with("myname").returns(@key)
|
405
318
|
@host.key.should equal(@key)
|
406
319
|
end
|
407
320
|
|
@@ -409,7 +322,7 @@ describe Puppet::SSL::Host do
|
|
409
322
|
Puppet::SSL::Key.expects(:new).with("myname").returns(@key)
|
410
323
|
|
411
324
|
@key.expects(:generate)
|
412
|
-
|
325
|
+
Puppet::SSL::Key.indirection.expects(:save)
|
413
326
|
|
414
327
|
@host.generate_key.should be_true
|
415
328
|
@host.key.should equal(@key)
|
@@ -419,14 +332,14 @@ describe Puppet::SSL::Host do
|
|
419
332
|
Puppet::SSL::Key.expects(:new).with("myname").returns(@key)
|
420
333
|
|
421
334
|
@key.stubs(:generate)
|
422
|
-
|
335
|
+
Puppet::SSL::Key.indirection.expects(:save).raises "eh"
|
423
336
|
|
424
337
|
lambda { @host.generate_key }.should raise_error
|
425
338
|
@host.key.should be_nil
|
426
339
|
end
|
427
340
|
|
428
341
|
it "should return any previously found key without requerying" do
|
429
|
-
Puppet::SSL::Key.expects(:find).with("myname").returns(@key).once
|
342
|
+
Puppet::SSL::Key.indirection.expects(:find).with("myname").returns(@key).once
|
430
343
|
@host.key.should equal(@key)
|
431
344
|
@host.key.should equal(@key)
|
432
345
|
end
|
@@ -435,16 +348,17 @@ describe Puppet::SSL::Host do
|
|
435
348
|
describe "when managing its certificate request" do
|
436
349
|
before do
|
437
350
|
@realrequest = "real request"
|
438
|
-
@request =
|
351
|
+
@request = Puppet::SSL::CertificateRequest.new("myname")
|
352
|
+
@request.content = @realrequest
|
439
353
|
end
|
440
354
|
|
441
355
|
it "should return nil if the key is not set and cannot be found" do
|
442
|
-
Puppet::SSL::CertificateRequest.expects(:find).with("myname").returns(nil)
|
356
|
+
Puppet::SSL::CertificateRequest.indirection.expects(:find).with("myname").returns(nil)
|
443
357
|
@host.certificate_request.should be_nil
|
444
358
|
end
|
445
359
|
|
446
360
|
it "should find the request in the Key class and return it and return the Puppet SSL request" do
|
447
|
-
Puppet::SSL::CertificateRequest.expects(:find).with("myname").returns @request
|
361
|
+
Puppet::SSL::CertificateRequest.indirection.expects(:find).with("myname").returns @request
|
448
362
|
|
449
363
|
@host.certificate_request.should equal(@request)
|
450
364
|
end
|
@@ -458,7 +372,7 @@ describe Puppet::SSL::Host do
|
|
458
372
|
@host.expects(:generate_key).returns(key)
|
459
373
|
|
460
374
|
@request.stubs(:generate)
|
461
|
-
|
375
|
+
Puppet::SSL::CertificateRequest.indirection.stubs(:save)
|
462
376
|
|
463
377
|
@host.generate_certificate_request
|
464
378
|
end
|
@@ -468,15 +382,15 @@ describe Puppet::SSL::Host do
|
|
468
382
|
|
469
383
|
key = stub 'key', :public_key => mock("public_key"), :content => "mycontent"
|
470
384
|
@host.stubs(:key).returns(key)
|
471
|
-
@request.expects(:generate).with("mycontent"
|
472
|
-
|
385
|
+
@request.expects(:generate).with("mycontent")
|
386
|
+
Puppet::SSL::CertificateRequest.indirection.expects(:save).with(@request)
|
473
387
|
|
474
388
|
@host.generate_certificate_request.should be_true
|
475
389
|
@host.certificate_request.should equal(@request)
|
476
390
|
end
|
477
391
|
|
478
392
|
it "should return any previously found request without requerying" do
|
479
|
-
Puppet::SSL::CertificateRequest.expects(:find).with("myname").returns(@request).once
|
393
|
+
Puppet::SSL::CertificateRequest.indirection.expects(:find).with("myname").returns(@request).once
|
480
394
|
|
481
395
|
@host.certificate_request.should equal(@request)
|
482
396
|
@host.certificate_request.should equal(@request)
|
@@ -488,11 +402,14 @@ describe Puppet::SSL::Host do
|
|
488
402
|
key = stub 'key', :public_key => mock("public_key"), :content => "mycontent"
|
489
403
|
@host.stubs(:key).returns(key)
|
490
404
|
@request.stubs(:generate)
|
491
|
-
@request.
|
405
|
+
@request.stubs(:name).returns("myname")
|
406
|
+
terminus = stub 'terminus'
|
407
|
+
Puppet::SSL::CertificateRequest.indirection.expects(:prepare).returns(terminus)
|
408
|
+
terminus.expects(:save).with { |req| req.instance == @request && req.key == "myname" }.raises "eh"
|
492
409
|
|
493
410
|
lambda { @host.generate_certificate_request }.should raise_error
|
494
411
|
|
495
|
-
@host.certificate_request.should be_nil
|
412
|
+
@host.instance_eval { @certificate_request }.should be_nil
|
496
413
|
end
|
497
414
|
end
|
498
415
|
|
@@ -506,36 +423,36 @@ describe Puppet::SSL::Host do
|
|
506
423
|
end
|
507
424
|
|
508
425
|
it "should find the CA certificate if it does not have a certificate" do
|
509
|
-
Puppet::SSL::Certificate.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert")
|
510
|
-
Puppet::SSL::Certificate.stubs(:find).with("myname").returns @cert
|
426
|
+
Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert")
|
427
|
+
Puppet::SSL::Certificate.indirection.stubs(:find).with("myname").returns @cert
|
511
428
|
|
512
429
|
@host.certificate
|
513
430
|
end
|
514
431
|
|
515
432
|
it "should not find the CA certificate if it is the CA host" do
|
516
433
|
@host.expects(:ca?).returns true
|
517
|
-
Puppet::SSL::Certificate.stubs(:find)
|
518
|
-
Puppet::SSL::Certificate.expects(:find).with(Puppet::SSL::CA_NAME).never
|
434
|
+
Puppet::SSL::Certificate.indirection.stubs(:find)
|
435
|
+
Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).never
|
519
436
|
|
520
437
|
@host.certificate
|
521
438
|
end
|
522
439
|
|
523
440
|
it "should return nil if it cannot find a CA certificate" do
|
524
|
-
Puppet::SSL::Certificate.expects(:find).with(Puppet::SSL::CA_NAME).returns nil
|
525
|
-
Puppet::SSL::Certificate.expects(:find).with("myname").never
|
441
|
+
Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).returns nil
|
442
|
+
Puppet::SSL::Certificate.indirection.expects(:find).with("myname").never
|
526
443
|
|
527
444
|
@host.certificate.should be_nil
|
528
445
|
end
|
529
446
|
|
530
447
|
it "should find the key if it does not have one" do
|
531
|
-
Puppet::SSL::Certificate.stubs(:find)
|
448
|
+
Puppet::SSL::Certificate.indirection.stubs(:find)
|
532
449
|
@host.expects(:key).returns mock("key")
|
533
450
|
|
534
451
|
@host.certificate
|
535
452
|
end
|
536
453
|
|
537
454
|
it "should generate the key if one cannot be found" do
|
538
|
-
Puppet::SSL::Certificate.stubs(:find)
|
455
|
+
Puppet::SSL::Certificate.indirection.stubs(:find)
|
539
456
|
|
540
457
|
@host.expects(:key).returns nil
|
541
458
|
@host.expects(:generate_key)
|
@@ -544,8 +461,8 @@ describe Puppet::SSL::Host do
|
|
544
461
|
end
|
545
462
|
|
546
463
|
it "should find the certificate in the Certificate class and return the Puppet certificate instance" do
|
547
|
-
Puppet::SSL::Certificate.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert")
|
548
|
-
Puppet::SSL::Certificate.expects(:find).with("myname").returns @cert
|
464
|
+
Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert")
|
465
|
+
Puppet::SSL::Certificate.indirection.expects(:find).with("myname").returns @cert
|
549
466
|
|
550
467
|
@host.certificate.should equal(@cert)
|
551
468
|
end
|
@@ -553,14 +470,14 @@ describe Puppet::SSL::Host do
|
|
553
470
|
it "should fail if the found certificate does not match the private key" do
|
554
471
|
@host.expects(:certificate_matches_key?).returns false
|
555
472
|
|
556
|
-
Puppet::SSL::Certificate.stubs(:find).returns @cert
|
473
|
+
Puppet::SSL::Certificate.indirection.stubs(:find).returns @cert
|
557
474
|
|
558
475
|
lambda { @host.certificate }.should raise_error(Puppet::Error)
|
559
476
|
end
|
560
477
|
|
561
478
|
it "should return any previously found certificate" do
|
562
|
-
Puppet::SSL::Certificate.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert")
|
563
|
-
Puppet::SSL::Certificate.expects(:find).with("myname").returns(@cert).once
|
479
|
+
Puppet::SSL::Certificate.indirection.expects(:find).with(Puppet::SSL::CA_NAME).returns mock("cacert")
|
480
|
+
Puppet::SSL::Certificate.indirection.expects(:find).with("myname").returns(@cert).once
|
564
481
|
|
565
482
|
@host.certificate.should equal(@cert)
|
566
483
|
@host.certificate.should equal(@cert)
|
@@ -573,41 +490,41 @@ describe Puppet::SSL::Host do
|
|
573
490
|
|
574
491
|
describe "when listing certificate hosts" do
|
575
492
|
it "should default to listing all clients with any file types" do
|
576
|
-
Puppet::SSL::Key.expects(:search).returns []
|
577
|
-
Puppet::SSL::Certificate.expects(:search).returns []
|
578
|
-
Puppet::SSL::CertificateRequest.expects(:search).returns []
|
493
|
+
Puppet::SSL::Key.indirection.expects(:search).returns []
|
494
|
+
Puppet::SSL::Certificate.indirection.expects(:search).returns []
|
495
|
+
Puppet::SSL::CertificateRequest.indirection.expects(:search).returns []
|
579
496
|
Puppet::SSL::Host.search
|
580
497
|
end
|
581
498
|
|
582
499
|
it "should be able to list only clients with a key" do
|
583
|
-
Puppet::SSL::Key.expects(:search).returns []
|
584
|
-
Puppet::SSL::Certificate.expects(:search).never
|
585
|
-
Puppet::SSL::CertificateRequest.expects(:search).never
|
500
|
+
Puppet::SSL::Key.indirection.expects(:search).returns []
|
501
|
+
Puppet::SSL::Certificate.indirection.expects(:search).never
|
502
|
+
Puppet::SSL::CertificateRequest.indirection.expects(:search).never
|
586
503
|
Puppet::SSL::Host.search :for => Puppet::SSL::Key
|
587
504
|
end
|
588
505
|
|
589
506
|
it "should be able to list only clients with a certificate" do
|
590
|
-
Puppet::SSL::Key.expects(:search).never
|
591
|
-
Puppet::SSL::Certificate.expects(:search).returns []
|
592
|
-
Puppet::SSL::CertificateRequest.expects(:search).never
|
507
|
+
Puppet::SSL::Key.indirection.expects(:search).never
|
508
|
+
Puppet::SSL::Certificate.indirection.expects(:search).returns []
|
509
|
+
Puppet::SSL::CertificateRequest.indirection.expects(:search).never
|
593
510
|
Puppet::SSL::Host.search :for => Puppet::SSL::Certificate
|
594
511
|
end
|
595
512
|
|
596
513
|
it "should be able to list only clients with a certificate request" do
|
597
|
-
Puppet::SSL::Key.expects(:search).never
|
598
|
-
Puppet::SSL::Certificate.expects(:search).never
|
599
|
-
Puppet::SSL::CertificateRequest.expects(:search).returns []
|
514
|
+
Puppet::SSL::Key.indirection.expects(:search).never
|
515
|
+
Puppet::SSL::Certificate.indirection.expects(:search).never
|
516
|
+
Puppet::SSL::CertificateRequest.indirection.expects(:search).returns []
|
600
517
|
Puppet::SSL::Host.search :for => Puppet::SSL::CertificateRequest
|
601
518
|
end
|
602
519
|
|
603
|
-
it "should return a Host instance created with the name of each found instance" do
|
520
|
+
it "should return a Host instance created with the name of each found instance", :'fails_on_ruby_1.9.2' => true do
|
604
521
|
key = stub 'key', :name => "key"
|
605
522
|
cert = stub 'cert', :name => "cert"
|
606
523
|
csr = stub 'csr', :name => "csr"
|
607
524
|
|
608
|
-
Puppet::SSL::Key.expects(:search).returns [key]
|
609
|
-
Puppet::SSL::Certificate.expects(:search).returns [cert]
|
610
|
-
Puppet::SSL::CertificateRequest.expects(:search).returns [csr]
|
525
|
+
Puppet::SSL::Key.indirection.expects(:search).returns [key]
|
526
|
+
Puppet::SSL::Certificate.indirection.expects(:search).returns [cert]
|
527
|
+
Puppet::SSL::CertificateRequest.indirection.expects(:search).returns [csr]
|
611
528
|
|
612
529
|
returned = []
|
613
530
|
%w{key cert csr}.each do |name|
|
@@ -657,7 +574,7 @@ describe Puppet::SSL::Host do
|
|
657
574
|
it "should use the CA to sign its certificate request if it does not have a certificate" do
|
658
575
|
@host.expects(:certificate).returns nil
|
659
576
|
|
660
|
-
@ca.expects(:sign).with(@host.name
|
577
|
+
@ca.expects(:sign).with(@host.name)
|
661
578
|
|
662
579
|
@host.generate
|
663
580
|
end
|
@@ -697,7 +614,7 @@ describe Puppet::SSL::Host do
|
|
697
614
|
|
698
615
|
Puppet.settings.stubs(:value).with(:localcacert).returns "ssl_host_testing"
|
699
616
|
|
700
|
-
Puppet::SSL::CertificateRevocationList.stubs(:find).returns(nil)
|
617
|
+
Puppet::SSL::CertificateRevocationList.indirection.stubs(:find).returns(nil)
|
701
618
|
end
|
702
619
|
|
703
620
|
it "should accept a purpose" do
|
@@ -719,7 +636,7 @@ describe Puppet::SSL::Host do
|
|
719
636
|
describe "and a CRL is available" do
|
720
637
|
before do
|
721
638
|
@crl = stub 'crl', :content => "real_crl"
|
722
|
-
Puppet::SSL::CertificateRevocationList.stubs(:find).returns @crl
|
639
|
+
Puppet::SSL::CertificateRevocationList.indirection.stubs(:find).returns @crl
|
723
640
|
Puppet.settings.stubs(:value).with(:certificate_revocation).returns true
|
724
641
|
end
|
725
642
|
|
@@ -764,16 +681,14 @@ describe Puppet::SSL::Host do
|
|
764
681
|
@host.expects(:certificate).returns(nil)
|
765
682
|
@host.expects(:generate).raises(RuntimeError)
|
766
683
|
@host.expects(:puts)
|
767
|
-
@host.
|
768
|
-
lambda { @host.wait_for_cert(0) }.should raise_error(SystemExit)
|
684
|
+
expect { @host.wait_for_cert(0) }.to exit_with 1
|
769
685
|
end
|
770
686
|
|
771
687
|
it "should exit if the wait time is 0 and it can neither find nor retrieve a certificate" do
|
772
688
|
@host.stubs(:certificate).returns nil
|
773
689
|
@host.expects(:generate)
|
774
690
|
@host.expects(:puts)
|
775
|
-
@host.
|
776
|
-
lambda { @host.wait_for_cert(0) }.should raise_error(SystemExit)
|
691
|
+
expect { @host.wait_for_cert(0) }.to exit_with 1
|
777
692
|
end
|
778
693
|
|
779
694
|
it "should sleep for the specified amount of time if no certificate is found after generating its certificate request" do
|
@@ -795,4 +710,84 @@ describe Puppet::SSL::Host do
|
|
795
710
|
@host.wait_for_cert(1)
|
796
711
|
end
|
797
712
|
end
|
713
|
+
|
714
|
+
describe "when handling PSON" do
|
715
|
+
include PuppetSpec::Files
|
716
|
+
|
717
|
+
before do
|
718
|
+
Puppet[:vardir] = tmpdir("ssl_test_vardir")
|
719
|
+
Puppet[:ssldir] = tmpdir("ssl_test_ssldir")
|
720
|
+
Puppet::SSLCertificates::CA.new.mkrootcert
|
721
|
+
# localcacert is where each client stores the CA certificate
|
722
|
+
# cacert is where the master stores the CA certificate
|
723
|
+
# Since we need to play the role of both for testing we need them to be the same and exist
|
724
|
+
Puppet[:cacert] = Puppet[:localcacert]
|
725
|
+
|
726
|
+
@ca=Puppet::SSL::CertificateAuthority.new
|
727
|
+
end
|
728
|
+
|
729
|
+
describe "when converting to PSON" do
|
730
|
+
it "should be able to identify a host with an unsigned certificate request" do
|
731
|
+
host = Puppet::SSL::Host.new("bazinga")
|
732
|
+
host.generate_certificate_request
|
733
|
+
pson_hash = {
|
734
|
+
"fingerprint" => host.certificate_request.fingerprint,
|
735
|
+
"desired_state" => 'requested',
|
736
|
+
"name" => host.name
|
737
|
+
}
|
738
|
+
|
739
|
+
result = PSON.parse(Puppet::SSL::Host.new(host.name).to_pson)
|
740
|
+
result["fingerprint"].should == pson_hash["fingerprint"]
|
741
|
+
result["name"].should == pson_hash["name"]
|
742
|
+
result["state"].should == pson_hash["desired_state"]
|
743
|
+
end
|
744
|
+
|
745
|
+
it "should be able to identify a host with a signed certificate" do
|
746
|
+
host = Puppet::SSL::Host.new("bazinga")
|
747
|
+
host.generate_certificate_request
|
748
|
+
@ca.sign(host.name)
|
749
|
+
pson_hash = {
|
750
|
+
"fingerprint" => Puppet::SSL::Certificate.indirection.find(host.name).fingerprint,
|
751
|
+
"desired_state" => 'signed',
|
752
|
+
"name" => host.name,
|
753
|
+
}
|
754
|
+
|
755
|
+
result = PSON.parse(Puppet::SSL::Host.new(host.name).to_pson)
|
756
|
+
result["fingerprint"].should == pson_hash["fingerprint"]
|
757
|
+
result["name"].should == pson_hash["name"]
|
758
|
+
result["state"].should == pson_hash["desired_state"]
|
759
|
+
end
|
760
|
+
|
761
|
+
it "should be able to identify a host with a revoked certificate" do
|
762
|
+
host = Puppet::SSL::Host.new("bazinga")
|
763
|
+
host.generate_certificate_request
|
764
|
+
@ca.sign(host.name)
|
765
|
+
@ca.revoke(host.name)
|
766
|
+
pson_hash = {
|
767
|
+
"fingerprint" => Puppet::SSL::Certificate.indirection.find(host.name).fingerprint,
|
768
|
+
"desired_state" => 'revoked',
|
769
|
+
"name" => host.name,
|
770
|
+
}
|
771
|
+
|
772
|
+
result = PSON.parse(Puppet::SSL::Host.new(host.name).to_pson)
|
773
|
+
result["fingerprint"].should == pson_hash["fingerprint"]
|
774
|
+
result["name"].should == pson_hash["name"]
|
775
|
+
result["state"].should == pson_hash["desired_state"]
|
776
|
+
end
|
777
|
+
end
|
778
|
+
|
779
|
+
describe "when converting from PSON" do
|
780
|
+
it "should return a Puppet::SSL::Host object with the specified desired state" do
|
781
|
+
host = Puppet::SSL::Host.new("bazinga")
|
782
|
+
host.desired_state="signed"
|
783
|
+
pson_hash = {
|
784
|
+
"name" => host.name,
|
785
|
+
"desired_state" => host.desired_state,
|
786
|
+
}
|
787
|
+
generated_host = Puppet::SSL::Host.from_pson(pson_hash)
|
788
|
+
generated_host.desired_state.should == host.desired_state
|
789
|
+
generated_host.name.should == host.name
|
790
|
+
end
|
791
|
+
end
|
792
|
+
end
|
798
793
|
end
|