puppet 0.25.5 → 2.6.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of puppet might be problematic. Click here for more details.
- data/CHANGELOG +667 -0
- data/LICENSE +2 -2
- data/README +5 -1
- data/README.queueing +1 -1
- data/README.rst +7 -4
- data/Rakefile +6 -18
- data/bin/filebucket +0 -94
- data/bin/pi +2 -47
- data/bin/puppet +2 -69
- data/bin/puppetca +2 -100
- data/bin/puppetd +2 -158
- data/bin/puppetdoc +2 -63
- data/bin/puppetmasterd +2 -64
- data/bin/puppetqd +2 -51
- data/bin/puppetrun +2 -127
- data/bin/ralsh +2 -87
- data/conf/epm.list +2 -2
- data/conf/osx/PackageInfo.plist +1 -1
- data/conf/redhat/client.init +11 -8
- data/conf/redhat/puppet.conf +1 -1
- data/conf/redhat/puppet.spec +1 -1
- data/conf/redhat/rundir-perms.patch +13 -13
- data/conf/redhat/server.init +11 -5
- data/conf/solaris/pkginfo +2 -2
- data/conf/solaris/smf/puppetd.xml +3 -3
- data/conf/solaris/smf/puppetmasterd.xml +3 -3
- data/conf/suse/client.init +3 -2
- data/conf/suse/puppet.spec +22 -18
- data/conf/suse/server.init +12 -11
- data/examples/modules/sample-module/README.txt +3 -3
- data/examples/modules/sample-module/lib/puppet/parser/functions/hostname_to_dn.rb +4 -4
- data/ext/extlookup.rb +94 -96
- data/ext/nagios/check_puppet.rb +94 -88
- data/ext/nagios/naggen +3 -3
- data/ext/puppet-test +27 -3
- data/ext/puppetlisten/puppetlisten.rb +39 -39
- data/ext/puppetlisten/puppetrun.rb +6 -6
- data/ext/puppetstoredconfigclean.rb +49 -43
- data/ext/pure_ruby_dsl/dsl_test.rb +7 -0
- data/ext/regexp_nodes/regexp_nodes.rb +133 -133
- data/ext/yaml_nodes.rb +99 -0
- data/install.rb +109 -118
- data/lib/puppet.rb +118 -131
- data/lib/puppet/agent.rb +86 -119
- data/lib/puppet/agent/locker.rb +28 -30
- data/lib/puppet/application.rb +276 -184
- data/lib/puppet/application/agent.rb +266 -0
- data/lib/puppet/application/apply.rb +165 -0
- data/lib/puppet/application/cert.rb +85 -0
- data/lib/puppet/application/describe.rb +203 -0
- data/lib/puppet/application/doc.rb +215 -0
- data/lib/puppet/application/filebucket.rb +73 -73
- data/lib/puppet/application/kick.rb +212 -0
- data/lib/puppet/application/master.rb +156 -0
- data/lib/puppet/application/queue.rb +91 -0
- data/lib/puppet/application/resource.rb +118 -0
- data/lib/puppet/configurer.rb +214 -197
- data/lib/puppet/configurer/downloader.rb +63 -63
- data/lib/puppet/configurer/fact_handler.rb +51 -51
- data/lib/puppet/configurer/plugin_handler.rb +19 -19
- data/lib/puppet/daemon.rb +100 -103
- data/lib/puppet/defaults.rb +793 -796
- data/lib/puppet/dsl.rb +5 -269
- data/lib/puppet/dsl/resource_api.rb +120 -0
- data/lib/puppet/dsl/resource_type_api.rb +40 -0
- data/lib/puppet/error.rb +34 -36
- data/lib/puppet/external/base64.rb +8 -8
- data/lib/puppet/external/dot.rb +262 -262
- data/lib/puppet/external/event-loop/better-definers.rb +297 -297
- data/lib/puppet/external/event-loop/event-loop.rb +264 -272
- data/lib/puppet/external/event-loop/signal-system.rb +161 -163
- data/lib/puppet/external/lock.rb +41 -41
- data/lib/puppet/external/nagios.rb +32 -32
- data/lib/puppet/external/nagios/base.rb +453 -458
- data/lib/puppet/external/nagios/parser.rb +264 -287
- data/lib/puppet/external/pson/common.rb +8 -5
- data/lib/puppet/external/pson/pure/generator.rb +26 -26
- data/lib/puppet/external/pson/pure/parser.rb +43 -48
- data/lib/puppet/feature/base.rb +21 -1
- data/lib/puppet/feature/pson.rb +4 -4
- data/lib/puppet/feature/rack.rb +14 -14
- data/lib/puppet/feature/rails.rb +23 -25
- data/lib/puppet/file_bucket.rb +4 -0
- data/lib/puppet/file_bucket/dipper.rb +99 -0
- data/lib/puppet/file_bucket/file.rb +136 -0
- data/lib/puppet/file_bucket/file/indirection_hooks.rb +9 -0
- data/lib/puppet/file_collection.rb +20 -20
- data/lib/puppet/file_collection/lookup.rb +11 -11
- data/lib/puppet/file_serving/base.rb +67 -71
- data/lib/puppet/file_serving/configuration.rb +84 -86
- data/lib/puppet/file_serving/configuration/parser.rb +103 -102
- data/lib/puppet/file_serving/content.rb +34 -33
- data/lib/puppet/file_serving/fileset.rb +131 -133
- data/lib/puppet/file_serving/indirection_hooks.rb +17 -17
- data/lib/puppet/file_serving/metadata.rb +98 -95
- data/lib/puppet/file_serving/mount.rb +22 -22
- data/lib/puppet/file_serving/mount/file.rb +101 -106
- data/lib/puppet/file_serving/mount/modules.rb +15 -15
- data/lib/puppet/file_serving/mount/plugins.rb +15 -16
- data/lib/puppet/file_serving/terminus_helper.rb +13 -13
- data/lib/puppet/indirector.rb +48 -49
- data/lib/puppet/indirector/active_record.rb +19 -19
- data/lib/puppet/indirector/catalog/active_record.rb +25 -25
- data/lib/puppet/indirector/catalog/compiler.rb +134 -145
- data/lib/puppet/indirector/catalog/rest.rb +1 -1
- data/lib/puppet/indirector/catalog/yaml.rb +13 -13
- data/lib/puppet/indirector/certificate/ca.rb +3 -3
- data/lib/puppet/indirector/certificate/file.rb +3 -3
- data/lib/puppet/indirector/certificate/rest.rb +8 -8
- data/lib/puppet/indirector/certificate_request/ca.rb +7 -7
- data/lib/puppet/indirector/certificate_request/file.rb +2 -2
- data/lib/puppet/indirector/certificate_request/rest.rb +3 -3
- data/lib/puppet/indirector/certificate_revocation_list/ca.rb +2 -2
- data/lib/puppet/indirector/certificate_revocation_list/file.rb +2 -2
- data/lib/puppet/indirector/certificate_revocation_list/rest.rb +3 -3
- data/lib/puppet/indirector/couch.rb +76 -0
- data/lib/puppet/indirector/direct_file_server.rb +11 -11
- data/lib/puppet/indirector/envelope.rb +4 -4
- data/lib/puppet/indirector/exec.rb +38 -42
- data/lib/puppet/indirector/facts/active_record.rb +24 -24
- data/lib/puppet/indirector/facts/couch.rb +31 -0
- data/lib/puppet/indirector/facts/facter.rb +63 -61
- data/lib/puppet/indirector/facts/memory.rb +4 -4
- data/lib/puppet/indirector/facts/rest.rb +1 -1
- data/lib/puppet/indirector/facts/yaml.rb +2 -2
- data/lib/puppet/indirector/file.rb +67 -46
- data/lib/puppet/indirector/file_bucket_file/file.rb +146 -0
- data/lib/puppet/indirector/file_bucket_file/rest.rb +8 -0
- data/lib/puppet/indirector/file_content/file.rb +1 -1
- data/lib/puppet/indirector/file_content/file_server.rb +1 -1
- data/lib/puppet/indirector/file_content/rest.rb +1 -1
- data/lib/puppet/indirector/file_metadata/file.rb +11 -11
- data/lib/puppet/indirector/file_metadata/file_server.rb +1 -1
- data/lib/puppet/indirector/file_metadata/rest.rb +1 -1
- data/lib/puppet/indirector/file_server.rb +44 -44
- data/lib/puppet/indirector/indirection.rb +249 -260
- data/lib/puppet/indirector/key/ca.rb +5 -5
- data/lib/puppet/indirector/key/file.rb +29 -29
- data/lib/puppet/indirector/ldap.rb +62 -64
- data/lib/puppet/indirector/memory.rb +13 -13
- data/lib/puppet/indirector/node/active_record.rb +6 -6
- data/lib/puppet/indirector/node/exec.rb +40 -44
- data/lib/puppet/indirector/node/ldap.rb +246 -212
- data/lib/puppet/indirector/node/memory.rb +5 -5
- data/lib/puppet/indirector/node/plain.rb +12 -12
- data/lib/puppet/indirector/node/rest.rb +2 -2
- data/lib/puppet/indirector/node/yaml.rb +2 -2
- data/lib/puppet/indirector/plain.rb +4 -4
- data/lib/puppet/indirector/queue.rb +49 -51
- data/lib/puppet/indirector/report/processor.rb +34 -37
- data/lib/puppet/indirector/report/rest.rb +3 -3
- data/lib/puppet/indirector/request.rb +171 -157
- data/lib/puppet/indirector/resource/ral.rb +48 -0
- data/lib/puppet/indirector/resource/rest.rb +5 -0
- data/lib/puppet/indirector/resource_type.rb +5 -0
- data/lib/puppet/indirector/resource_type/parser.rb +27 -0
- data/lib/puppet/indirector/resource_type/rest.rb +7 -0
- data/lib/puppet/indirector/rest.rb +83 -79
- data/lib/puppet/indirector/run/local.rb +8 -0
- data/lib/puppet/indirector/run/rest.rb +6 -0
- data/lib/puppet/indirector/ssl_file.rb +165 -165
- data/lib/puppet/indirector/status.rb +3 -0
- data/lib/puppet/indirector/status/local.rb +7 -0
- data/lib/puppet/indirector/status/rest.rb +5 -0
- data/lib/puppet/indirector/terminus.rb +129 -133
- data/lib/puppet/indirector/yaml.rb +47 -49
- data/lib/puppet/metatype/manager.rb +120 -114
- data/lib/puppet/module.rb +182 -124
- data/lib/puppet/network/authconfig.rb +146 -156
- data/lib/puppet/network/authorization.rb +63 -70
- data/lib/puppet/network/authstore.rb +226 -232
- data/lib/puppet/network/client.rb +141 -152
- data/lib/puppet/network/client/ca.rb +47 -49
- data/lib/puppet/network/client/file.rb +3 -3
- data/lib/puppet/network/client/proxy.rb +19 -19
- data/lib/puppet/network/client/report.rb +17 -21
- data/lib/puppet/network/client/runner.rb +5 -7
- data/lib/puppet/network/client/status.rb +1 -1
- data/lib/puppet/network/client_request.rb +20 -22
- data/lib/puppet/network/format.rb +79 -81
- data/lib/puppet/network/format_handler.rb +135 -130
- data/lib/puppet/network/formats.rb +128 -154
- data/lib/puppet/network/handler.rb +43 -46
- data/lib/puppet/network/handler/ca.rb +129 -135
- data/lib/puppet/network/handler/filebucket.rb +39 -170
- data/lib/puppet/network/handler/fileserver.rb +624 -656
- data/lib/puppet/network/handler/master.rb +62 -75
- data/lib/puppet/network/handler/report.rb +60 -67
- data/lib/puppet/network/handler/runner.rb +20 -20
- data/lib/puppet/network/handler/status.rb +9 -9
- data/lib/puppet/network/http.rb +12 -12
- data/lib/puppet/network/http/api/v1.rb +49 -44
- data/lib/puppet/network/http/compression.rb +111 -0
- data/lib/puppet/network/http/handler.rb +183 -183
- data/lib/puppet/network/http/mongrel.rb +46 -48
- data/lib/puppet/network/http/mongrel/rest.rb +73 -66
- data/lib/puppet/network/http/rack.rb +45 -45
- data/lib/puppet/network/http/rack/httphandler.rb +7 -7
- data/lib/puppet/network/http/rack/rest.rb +84 -61
- data/lib/puppet/network/http/rack/xmlrpc.rb +49 -49
- data/lib/puppet/network/http/webrick.rb +108 -112
- data/lib/puppet/network/http/webrick/rest.rb +60 -57
- data/lib/puppet/network/http_pool.rb +95 -83
- data/lib/puppet/network/http_server/mongrel.rb +90 -90
- data/lib/puppet/network/http_server/webrick.rb +139 -148
- data/lib/puppet/network/rest_authconfig.rb +76 -71
- data/lib/puppet/network/rest_authorization.rb +11 -13
- data/lib/puppet/network/rights.rb +217 -226
- data/lib/puppet/network/server.rb +147 -151
- data/lib/puppet/network/xmlrpc/client.rb +197 -205
- data/lib/puppet/network/xmlrpc/processor.rb +68 -72
- data/lib/puppet/network/xmlrpc/server.rb +10 -10
- data/lib/puppet/network/xmlrpc/webrick_servlet.rb +94 -100
- data/lib/puppet/node.rb +99 -107
- data/lib/puppet/node/environment.rb +109 -62
- data/lib/puppet/node/facts.rb +48 -43
- data/lib/puppet/parameter.rb +246 -498
- data/lib/puppet/parameter/value.rb +63 -0
- data/lib/puppet/parameter/value_collection.rb +143 -0
- data/lib/puppet/parser.rb +4 -0
- data/lib/puppet/parser/ast.rb +81 -67
- data/lib/puppet/parser/ast/arithmetic_operator.rb +27 -29
- data/lib/puppet/parser/ast/astarray.rb +50 -50
- data/lib/puppet/parser/ast/asthash.rb +37 -0
- data/lib/puppet/parser/ast/boolean_operator.rb +33 -35
- data/lib/puppet/parser/ast/branch.rb +29 -31
- data/lib/puppet/parser/ast/caseopt.rb +50 -56
- data/lib/puppet/parser/ast/casestatement.rb +30 -30
- data/lib/puppet/parser/ast/collection.rb +43 -37
- data/lib/puppet/parser/ast/collexpr.rb +66 -69
- data/lib/puppet/parser/ast/comparison_operator.rb +32 -35
- data/lib/puppet/parser/ast/else.rb +13 -13
- data/lib/puppet/parser/ast/function.rb +34 -43
- data/lib/puppet/parser/ast/ifstatement.rb +23 -27
- data/lib/puppet/parser/ast/in_operator.rb +24 -0
- data/lib/puppet/parser/ast/leaf.rb +173 -156
- data/lib/puppet/parser/ast/match_operator.rb +16 -19
- data/lib/puppet/parser/ast/minus.rb +13 -13
- data/lib/puppet/parser/ast/nop.rb +6 -6
- data/lib/puppet/parser/ast/not.rb +9 -9
- data/lib/puppet/parser/ast/relationship.rb +60 -0
- data/lib/puppet/parser/ast/resource.rb +58 -57
- data/lib/puppet/parser/ast/resource_defaults.rb +16 -16
- data/lib/puppet/parser/ast/resource_override.rb +51 -51
- data/lib/puppet/parser/ast/resource_reference.rb +17 -72
- data/lib/puppet/parser/ast/resourceparam.rb +20 -17
- data/lib/puppet/parser/ast/selector.rb +30 -34
- data/lib/puppet/parser/ast/tag.rb +16 -16
- data/lib/puppet/parser/ast/vardef.rb +20 -16
- data/lib/puppet/parser/collector.rb +181 -189
- data/lib/puppet/parser/compiler.rb +395 -364
- data/lib/puppet/parser/files.rb +65 -69
- data/lib/puppet/parser/functions.rb +85 -97
- data/lib/puppet/parser/functions/defined.rb +23 -23
- data/lib/puppet/parser/functions/fail.rb +2 -2
- data/lib/puppet/parser/functions/file.rb +21 -19
- data/lib/puppet/parser/functions/fqdn_rand.rb +7 -7
- data/lib/puppet/parser/functions/generate.rb +24 -26
- data/lib/puppet/parser/functions/include.rb +16 -18
- data/lib/puppet/parser/functions/inline_template.rb +16 -17
- data/lib/puppet/parser/functions/realize.rb +8 -8
- data/lib/puppet/parser/functions/regsubst.rb +74 -59
- data/lib/puppet/parser/functions/require.rb +35 -33
- data/lib/puppet/parser/functions/search.rb +5 -5
- data/lib/puppet/parser/functions/sha1.rb +3 -4
- data/lib/puppet/parser/functions/shellquote.rb +31 -33
- data/lib/puppet/parser/functions/split.rb +8 -8
- data/lib/puppet/parser/functions/sprintf.rb +10 -9
- data/lib/puppet/parser/functions/tag.rb +3 -3
- data/lib/puppet/parser/functions/tagged.rb +13 -13
- data/lib/puppet/parser/functions/template.rb +18 -19
- data/lib/puppet/parser/functions/versioncmp.rb +17 -14
- data/lib/puppet/parser/grammar.ra +485 -422
- data/lib/puppet/parser/lexer.rb +500 -442
- data/lib/puppet/parser/parser.rb +1438 -1084
- data/lib/puppet/parser/parser_support.rb +227 -502
- data/lib/puppet/parser/relationship.rb +43 -0
- data/lib/puppet/parser/resource.rb +280 -375
- data/lib/puppet/parser/resource/param.rb +18 -18
- data/lib/puppet/parser/scope.rb +450 -447
- data/lib/puppet/parser/templatewrapper.rb +92 -94
- data/lib/puppet/parser/type_loader.rb +146 -0
- data/lib/puppet/parser/yaml_trimmer.rb +6 -8
- data/lib/puppet/property.rb +290 -453
- data/lib/puppet/property/ensure.rb +92 -0
- data/lib/puppet/property/keyvalue.rb +74 -82
- data/lib/puppet/property/list.rb +71 -81
- data/lib/puppet/property/ordered_list.rb +15 -15
- data/lib/puppet/provider.rb +229 -241
- data/lib/puppet/provider/augeas/augeas.rb +318 -320
- data/lib/puppet/provider/computer/computer.rb +13 -13
- data/lib/puppet/provider/confine.rb +63 -63
- data/lib/puppet/provider/confine/exists.rb +14 -14
- data/lib/puppet/provider/confine/false.rb +12 -12
- data/lib/puppet/provider/confine/feature.rb +10 -10
- data/lib/puppet/provider/confine/true.rb +13 -13
- data/lib/puppet/provider/confine/variable.rb +51 -54
- data/lib/puppet/provider/confine_collection.rb +38 -38
- data/lib/puppet/provider/confiner.rb +10 -14
- data/lib/puppet/provider/cron/crontab.rb +172 -173
- data/lib/puppet/provider/file/posix.rb +99 -0
- data/lib/puppet/provider/file/win32.rb +74 -0
- data/lib/puppet/provider/group/directoryservice.rb +6 -6
- data/lib/puppet/provider/group/groupadd.rb +18 -20
- data/lib/puppet/provider/group/ldap.rb +40 -43
- data/lib/puppet/provider/group/pw.rb +23 -23
- data/lib/puppet/provider/host/parsed.rb +51 -50
- data/lib/puppet/provider/ldap.rb +121 -123
- data/lib/puppet/provider/macauthorization/macauthorization.rb +263 -272
- data/lib/puppet/provider/mailalias/aliases.rb +34 -31
- data/lib/puppet/provider/maillist/mailman.rb +87 -93
- data/lib/puppet/provider/mcx/mcxcontent.rb +155 -151
- data/lib/puppet/provider/mount.rb +36 -40
- data/lib/puppet/provider/mount/parsed.rb +28 -26
- data/lib/puppet/provider/naginator.rb +46 -48
- data/lib/puppet/provider/nameservice.rb +215 -257
- data/lib/puppet/provider/nameservice/directoryservice.rb +455 -471
- data/lib/puppet/provider/nameservice/objectadd.rb +21 -21
- data/lib/puppet/provider/nameservice/pw.rb +13 -13
- data/lib/puppet/provider/package.rb +18 -20
- data/lib/puppet/provider/package/aix.rb +128 -0
- data/lib/puppet/provider/package/appdmg.rb +78 -82
- data/lib/puppet/provider/package/apple.rb +39 -40
- data/lib/puppet/provider/package/apt.rb +95 -104
- data/lib/puppet/provider/package/aptitude.rb +19 -21
- data/lib/puppet/provider/package/aptrpm.rb +70 -72
- data/lib/puppet/provider/package/blastwave.rb +88 -94
- data/lib/puppet/provider/package/darwinport.rb +67 -69
- data/lib/puppet/provider/package/dpkg.rb +123 -97
- data/lib/puppet/provider/package/fink.rb +66 -68
- data/lib/puppet/provider/package/freebsd.rb +38 -40
- data/lib/puppet/provider/package/gem.rb +98 -102
- data/lib/puppet/provider/package/hpux.rb +37 -39
- data/lib/puppet/provider/package/nim.rb +35 -0
- data/lib/puppet/provider/package/openbsd.rb +100 -75
- data/lib/puppet/provider/package/pkg.rb +108 -0
- data/lib/puppet/provider/package/pkgdmg.rb +95 -87
- data/lib/puppet/provider/package/portage.rb +101 -104
- data/lib/puppet/provider/package/ports.rb +71 -73
- data/lib/puppet/provider/package/portupgrade.rb +251 -0
- data/lib/puppet/provider/package/rpm.rb +113 -115
- data/lib/puppet/provider/package/rug.rb +46 -46
- data/lib/puppet/provider/package/sun.rb +135 -151
- data/lib/puppet/provider/package/sunfreeware.rb +5 -5
- data/lib/puppet/provider/package/up2date.rb +31 -31
- data/lib/puppet/provider/package/urpmi.rb +51 -51
- data/lib/puppet/provider/package/yum.rb +90 -98
- data/lib/puppet/provider/package/zypper.rb +52 -0
- data/lib/puppet/provider/parsedfile.rb +306 -329
- data/lib/puppet/provider/port/parsed.rb +5 -5
- data/lib/puppet/provider/selboolean/getsetsebool.rb +34 -34
- data/lib/puppet/provider/selmodule/semodule.rb +103 -111
- data/lib/puppet/provider/service/base.rb +134 -139
- data/lib/puppet/provider/service/bsd.rb +48 -0
- data/lib/puppet/provider/service/daemontools.rb +158 -162
- data/lib/puppet/provider/service/debian.rb +36 -36
- data/lib/puppet/provider/service/freebsd.rb +118 -38
- data/lib/puppet/provider/service/gentoo.rb +33 -39
- data/lib/puppet/provider/service/init.rb +125 -125
- data/lib/puppet/provider/service/launchd.rb +234 -254
- data/lib/puppet/provider/service/redhat.rb +58 -58
- data/lib/puppet/provider/service/runit.rb +74 -74
- data/lib/puppet/provider/service/smf.rb +81 -85
- data/lib/puppet/provider/service/src.rb +87 -0
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +73 -81
- data/lib/puppet/provider/sshkey/parsed.rb +24 -21
- data/lib/puppet/provider/user/directoryservice.rb +71 -71
- data/lib/puppet/provider/user/hpux.rb +20 -20
- data/lib/puppet/provider/user/ldap.rb +106 -110
- data/lib/puppet/provider/user/pw.rb +33 -37
- data/lib/puppet/provider/user/user_role_add.rb +168 -183
- data/lib/puppet/provider/user/useradd.rb +50 -51
- data/lib/puppet/provider/zfs/solaris.rb +35 -35
- data/lib/puppet/provider/zone/solaris.rb +206 -205
- data/lib/puppet/provider/zpool/solaris.rb +95 -97
- data/lib/puppet/rails.rb +115 -122
- data/lib/puppet/rails/benchmark.rb +43 -49
- data/lib/puppet/rails/database/001_add_created_at_to_all_tables.rb +8 -12
- data/lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb +8 -12
- data/lib/puppet/rails/database/003_add_environment_to_host.rb +6 -10
- data/lib/puppet/rails/database/schema.rb +100 -97
- data/lib/puppet/rails/fact_name.rb +1 -1
- data/lib/puppet/rails/fact_value.rb +5 -5
- data/lib/puppet/rails/host.rb +252 -249
- data/lib/puppet/rails/param_name.rb +15 -15
- data/lib/puppet/rails/param_value.rb +55 -55
- data/lib/puppet/rails/puppet_tag.rb +4 -4
- data/lib/puppet/rails/resource.rb +189 -203
- data/lib/puppet/rails/resource_tag.rb +19 -19
- data/lib/puppet/rails/source_file.rb +5 -5
- data/lib/puppet/reference/configuration.rb +53 -56
- data/lib/puppet/reference/function.rb +1 -1
- data/lib/puppet/reference/indirection.rb +13 -13
- data/lib/puppet/reference/metaparameter.rb +40 -40
- data/lib/puppet/reference/network.rb +16 -16
- data/lib/puppet/reference/providers.rb +97 -98
- data/lib/puppet/reference/report.rb +1 -1
- data/lib/puppet/reference/type.rb +67 -70
- data/lib/puppet/relationship.rb +65 -67
- data/lib/puppet/reports.rb +32 -34
- data/lib/puppet/reports/http.rb +22 -0
- data/lib/puppet/reports/log.rb +7 -6
- data/lib/puppet/reports/rrdgraph.rb +105 -114
- data/lib/puppet/reports/store.rb +53 -56
- data/lib/puppet/reports/tagmail.rb +149 -157
- data/lib/puppet/resource.rb +428 -194
- data/lib/puppet/resource/catalog.rb +496 -512
- data/lib/puppet/resource/status.rb +58 -0
- data/lib/puppet/resource/type.rb +311 -0
- data/lib/puppet/resource/type_collection.rb +217 -0
- data/lib/puppet/resource/type_collection_helper.rb +7 -0
- data/lib/puppet/run.rb +77 -0
- data/lib/puppet/simple_graph.rb +381 -413
- data/lib/puppet/ssl.rb +2 -1
- data/lib/puppet/ssl/base.rb +60 -43
- data/lib/puppet/ssl/certificate.rb +21 -21
- data/lib/puppet/ssl/certificate_authority.rb +215 -229
- data/lib/puppet/ssl/certificate_authority/interface.rb +84 -68
- data/lib/puppet/ssl/certificate_factory.rb +119 -119
- data/lib/puppet/ssl/certificate_request.rb +52 -45
- data/lib/puppet/ssl/certificate_revocation_list.rb +78 -78
- data/lib/puppet/ssl/host.rb +230 -228
- data/lib/puppet/ssl/inventory.rb +33 -33
- data/lib/puppet/ssl/key.rb +37 -37
- data/lib/puppet/sslcertificates.rb +124 -123
- data/lib/puppet/sslcertificates/ca.rb +327 -344
- data/lib/puppet/sslcertificates/certificate.rb +197 -224
- data/lib/puppet/sslcertificates/inventory.rb +27 -29
- data/lib/puppet/sslcertificates/support.rb +113 -119
- data/lib/puppet/status.rb +28 -0
- data/lib/puppet/transaction.rb +349 -696
- data/lib/puppet/transaction/change.rb +80 -85
- data/lib/puppet/transaction/event.rb +54 -14
- data/lib/puppet/transaction/event_manager.rb +99 -0
- data/lib/puppet/transaction/report.rb +121 -59
- data/lib/puppet/transaction/resource_harness.rb +150 -0
- data/lib/puppet/transportable.rb +215 -226
- data/lib/puppet/type.rb +1644 -1849
- data/lib/puppet/type/augeas.rb +153 -134
- data/lib/puppet/type/component.rb +63 -65
- data/lib/puppet/type/computer.rb +44 -44
- data/lib/puppet/type/cron.rb +364 -384
- data/lib/puppet/type/exec.rb +583 -521
- data/lib/puppet/type/file.rb +786 -823
- data/lib/puppet/type/file/checksum.rb +23 -240
- data/lib/puppet/type/file/content.rb +193 -129
- data/lib/puppet/type/file/ensure.rb +149 -153
- data/lib/puppet/type/file/group.rb +94 -104
- data/lib/puppet/type/file/mode.rb +109 -122
- data/lib/puppet/type/file/owner.rb +39 -131
- data/lib/puppet/type/file/selcontext.rb +69 -73
- data/lib/puppet/type/file/source.rb +165 -153
- data/lib/puppet/type/file/target.rb +56 -60
- data/lib/puppet/type/file/type.rb +18 -18
- data/lib/puppet/type/filebucket.rb +91 -92
- data/lib/puppet/type/group.rb +77 -82
- data/lib/puppet/type/host.rb +85 -85
- data/lib/puppet/type/k5login.rb +65 -65
- data/lib/puppet/type/macauthorization.rb +141 -143
- data/lib/puppet/type/mailalias.rb +37 -37
- data/lib/puppet/type/maillist.rb +51 -51
- data/lib/puppet/type/mcx.rb +62 -62
- data/lib/puppet/type/mount.rb +199 -193
- data/lib/puppet/type/notify.rb +33 -33
- data/lib/puppet/type/package.rb +301 -298
- data/lib/puppet/type/port.rb +4 -4
- data/lib/puppet/type/resources.rb +107 -123
- data/lib/puppet/type/schedule.rb +317 -326
- data/lib/puppet/type/selboolean.rb +19 -19
- data/lib/puppet/type/selmodule.rb +34 -34
- data/lib/puppet/type/service.rb +152 -152
- data/lib/puppet/type/ssh_authorized_key.rb +74 -78
- data/lib/puppet/type/sshkey.rb +52 -56
- data/lib/puppet/type/stage.rb +18 -0
- data/lib/puppet/type/tidy.rb +289 -300
- data/lib/puppet/type/user.rb +300 -312
- data/lib/puppet/type/yumrepo.rb +300 -335
- data/lib/puppet/type/zfs.rb +36 -36
- data/lib/puppet/type/zone.rb +376 -347
- data/lib/puppet/type/zpool.rb +71 -77
- data/lib/puppet/util.rb +383 -387
- data/lib/puppet/util/autoload.rb +125 -143
- data/lib/puppet/util/autoload/file_cache.rb +78 -101
- data/lib/puppet/util/backups.rb +66 -66
- data/lib/puppet/util/cacher.rb +112 -120
- data/lib/puppet/util/checksums.rb +119 -84
- data/lib/puppet/util/classgen.rb +157 -167
- data/lib/puppet/util/command_line.rb +95 -0
- data/lib/puppet/util/command_line/filebucket +97 -0
- data/lib/puppet/util/command_line/pi +48 -0
- data/lib/puppet/util/command_line/puppet +69 -0
- data/lib/puppet/util/command_line/puppetca +110 -0
- data/lib/puppet/util/command_line/puppetd +186 -0
- data/lib/puppet/util/command_line/puppetdoc +67 -0
- data/lib/puppet/util/command_line/puppetmasterd +65 -0
- data/lib/puppet/util/command_line/puppetqd +53 -0
- data/lib/puppet/util/command_line/puppetrun +128 -0
- data/lib/puppet/util/command_line/ralsh +89 -0
- data/lib/puppet/util/constant_inflector.rb +7 -7
- data/lib/puppet/util/diff.rb +59 -56
- data/lib/puppet/util/docs.rb +97 -99
- data/lib/puppet/util/errors.rb +53 -44
- data/lib/puppet/util/execution.rb +15 -15
- data/lib/puppet/util/feature.rb +62 -72
- data/lib/puppet/util/file_locking.rb +33 -33
- data/lib/puppet/util/fileparsing.rb +292 -318
- data/lib/puppet/util/filetype.rb +246 -263
- data/lib/puppet/util/graph.rb +16 -18
- data/lib/puppet/util/inifile.rb +170 -184
- data/lib/puppet/util/inline_docs.rb +26 -0
- data/lib/puppet/util/instance_loader.rb +58 -58
- data/lib/puppet/util/ldap/connection.rb +57 -59
- data/lib/puppet/util/ldap/generator.rb +31 -31
- data/lib/puppet/util/ldap/manager.rb +233 -235
- data/lib/puppet/util/loadedfile.rb +49 -51
- data/lib/puppet/util/log.rb +210 -494
- data/lib/puppet/util/log/destination.rb +49 -0
- data/lib/puppet/util/log/destinations.rb +217 -0
- data/lib/puppet/util/log_paths.rb +15 -17
- data/lib/puppet/util/logging.rb +34 -13
- data/lib/puppet/util/metaid.rb +15 -15
- data/lib/puppet/util/methodhelper.rb +24 -26
- data/lib/puppet/util/metric.rb +123 -125
- data/lib/puppet/util/monkey_patches.rb +21 -20
- data/lib/puppet/util/nagios_maker.rb +41 -41
- data/lib/puppet/util/package.rb +24 -26
- data/lib/puppet/util/pidlock.rb +49 -49
- data/lib/puppet/util/posix.rb +115 -115
- data/lib/puppet/util/provider_features.rb +147 -155
- data/lib/puppet/util/pson.rb +5 -5
- data/lib/puppet/util/queue.rb +55 -55
- data/lib/puppet/util/queue/stomp.rb +27 -27
- data/lib/puppet/util/rails/cache_accumulator.rb +49 -49
- data/lib/puppet/util/rails/collection_merger.rb +13 -13
- data/lib/puppet/util/rails/reference_serializer.rb +26 -26
- data/lib/puppet/util/rdoc.rb +77 -74
- data/lib/puppet/util/rdoc/code_objects.rb +235 -217
- data/lib/puppet/util/rdoc/generators/puppet_generator.rb +732 -676
- data/lib/puppet/util/rdoc/generators/template/puppet/puppet.rb +38 -12
- data/lib/puppet/util/rdoc/parser.rb +418 -392
- data/lib/puppet/util/reference.rb +168 -174
- data/lib/puppet/util/resource_template.rb +17 -17
- data/lib/puppet/util/run_mode.rb +81 -0
- data/lib/puppet/util/selinux.rb +184 -200
- data/lib/puppet/util/settings.rb +886 -919
- data/lib/puppet/util/settings/boolean_setting.rb +20 -23
- data/lib/puppet/util/settings/file_setting.rb +98 -99
- data/lib/puppet/util/settings/setting.rb +71 -87
- data/lib/puppet/util/storage.rb +73 -84
- data/lib/puppet/util/subclass_loader.rb +59 -66
- data/lib/puppet/util/suidmanager.rb +87 -84
- data/lib/puppet/util/tagging.rb +37 -39
- data/lib/puppet/util/user_attr.rb +14 -14
- data/lib/puppet/util/warnings.rb +20 -20
- data/lib/puppet/util/zaml.rb +242 -241
- data/man/man5/puppet.conf.5 +148 -76
- data/man/man8/filebucket.8 +6 -6
- data/man/man8/pi.8 +5 -5
- data/man/man8/puppet.8 +2 -73
- data/man/man8/puppetca.8 +47 -32
- data/man/man8/puppetd.8 +118 -76
- data/man/man8/puppetdoc.8 +16 -12
- data/man/man8/puppetmasterd.8 +4 -4
- data/man/man8/puppetqd.8 +4 -4
- data/man/man8/puppetrun.8 +23 -22
- data/man/man8/ralsh.8 +16 -17
- data/spec/fixtures/yaml/test.local.yaml +16 -0
- data/spec/integration/application/apply_spec.rb +33 -0
- data/spec/integration/configurer_spec.rb +35 -0
- data/spec/integration/defaults_spec.rb +258 -0
- data/spec/integration/file_serving/content_spec.rb +20 -0
- data/spec/integration/file_serving/fileset_spec.rb +14 -0
- data/spec/integration/file_serving/metadata_spec.rb +21 -0
- data/spec/integration/file_serving/terminus_helper_spec.rb +22 -0
- data/spec/integration/indirector/bucket_file/rest_spec.rb +68 -0
- data/spec/integration/indirector/catalog/compiler_spec.rb +68 -0
- data/spec/integration/indirector/catalog/queue_spec.rb +61 -0
- data/spec/integration/indirector/certificate/rest_spec.rb +68 -0
- data/spec/integration/indirector/certificate_request/rest_spec.rb +88 -0
- data/spec/integration/indirector/certificate_revocation_list/rest_spec.rb +76 -0
- data/spec/integration/indirector/direct_file_server_spec.rb +73 -0
- data/spec/integration/indirector/file_content/file_server_spec.rb +94 -0
- data/spec/integration/indirector/file_metadata/file_server_spec.rb +18 -0
- data/spec/integration/indirector/node/ldap_spec.rb +15 -0
- data/spec/integration/indirector/report/rest_spec.rb +96 -0
- data/spec/integration/indirector/rest_spec.rb +524 -0
- data/spec/integration/network/client_spec.rb +19 -0
- data/spec/integration/network/formats_spec.rb +110 -0
- data/spec/integration/network/handler_spec.rb +25 -0
- data/spec/integration/network/server/mongrel_spec.rb +66 -0
- data/spec/integration/network/server/webrick_spec.rb +85 -0
- data/spec/integration/node/environment_spec.rb +58 -0
- data/spec/integration/node/facts_spec.rb +47 -0
- data/spec/integration/node_spec.rb +93 -0
- data/spec/integration/parser/collector_spec.rb +38 -0
- data/spec/integration/parser/compiler_spec.rb +29 -0
- data/spec/integration/parser/functions/require_spec.rb +44 -0
- data/spec/integration/parser/parser_spec.rb +113 -0
- data/spec/integration/provider/mailalias/aliases_spec.rb +25 -0
- data/spec/integration/provider/package_spec.rb +26 -0
- data/spec/integration/provider/service/init_spec.rb +32 -0
- data/spec/integration/reference/providers_spec.rb +17 -0
- data/spec/integration/reports_spec.rb +18 -0
- data/spec/integration/resource/catalog_spec.rb +61 -0
- data/spec/integration/resource/type_collection_spec.rb +96 -0
- data/spec/integration/ssl/certificate_authority_spec.rb +135 -0
- data/spec/integration/ssl/certificate_request_spec.rb +61 -0
- data/spec/integration/ssl/certificate_revocation_list_spec.rb +42 -0
- data/spec/integration/ssl/host_spec.rb +90 -0
- data/spec/integration/transaction/report_spec.rb +29 -0
- data/spec/integration/transaction_spec.rb +284 -0
- data/spec/integration/type/file_spec.rb +506 -0
- data/spec/integration/type/package_spec.rb +25 -0
- data/spec/integration/type/tidy_spec.rb +32 -0
- data/spec/integration/type_spec.rb +22 -0
- data/spec/integration/util/autoload_spec.rb +114 -0
- data/spec/integration/util/feature_spec.rb +54 -0
- data/spec/integration/util/file_locking_spec.rb +37 -0
- data/spec/integration/util/rdoc/parser_spec.rb +59 -0
- data/spec/integration/util/settings_spec.rb +30 -0
- data/spec/lib/puppet_spec/files.rb +16 -6
- data/spec/monkey_patches/add_confine_and_runnable_to_rspec_dsl.rb +27 -27
- data/spec/monkey_patches/alias_should_to_must.rb +4 -4
- data/spec/shared_behaviours/file_server_terminus.rb +28 -28
- data/spec/shared_behaviours/file_serving.rb +53 -53
- data/spec/shared_behaviours/memory_terminus.rb +22 -22
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +61 -18
- data/spec/spec_specs/runnable_spec.rb +95 -0
- data/spec/unit/agent/locker_spec.rb +100 -0
- data/spec/unit/agent_spec.rb +281 -0
- data/spec/unit/application/agent_spec.rb +588 -0
- data/spec/unit/application/apply_spec.rb +387 -0
- data/spec/unit/application/cert_spec.rb +194 -0
- data/spec/unit/application/describe_spec.rb +84 -0
- data/spec/unit/application/doc_spec.rb +368 -0
- data/spec/unit/application/filebucket_spec.rb +223 -0
- data/spec/unit/application/kick_spec.rb +313 -0
- data/spec/unit/application/master_spec.rb +453 -0
- data/spec/unit/application/queue_spec.rb +186 -0
- data/spec/unit/application/resource_spec.rb +233 -0
- data/spec/unit/application_spec.rb +531 -0
- data/spec/unit/configurer/downloader_spec.rb +188 -0
- data/spec/unit/configurer/fact_handler_spec.rb +164 -0
- data/spec/unit/configurer/plugin_handler_spec.rb +112 -0
- data/spec/unit/configurer_spec.rb +494 -0
- data/spec/unit/daemon_spec.rb +306 -0
- data/spec/unit/dsl/resource_api_spec.rb +181 -0
- data/spec/unit/dsl/resource_type_api_spec.rb +46 -0
- data/spec/unit/file_bucket/dipper_spec.rb +122 -0
- data/spec/unit/file_bucket/file_spec.rb +230 -0
- data/spec/unit/file_collection/lookup_spec.rb +46 -0
- data/spec/unit/file_collection_spec.rb +53 -0
- data/spec/unit/file_serving/base_spec.rb +132 -0
- data/spec/unit/file_serving/configuration/parser_spec.rb +181 -0
- data/spec/unit/file_serving/configuration_spec.rb +249 -0
- data/spec/unit/file_serving/content_spec.rb +118 -0
- data/spec/unit/file_serving/fileset_spec.rb +347 -0
- data/spec/unit/file_serving/indirection_hooks_spec.rb +63 -0
- data/spec/unit/file_serving/metadata_spec.rb +286 -0
- data/spec/unit/file_serving/mount/file_spec.rb +196 -0
- data/spec/unit/file_serving/mount/modules_spec.rb +63 -0
- data/spec/unit/file_serving/mount/plugins_spec.rb +61 -0
- data/spec/unit/file_serving/mount_spec.rb +32 -0
- data/spec/unit/file_serving/terminus_helper_spec.rb +98 -0
- data/spec/unit/indirector/active_record_spec.rb +76 -0
- data/spec/unit/indirector/catalog/active_record_spec.rb +141 -0
- data/spec/unit/indirector/catalog/compiler_spec.rb +275 -0
- data/spec/unit/indirector/catalog/queue_spec.rb +20 -0
- data/spec/unit/indirector/catalog/rest_spec.rb +11 -0
- data/spec/unit/indirector/catalog/yaml_spec.rb +25 -0
- data/spec/unit/indirector/certificate/ca_spec.rb +28 -0
- data/spec/unit/indirector/certificate/file_spec.rb +28 -0
- data/spec/unit/indirector/certificate/rest_spec.rb +58 -0
- data/spec/unit/indirector/certificate_request/ca_spec.rb +19 -0
- data/spec/unit/indirector/certificate_request/file_spec.rb +19 -0
- data/spec/unit/indirector/certificate_request/rest_spec.rb +23 -0
- data/spec/unit/indirector/certificate_revocation_list/ca_spec.rb +21 -0
- data/spec/unit/indirector/certificate_revocation_list/file_spec.rb +20 -0
- data/spec/unit/indirector/certificate_revocation_list/rest_spec.rb +23 -0
- data/spec/unit/indirector/code_spec.rb +33 -0
- data/spec/unit/indirector/direct_file_server_spec.rb +84 -0
- data/spec/unit/indirector/envelope_spec.rb +47 -0
- data/spec/unit/indirector/exec_spec.rb +56 -0
- data/spec/unit/indirector/facts/active_record_spec.rb +104 -0
- data/spec/unit/indirector/facts/couch_spec.rb +98 -0
- data/spec/unit/indirector/facts/facter_spec.rb +143 -0
- data/spec/unit/indirector/facts/rest_spec.rb +11 -0
- data/spec/unit/indirector/facts/yaml_spec.rb +26 -0
- data/spec/unit/indirector/file_bucket_file/file_spec.rb +290 -0
- data/spec/unit/indirector/file_bucket_file/rest_spec.rb +11 -0
- data/spec/unit/indirector/file_content/file_server_spec.rb +18 -0
- data/spec/unit/indirector/file_content/file_spec.rb +18 -0
- data/spec/unit/indirector/file_content/rest_spec.rb +11 -0
- data/spec/unit/indirector/file_metadata/file_server_spec.rb +18 -0
- data/spec/unit/indirector/file_metadata/file_spec.rb +52 -0
- data/spec/unit/indirector/file_metadata/rest_spec.rb +9 -0
- data/spec/unit/indirector/file_server_spec.rb +267 -0
- data/spec/unit/indirector/file_spec.rb +181 -0
- data/spec/unit/indirector/indirection_spec.rb +795 -0
- data/spec/unit/indirector/key/ca_spec.rb +28 -0
- data/spec/unit/indirector/key/file_spec.rb +104 -0
- data/spec/unit/indirector/ldap_spec.rb +143 -0
- data/spec/unit/indirector/memory_spec.rb +29 -0
- data/spec/unit/indirector/node/active_record_spec.rb +41 -0
- data/spec/unit/indirector/node/exec_spec.rb +70 -0
- data/spec/unit/indirector/node/ldap_spec.rb +456 -0
- data/spec/unit/indirector/node/memory_spec.rb +19 -0
- data/spec/unit/indirector/node/plain_spec.rb +19 -0
- data/spec/unit/indirector/node/rest_spec.rb +13 -0
- data/spec/unit/indirector/node/yaml_spec.rb +25 -0
- data/spec/unit/indirector/plain_spec.rb +29 -0
- data/spec/unit/indirector/queue_spec.rb +123 -0
- data/spec/unit/indirector/report/processor_spec.rb +81 -0
- data/spec/unit/indirector/report/rest_spec.rb +28 -0
- data/spec/unit/indirector/request_spec.rb +304 -0
- data/spec/unit/indirector/resource/ral_spec.rb +129 -0
- data/spec/unit/indirector/resource/rest_spec.rb +11 -0
- data/spec/unit/indirector/resource_type/parser_spec.rb +75 -0
- data/spec/unit/indirector/resource_type/rest_spec.rb +15 -0
- data/spec/unit/indirector/rest_spec.rb +455 -0
- data/spec/unit/indirector/run/local_spec.rb +20 -0
- data/spec/unit/indirector/run/rest_spec.rb +11 -0
- data/spec/unit/indirector/ssl_file_spec.rb +281 -0
- data/spec/unit/indirector/status/rest_spec.rb +11 -0
- data/spec/unit/indirector/terminus_spec.rb +245 -0
- data/spec/unit/indirector/yaml_spec.rb +146 -0
- data/spec/unit/indirector_spec.rb +157 -0
- data/spec/unit/module_spec.rb +547 -0
- data/spec/unit/network/authconfig_spec.rb +292 -0
- data/spec/unit/network/authstore_spec.rb +370 -0
- data/spec/unit/network/client_spec.rb +45 -0
- data/spec/unit/network/format_handler_spec.rb +336 -0
- data/spec/unit/network/format_spec.rb +198 -0
- data/spec/unit/network/formats_spec.rb +337 -0
- data/spec/unit/network/handler/fileserver_spec.rb +172 -0
- data/spec/unit/network/http/api/v1_spec.rb +122 -0
- data/spec/unit/network/http/compression_spec.rb +199 -0
- data/spec/unit/network/http/handler_spec.rb +455 -0
- data/spec/unit/network/http/mongrel/rest_spec.rb +249 -0
- data/spec/unit/network/http/mongrel/{xmlrpc.rb → xmlrpc_spec.rb} +0 -0
- data/spec/unit/network/http/mongrel_spec.rb +131 -0
- data/spec/unit/network/http/rack/rest_spec.rb +249 -0
- data/spec/unit/network/http/rack/xmlrpc_spec.rb +157 -0
- data/spec/unit/network/http/rack_spec.rb +102 -0
- data/spec/unit/network/http/webrick/rest_spec.rb +180 -0
- data/spec/unit/network/http/webrick/{xmlrpc.rb → xmlrpc_spec.rb} +0 -0
- data/spec/unit/network/http/webrick_spec.rb +339 -0
- data/spec/unit/network/http_pool_spec.rb +206 -0
- data/spec/unit/network/http_spec.rb +35 -0
- data/spec/unit/network/rest_authconfig_spec.rb +148 -0
- data/spec/unit/network/rest_authorization_spec.rb +43 -0
- data/spec/unit/network/rights_spec.rb +519 -0
- data/spec/unit/network/server_spec.rb +534 -0
- data/spec/unit/network/xmlrpc/client_spec.rb +171 -0
- data/spec/unit/node/environment_spec.rb +248 -0
- data/spec/unit/node/facts_spec.rb +102 -0
- data/spec/unit/node_spec.rb +210 -0
- data/spec/unit/other/selinux_spec.rb +94 -0
- data/spec/unit/other/transbucket_spec.rb +188 -0
- data/spec/unit/other/transobject_spec.rb +112 -0
- data/spec/unit/parameter/value_collection_spec.rb +167 -0
- data/spec/unit/parameter/value_spec.rb +88 -0
- data/spec/unit/parameter_spec.rb +172 -0
- data/spec/unit/parser/ast/arithmetic_operator_spec.rb +73 -0
- data/spec/unit/parser/ast/astarray_spec.rb +72 -0
- data/spec/unit/parser/ast/asthash_spec.rb +98 -0
- data/spec/unit/parser/ast/boolean_operator_spec.rb +53 -0
- data/spec/unit/parser/ast/casestatement_spec.rb +161 -0
- data/spec/unit/parser/ast/collection_spec.rb +63 -0
- data/spec/unit/parser/ast/collexpr_spec.rb +115 -0
- data/spec/unit/parser/ast/comparison_operator_spec.rb +116 -0
- data/spec/unit/parser/ast/function_spec.rb +83 -0
- data/spec/unit/parser/ast/ifstatement_spec.rb +76 -0
- data/spec/unit/parser/ast/in_operator_spec.rb +60 -0
- data/spec/unit/parser/ast/leaf_spec.rb +362 -0
- data/spec/unit/parser/ast/match_operator_spec.rb +50 -0
- data/spec/unit/parser/ast/minus_spec.rb +36 -0
- data/spec/unit/parser/ast/nop_spec.rb +20 -0
- data/spec/unit/parser/ast/not_spec.rb +30 -0
- data/spec/unit/parser/ast/relationship_spec.rb +88 -0
- data/spec/unit/parser/ast/resource_defaults_spec.rb +22 -0
- data/spec/unit/parser/ast/resource_override_spec.rb +51 -0
- data/spec/unit/parser/ast/resource_reference_spec.rb +46 -0
- data/spec/unit/parser/ast/resource_spec.rb +120 -0
- data/spec/unit/parser/ast/selector_spec.rb +139 -0
- data/spec/unit/parser/ast/vardef_spec.rb +60 -0
- data/spec/unit/parser/ast_spec.rb +111 -0
- data/spec/unit/parser/collector_spec.rb +559 -0
- data/spec/unit/parser/compiler_spec.rb +754 -0
- data/spec/unit/parser/files_spec.rb +201 -0
- data/spec/unit/parser/functions/defined_spec.rb +50 -0
- data/spec/unit/parser/functions/fqdn_rand_spec.rb +62 -0
- data/spec/unit/parser/functions/generate_spec.rb +41 -0
- data/spec/unit/parser/functions/inline_template_spec.rb +59 -0
- data/spec/unit/parser/functions/realize_spec.rb +51 -0
- data/spec/unit/parser/functions/regsubst_spec.rb +192 -0
- data/spec/unit/parser/functions/require_spec.rb +74 -0
- data/spec/unit/parser/functions/shellquote_spec.rb +81 -0
- data/spec/unit/parser/functions/split_spec.rb +49 -0
- data/spec/unit/parser/functions/sprintf_spec.rb +41 -0
- data/spec/unit/parser/functions/tag_spec.rb +24 -0
- data/spec/unit/parser/functions/template_spec.rb +62 -0
- data/spec/unit/parser/functions/versioncmp_spec.rb +29 -0
- data/spec/unit/parser/functions_spec.rb +102 -0
- data/spec/unit/parser/lexer_spec.rb +646 -0
- data/spec/unit/parser/parser_spec.rb +412 -0
- data/spec/unit/parser/relationship_spec.rb +70 -0
- data/spec/unit/parser/resource_spec.rb +564 -0
- data/spec/unit/parser/scope_spec.rb +629 -0
- data/spec/unit/parser/templatewrapper_spec.rb +144 -0
- data/spec/unit/parser/type_loader_spec.rb +201 -0
- data/spec/unit/property/ensure_spec.rb +13 -0
- data/spec/unit/property/keyvalue_spec.rb +168 -0
- data/spec/unit/property/list_spec.rb +166 -0
- data/spec/unit/property/ordered_list_spec.rb +64 -0
- data/spec/unit/property_spec.rb +410 -0
- data/spec/unit/provider/augeas/augeas_spec.rb +413 -0
- data/spec/unit/provider/confine/exists_spec.rb +81 -0
- data/spec/unit/provider/confine/false_spec.rb +53 -0
- data/spec/unit/provider/confine/feature_spec.rb +60 -0
- data/spec/unit/provider/confine/true_spec.rb +53 -0
- data/spec/unit/provider/confine/variable_spec.rb +107 -0
- data/spec/unit/provider/confine_collection_spec.rb +134 -0
- data/spec/unit/provider/confine_spec.rb +78 -0
- data/spec/unit/provider/confiner_spec.rb +63 -0
- data/spec/unit/provider/group/groupadd_spec.rb +31 -0
- data/spec/unit/provider/group/ldap_spec.rb +105 -0
- data/spec/unit/provider/ldap_spec.rb +248 -0
- data/spec/unit/provider/macauthorization_spec.rb +147 -0
- data/spec/unit/provider/mcx/mcxcontent_spec.rb +175 -0
- data/spec/unit/provider/mount/parsed_spec.rb +193 -0
- data/spec/unit/provider/mount_spec.rb +130 -0
- data/spec/unit/provider/naginator_spec.rb +58 -0
- data/spec/unit/provider/package/aix_spec.rb +66 -0
- data/spec/unit/provider/package/apt_spec.rb +145 -0
- data/spec/unit/provider/package/dpkg_spec.rb +225 -0
- data/spec/unit/provider/package/gem_spec.rb +87 -0
- data/spec/unit/provider/package/hpux_spec.rb +52 -0
- data/spec/unit/provider/package/nim_spec.rb +42 -0
- data/spec/unit/provider/package/pkg_spec.rb +63 -0
- data/spec/unit/provider/package/pkgdmg_spec.rb +84 -0
- data/spec/unit/provider/package/zypper_spec.rb +81 -0
- data/spec/unit/provider/parsedfile_spec.rb +95 -0
- data/spec/unit/provider/selboolean_spec.rb +37 -0
- data/spec/unit/provider/selmodule_spec.rb +66 -0
- data/spec/unit/provider/service/daemontools_spec.rb +166 -0
- data/spec/unit/provider/service/debian_spec.rb +89 -0
- data/spec/unit/provider/service/init_spec.rb +168 -0
- data/spec/unit/provider/service/launchd_spec.rb +200 -0
- data/spec/unit/provider/service/redhat_spec.rb +121 -0
- data/spec/unit/provider/service/runit_spec.rb +140 -0
- data/spec/unit/provider/service/src_spec.rb +97 -0
- data/spec/unit/provider/ssh_authorized_key/parsed_spec.rb +228 -0
- data/spec/unit/provider/sshkey/parsed_spec.rb +38 -0
- data/spec/unit/provider/user/hpux_spec.rb +25 -0
- data/spec/unit/provider/user/ldap_spec.rb +279 -0
- data/spec/unit/provider/user/user_role_add_spec.rb +249 -0
- data/spec/unit/provider/user/useradd_spec.rb +115 -0
- data/spec/unit/provider/zfs/solaris_spec.rb +99 -0
- data/spec/unit/provider/zone/solaris_spec.rb +55 -0
- data/spec/unit/provider/zpool/solaris_spec.rb +179 -0
- data/spec/unit/provider_spec.rb +31 -0
- data/spec/unit/puppet_spec.rb +12 -0
- data/spec/unit/rails/host_spec.rb +163 -0
- data/spec/unit/rails/param_value_spec.rb +49 -0
- data/spec/unit/rails/resource_spec.rb +123 -0
- data/spec/unit/rails_spec.rb +258 -0
- data/spec/unit/relationship_spec.rb +236 -0
- data/spec/unit/reports/http_spec.rb +56 -0
- data/spec/unit/reports/tagmail_spec.rb +94 -0
- data/spec/unit/reports_spec.rb +61 -0
- data/spec/unit/resource/catalog_spec.rb +1078 -0
- data/spec/unit/resource/status_spec.rb +103 -0
- data/spec/unit/resource/type_collection_helper_spec.rb +25 -0
- data/spec/unit/resource/type_collection_spec.rb +432 -0
- data/spec/unit/resource/type_spec.rb +722 -0
- data/spec/unit/resource_spec.rb +818 -0
- data/spec/unit/run_spec.rb +137 -0
- data/spec/unit/simple_graph_spec.rb +544 -0
- data/spec/unit/ssl/base_spec.rb +43 -0
- data/spec/unit/ssl/certificate_authority/interface_spec.rb +333 -0
- data/spec/unit/ssl/certificate_authority_spec.rb +772 -0
- data/spec/unit/ssl/certificate_factory_spec.rb +107 -0
- data/spec/unit/ssl/certificate_request_spec.rb +220 -0
- data/spec/unit/ssl/certificate_revocation_list_spec.rb +168 -0
- data/spec/unit/ssl/certificate_spec.rb +124 -0
- data/spec/unit/ssl/host_spec.rb +707 -0
- data/spec/unit/ssl/inventory_spec.rb +180 -0
- data/spec/unit/ssl/key_spec.rb +198 -0
- data/spec/unit/status_spec.rb +31 -0
- data/spec/unit/transaction/change_spec.rb +193 -0
- data/spec/unit/transaction/event_manager_spec.rb +260 -0
- data/spec/unit/transaction/event_spec.rb +108 -0
- data/spec/unit/transaction/report_spec.rb +234 -0
- data/spec/unit/transaction/resource_harness_spec.rb +401 -0
- data/spec/unit/transaction_spec.rb +452 -0
- data/spec/unit/transportable_spec.rb +0 -0
- data/spec/unit/type/augeas_spec.rb +122 -0
- data/spec/unit/type/component_spec.rb +63 -0
- data/spec/unit/type/computer_spec.rb +81 -0
- data/spec/unit/type/cron_spec.rb +33 -0
- data/spec/unit/type/exec_spec.rb +162 -0
- data/spec/unit/type/file/checksum_spec.rb +73 -0
- data/spec/unit/type/file/content_spec.rb +460 -0
- data/spec/unit/type/file/ensure_spec.rb +84 -0
- data/spec/unit/type/file/group_spec.rb +123 -0
- data/spec/unit/type/file/owner_spec.rb +150 -0
- data/spec/unit/type/file/selinux_spec.rb +83 -0
- data/spec/unit/type/file/source_spec.rb +272 -0
- data/spec/unit/type/file_spec.rb +1070 -0
- data/spec/unit/type/filebucket_spec.rb +74 -0
- data/spec/unit/type/group_spec.rb +57 -0
- data/spec/unit/type/macauthorization_spec.rb +111 -0
- data/spec/unit/type/maillist_spec.rb +42 -0
- data/spec/unit/type/mcx_spec.rb +100 -0
- data/spec/unit/type/mount_spec.rb +261 -0
- data/spec/unit/type/nagios_spec.rb +63 -0
- data/spec/unit/type/noop_metaparam_spec.rb +37 -0
- data/spec/unit/type/package_spec.rb +240 -0
- data/spec/unit/type/resources_spec.rb +102 -0
- data/spec/unit/type/schedule_spec.rb +333 -0
- data/spec/unit/type/selboolean_spec.rb +45 -0
- data/spec/unit/type/selmodule_spec.rb +18 -0
- data/spec/unit/type/service_spec.rb +222 -0
- data/spec/unit/type/ssh_authorized_key_spec.rb +152 -0
- data/spec/unit/type/stage_spec.rb +9 -0
- data/spec/unit/type/tidy_spec.rb +424 -0
- data/spec/unit/type/user_spec.rb +281 -0
- data/spec/unit/type/zfs_spec.rb +45 -0
- data/spec/unit/type/zone_spec.rb +60 -0
- data/spec/unit/type/zpool_spec.rb +110 -0
- data/spec/unit/type_spec.rb +566 -0
- data/spec/unit/util/autoload/file_cache_spec.rb +159 -0
- data/spec/unit/util/autoload_spec.rb +120 -0
- data/spec/unit/util/backups_spec.rb +159 -0
- data/spec/unit/util/cache_accumulator_spec.rb +75 -0
- data/spec/unit/util/cacher_spec.rb +185 -0
- data/spec/unit/util/checksums_spec.rb +153 -0
- data/spec/unit/util/command_line_spec.rb +108 -0
- data/spec/unit/util/constant_inflector_spec.rb +70 -0
- data/spec/unit/util/errors_spec.rb +38 -0
- data/spec/unit/util/feature_spec.rb +72 -0
- data/spec/unit/util/file_locking_spec.rb +156 -0
- data/spec/unit/util/filetype_spec.rb +100 -0
- data/spec/unit/util/inline_docs_spec.rb +32 -0
- data/spec/unit/util/json_spec.rb +21 -0
- data/spec/unit/util/ldap/connection_spec.rb +169 -0
- data/spec/unit/util/ldap/generator_spec.rb +54 -0
- data/spec/unit/util/ldap/manager_spec.rb +654 -0
- data/spec/unit/util/loadedfile_spec.rb +65 -0
- data/spec/unit/util/log/destinations_spec.rb +24 -0
- data/spec/unit/util/log_spec.rb +215 -0
- data/spec/unit/util/logging_spec.rb +95 -0
- data/spec/unit/util/metric_spec.rb +95 -0
- data/spec/unit/util/monkey_patches_spec.rb +7 -0
- data/spec/unit/util/nagios_maker_spec.rb +126 -0
- data/spec/unit/util/package_spec.rb +21 -0
- data/spec/unit/util/posix_spec.rb +256 -0
- data/spec/unit/util/queue/stomp_spec.rb +140 -0
- data/spec/unit/util/queue_spec.rb +96 -0
- data/spec/unit/util/rdoc/parser_spec.rb +540 -0
- data/spec/unit/util/rdoc_spec.rb +165 -0
- data/spec/unit/util/reference_serializer_spec.rb +52 -0
- data/spec/unit/util/resource_template_spec.rb +58 -0
- data/spec/unit/util/run_mode_spec.rb +51 -0
- data/spec/unit/util/selinux_spec.rb +278 -0
- data/spec/unit/util/settings/file_setting_spec.rb +256 -0
- data/spec/unit/util/settings_spec.rb +1099 -0
- data/spec/unit/util/storage_spec.rb +235 -0
- data/spec/unit/util/tagging_spec.rb +102 -0
- data/spec/unit/util/user_attr_spec.rb +47 -0
- data/spec/unit/util/warnings_spec.rb +39 -0
- data/spec/unit/util/zaml_spec.rb +38 -0
- data/tasks/rake/git_workflow.rake +1 -1
- data/tasks/rake/sign.rake +2 -2
- data/test/certmgr/ca.rb +61 -61
- data/test/certmgr/certmgr.rb +292 -283
- data/test/certmgr/inventory.rb +44 -42
- data/test/certmgr/support.rb +78 -77
- data/test/data/providers/ssh_authorized_key/parsed/authorized_keys +1 -1
- data/test/data/snippets/hash.pp +33 -0
- data/test/language/ast.rb +68 -117
- data/test/language/ast/variable.rb +14 -15
- data/test/language/functions.rb +404 -463
- data/test/language/parser.rb +670 -1135
- data/test/language/scope.rb +198 -402
- data/test/language/snippets.rb +439 -447
- data/test/language/transportable.rb +67 -66
- data/test/lib/puppettest.rb +260 -268
- data/test/lib/puppettest/certificates.rb +51 -53
- data/test/lib/puppettest/exetest.rb +107 -111
- data/test/lib/puppettest/fakes.rb +153 -158
- data/test/lib/puppettest/fileparsing.rb +17 -17
- data/test/lib/puppettest/filetesting.rb +204 -213
- data/test/lib/puppettest/parsertesting.rb +382 -365
- data/test/lib/puppettest/railstesting.rb +49 -50
- data/test/lib/puppettest/reporttesting.rb +10 -10
- data/test/lib/puppettest/resourcetesting.rb +45 -36
- data/test/lib/puppettest/runnable_test.rb +36 -28
- data/test/lib/puppettest/servertest.rb +54 -51
- data/test/lib/puppettest/support/assertions.rb +48 -55
- data/test/lib/puppettest/support/helpers.rb +12 -16
- data/test/lib/puppettest/support/resources.rb +23 -25
- data/test/lib/puppettest/support/utils.rb +138 -148
- data/test/lib/puppettest/testcase.rb +15 -17
- data/test/lib/rake/puppet_test_loader.rb +1 -3
- data/test/lib/rake/puppet_testtask.rb +10 -10
- data/test/network/authconfig.rb +48 -50
- data/test/network/authorization.rb +114 -113
- data/test/network/authstore.rb +454 -406
- data/test/network/client/ca.rb +46 -48
- data/test/network/client/dipper.rb +22 -22
- data/test/network/client_request.rb +20 -20
- data/test/network/handler/ca.rb +251 -252
- data/test/network/handler/fileserver.rb +1071 -1001
- data/test/network/handler/master.rb +58 -58
- data/test/network/handler/report.rb +64 -64
- data/test/network/handler/runner.rb +8 -8
- data/test/network/rights.rb +22 -19
- data/test/network/server/mongrel_test.rb +87 -87
- data/test/network/server/webrick.rb +99 -87
- data/test/network/xmlrpc/client.rb +30 -30
- data/test/network/xmlrpc/processor.rb +52 -53
- data/test/network/xmlrpc/server.rb +10 -11
- data/test/network/xmlrpc/webrick_servlet.rb +21 -18
- data/test/other/provider.rb +69 -84
- data/test/other/puppet.rb +61 -76
- data/test/other/relationships.rb +73 -65
- data/test/other/report.rb +88 -187
- data/test/other/transactions.rb +363 -885
- data/test/puppet/defaults.rb +51 -54
- data/test/puppet/errortest.rb +8 -8
- data/test/puppet/tc_suidmanager.rb +106 -103
- data/test/rails/rails.rb +8 -9
- data/test/rails/railsparameter.rb +60 -54
- data/test/ral/manager/attributes.rb +262 -260
- data/test/ral/manager/instances.rb +77 -78
- data/test/ral/manager/manager.rb +36 -36
- data/test/ral/manager/provider.rb +56 -79
- data/test/ral/manager/type.rb +308 -449
- data/test/ral/providers/cron/crontab.rb +561 -545
- data/test/ral/providers/group.rb +203 -212
- data/test/ral/providers/host/parsed.rb +189 -180
- data/test/ral/providers/mailalias/aliases.rb +40 -40
- data/test/ral/providers/nameservice.rb +21 -21
- data/test/ral/providers/package.rb +207 -214
- data/test/ral/providers/package/aptitude.rb +75 -63
- data/test/ral/providers/package/aptrpm.rb +84 -72
- data/test/ral/providers/parsedfile.rb +510 -509
- data/test/ral/providers/port/parsed.rb +5 -5
- data/test/ral/providers/provider.rb +421 -421
- data/test/ral/providers/service/base.rb +59 -53
- data/test/ral/providers/sshkey/parsed.rb +86 -83
- data/test/ral/providers/user.rb +471 -451
- data/test/ral/providers/user/useradd.rb +168 -177
- data/test/ral/type/cron.rb +406 -393
- data/test/ral/type/exec.rb +721 -641
- data/test/ral/type/file.rb +827 -896
- data/test/ral/type/file/target.rb +295 -251
- data/test/ral/type/fileignoresource.rb +232 -205
- data/test/ral/type/filesources.rb +446 -485
- data/test/ral/type/host.rb +124 -153
- data/test/ral/type/mailalias.rb +28 -31
- data/test/ral/type/port.rb +7 -7
- data/test/ral/type/resources.rb +88 -93
- data/test/ral/type/service.rb +19 -19
- data/test/ral/type/sshkey.rb +120 -160
- data/test/ral/type/user.rb +132 -414
- data/test/ral/type/yumrepo.rb +95 -92
- data/test/ral/type/zone.rb +316 -287
- data/test/test +1 -1
- data/test/util/classgen.rb +182 -167
- data/test/util/execution.rb +18 -18
- data/test/util/fileparsing.rb +580 -540
- data/test/util/inifile.rb +117 -106
- data/test/util/instance_loader.rb +29 -29
- data/test/util/log.rb +202 -198
- data/test/util/metrics.rb +51 -51
- data/test/util/package.rb +11 -12
- data/test/util/pidlock.rb +115 -115
- data/test/util/settings.rb +613 -557
- data/test/util/storage.rb +71 -88
- data/test/util/subclass_loader.rb +69 -72
- data/test/util/utiltest.rb +204 -203
- metadata +493 -395
- data/lib/puppet/agent/runner.rb +0 -65
- data/lib/puppet/application/pi.rb +0 -214
- data/lib/puppet/application/puppet.rb +0 -181
- data/lib/puppet/application/puppetca.rb +0 -71
- data/lib/puppet/application/puppetd.rb +0 -250
- data/lib/puppet/application/puppetdoc.rb +0 -224
- data/lib/puppet/application/puppetmasterd.rb +0 -168
- data/lib/puppet/application/puppetqd.rb +0 -96
- data/lib/puppet/application/puppetrun.rb +0 -210
- data/lib/puppet/application/ralsh.rb +0 -152
- data/lib/puppet/checksum.rb +0 -57
- data/lib/puppet/indirector/checksum/file.rb +0 -33
- data/lib/puppet/indirector/runner/rest.rb +0 -7
- data/lib/puppet/network/client/dipper.rb +0 -85
- data/lib/puppet/network/client/resource.rb +0 -38
- data/lib/puppet/network/handler/resource.rb +0 -190
- data/lib/puppet/parser/ast/definition.rb +0 -207
- data/lib/puppet/parser/ast/hostclass.rb +0 -95
- data/lib/puppet/parser/ast/node.rb +0 -42
- data/lib/puppet/parser/interpreter.rb +0 -84
- data/lib/puppet/parser/loaded_code.rb +0 -119
- data/lib/puppet/parser/resource/reference.rb +0 -99
- data/lib/puppet/resource/reference.rb +0 -90
- data/lib/puppet/util/config_store.rb +0 -61
- data/spec/integration/application/puppet.rb +0 -33
- data/spec/integration/bin/puppetmasterd.rb +0 -122
- data/spec/integration/checksum.rb +0 -48
- data/spec/integration/configurer.rb +0 -18
- data/spec/integration/defaults.rb +0 -230
- data/spec/integration/file_serving/content.rb +0 -20
- data/spec/integration/file_serving/fileset.rb +0 -14
- data/spec/integration/file_serving/metadata.rb +0 -21
- data/spec/integration/file_serving/terminus_helper.rb +0 -22
- data/spec/integration/indirector/catalog/compiler.rb +0 -67
- data/spec/integration/indirector/catalog/queue.rb +0 -61
- data/spec/integration/indirector/certificate/rest.rb +0 -70
- data/spec/integration/indirector/certificate_request/rest.rb +0 -88
- data/spec/integration/indirector/certificate_revocation_list/rest.rb +0 -76
- data/spec/integration/indirector/direct_file_server.rb +0 -73
- data/spec/integration/indirector/file_content/file_server.rb +0 -94
- data/spec/integration/indirector/file_metadata/file_server.rb +0 -18
- data/spec/integration/indirector/node/ldap.rb +0 -15
- data/spec/integration/indirector/report/rest.rb +0 -94
- data/spec/integration/indirector/rest.rb +0 -523
- data/spec/integration/network/client.rb +0 -19
- data/spec/integration/network/formats.rb +0 -110
- data/spec/integration/network/handler.rb +0 -25
- data/spec/integration/network/server/mongrel.rb +0 -66
- data/spec/integration/network/server/webrick.rb +0 -86
- data/spec/integration/node.rb +0 -93
- data/spec/integration/node/environment.rb +0 -58
- data/spec/integration/node/facts.rb +0 -47
- data/spec/integration/parser/compiler.rb +0 -29
- data/spec/integration/parser/functions/require.rb +0 -86
- data/spec/integration/provider/mailalias/aliases.rb +0 -25
- data/spec/integration/provider/package.rb +0 -26
- data/spec/integration/provider/service/init.rb +0 -32
- data/spec/integration/reference/providers.rb +0 -17
- data/spec/integration/reports.rb +0 -18
- data/spec/integration/resource/catalog.rb +0 -61
- data/spec/integration/ssl/certificate_authority.rb +0 -135
- data/spec/integration/ssl/certificate_request.rb +0 -61
- data/spec/integration/ssl/certificate_revocation_list.rb +0 -42
- data/spec/integration/ssl/host.rb +0 -90
- data/spec/integration/transaction.rb +0 -66
- data/spec/integration/transaction/report.rb +0 -29
- data/spec/integration/type.rb +0 -22
- data/spec/integration/type/file.rb +0 -477
- data/spec/integration/type/package.rb +0 -25
- data/spec/integration/type/tidy.rb +0 -27
- data/spec/integration/util/autoload.rb +0 -114
- data/spec/integration/util/feature.rb +0 -54
- data/spec/integration/util/file_locking.rb +0 -37
- data/spec/integration/util/settings.rb +0 -27
- data/spec/unit/agent.rb +0 -259
- data/spec/unit/agent/locker.rb +0 -100
- data/spec/unit/agent/runner.rb +0 -118
- data/spec/unit/application.rb +0 -420
- data/spec/unit/application/filebucket.rb +0 -220
- data/spec/unit/application/pi.rb +0 -84
- data/spec/unit/application/puppet.rb +0 -399
- data/spec/unit/application/puppetca.rb +0 -142
- data/spec/unit/application/puppetd.rb +0 -502
- data/spec/unit/application/puppetdoc.rb +0 -360
- data/spec/unit/application/puppetmasterd.rb +0 -457
- data/spec/unit/application/puppetqd.rb +0 -186
- data/spec/unit/application/puppetrun.rb +0 -289
- data/spec/unit/application/ralsh.rb +0 -254
- data/spec/unit/configurer.rb +0 -339
- data/spec/unit/configurer/downloader.rb +0 -188
- data/spec/unit/configurer/fact_handler.rb +0 -164
- data/spec/unit/configurer/plugin_handler.rb +0 -112
- data/spec/unit/daemon.rb +0 -287
- data/spec/unit/file_collection.rb +0 -53
- data/spec/unit/file_collection/lookup.rb +0 -46
- data/spec/unit/file_serving/base.rb +0 -132
- data/spec/unit/file_serving/configuration.rb +0 -249
- data/spec/unit/file_serving/configuration/parser.rb +0 -181
- data/spec/unit/file_serving/content.rb +0 -110
- data/spec/unit/file_serving/fileset.rb +0 -347
- data/spec/unit/file_serving/indirection_hooks.rb +0 -63
- data/spec/unit/file_serving/metadata.rb +0 -286
- data/spec/unit/file_serving/mount.rb +0 -32
- data/spec/unit/file_serving/mount/file.rb +0 -196
- data/spec/unit/file_serving/mount/modules.rb +0 -63
- data/spec/unit/file_serving/mount/plugins.rb +0 -61
- data/spec/unit/file_serving/terminus_helper.rb +0 -98
- data/spec/unit/indirector.rb +0 -157
- data/spec/unit/indirector/active_record.rb +0 -76
- data/spec/unit/indirector/catalog/active_record.rb +0 -141
- data/spec/unit/indirector/catalog/compiler.rb +0 -261
- data/spec/unit/indirector/catalog/queue.rb +0 -20
- data/spec/unit/indirector/catalog/rest.rb +0 -11
- data/spec/unit/indirector/catalog/yaml.rb +0 -25
- data/spec/unit/indirector/certificate/ca.rb +0 -28
- data/spec/unit/indirector/certificate/file.rb +0 -28
- data/spec/unit/indirector/certificate/rest.rb +0 -57
- data/spec/unit/indirector/certificate_request/ca.rb +0 -19
- data/spec/unit/indirector/certificate_request/file.rb +0 -19
- data/spec/unit/indirector/certificate_request/rest.rb +0 -23
- data/spec/unit/indirector/certificate_revocation_list/ca.rb +0 -21
- data/spec/unit/indirector/certificate_revocation_list/file.rb +0 -20
- data/spec/unit/indirector/certificate_revocation_list/rest.rb +0 -23
- data/spec/unit/indirector/checksum/file.rb +0 -139
- data/spec/unit/indirector/code.rb +0 -33
- data/spec/unit/indirector/direct_file_server.rb +0 -84
- data/spec/unit/indirector/envelope.rb +0 -47
- data/spec/unit/indirector/exec.rb +0 -56
- data/spec/unit/indirector/facts/active_record.rb +0 -104
- data/spec/unit/indirector/facts/facter.rb +0 -142
- data/spec/unit/indirector/facts/rest.rb +0 -11
- data/spec/unit/indirector/facts/yaml.rb +0 -26
- data/spec/unit/indirector/file.rb +0 -161
- data/spec/unit/indirector/file_content/file.rb +0 -18
- data/spec/unit/indirector/file_content/file_server.rb +0 -18
- data/spec/unit/indirector/file_content/rest.rb +0 -11
- data/spec/unit/indirector/file_metadata/file.rb +0 -52
- data/spec/unit/indirector/file_metadata/file_server.rb +0 -18
- data/spec/unit/indirector/file_metadata/rest.rb +0 -9
- data/spec/unit/indirector/file_server.rb +0 -267
- data/spec/unit/indirector/indirection.rb +0 -795
- data/spec/unit/indirector/key/ca.rb +0 -28
- data/spec/unit/indirector/key/file.rb +0 -104
- data/spec/unit/indirector/ldap.rb +0 -143
- data/spec/unit/indirector/memory.rb +0 -29
- data/spec/unit/indirector/node/active_record.rb +0 -34
- data/spec/unit/indirector/node/exec.rb +0 -69
- data/spec/unit/indirector/node/ldap.rb +0 -458
- data/spec/unit/indirector/node/memory.rb +0 -19
- data/spec/unit/indirector/node/plain.rb +0 -19
- data/spec/unit/indirector/node/rest.rb +0 -13
- data/spec/unit/indirector/node/yaml.rb +0 -25
- data/spec/unit/indirector/plain.rb +0 -29
- data/spec/unit/indirector/queue.rb +0 -123
- data/spec/unit/indirector/report/processor.rb +0 -81
- data/spec/unit/indirector/report/rest.rb +0 -28
- data/spec/unit/indirector/request.rb +0 -308
- data/spec/unit/indirector/rest.rb +0 -403
- data/spec/unit/indirector/runner/rest.rb +0 -11
- data/spec/unit/indirector/ssl_file.rb +0 -280
- data/spec/unit/indirector/terminus.rb +0 -245
- data/spec/unit/indirector/yaml.rb +0 -145
- data/spec/unit/module.rb +0 -247
- data/spec/unit/network/authconfig.rb +0 -292
- data/spec/unit/network/authstore.rb +0 -370
- data/spec/unit/network/client.rb +0 -45
- data/spec/unit/network/client/dipper.rb +0 -16
- data/spec/unit/network/format.rb +0 -191
- data/spec/unit/network/format_handler.rb +0 -327
- data/spec/unit/network/formats.rb +0 -365
- data/spec/unit/network/handler/fileserver.rb +0 -176
- data/spec/unit/network/http.rb +0 -35
- data/spec/unit/network/http/api/v1.rb +0 -122
- data/spec/unit/network/http/handler.rb +0 -458
- data/spec/unit/network/http/mongrel.rb +0 -131
- data/spec/unit/network/http/mongrel/rest.rb +0 -232
- data/spec/unit/network/http/rack.rb +0 -102
- data/spec/unit/network/http/rack/rest.rb +0 -199
- data/spec/unit/network/http/rack/xmlrpc.rb +0 -157
- data/spec/unit/network/http/webrick.rb +0 -339
- data/spec/unit/network/http/webrick/rest.rb +0 -157
- data/spec/unit/network/http_pool.rb +0 -206
- data/spec/unit/network/rest_authconfig.rb +0 -146
- data/spec/unit/network/rest_authorization.rb +0 -43
- data/spec/unit/network/rights.rb +0 -519
- data/spec/unit/network/server.rb +0 -534
- data/spec/unit/network/xmlrpc/client.rb +0 -171
- data/spec/unit/node.rb +0 -200
- data/spec/unit/node/environment.rb +0 -187
- data/spec/unit/node/facts.rb +0 -97
- data/spec/unit/other/checksum.rb +0 -92
- data/spec/unit/other/selinux.rb +0 -85
- data/spec/unit/other/transbucket.rb +0 -188
- data/spec/unit/other/transobject.rb +0 -112
- data/spec/unit/parameter.rb +0 -405
- data/spec/unit/parser/ast.rb +0 -41
- data/spec/unit/parser/ast/arithmetic_operator.rb +0 -73
- data/spec/unit/parser/ast/astarray.rb +0 -72
- data/spec/unit/parser/ast/boolean_operator.rb +0 -53
- data/spec/unit/parser/ast/casestatement.rb +0 -135
- data/spec/unit/parser/ast/collection.rb +0 -63
- data/spec/unit/parser/ast/collexpr.rb +0 -115
- data/spec/unit/parser/ast/comparison_operator.rb +0 -92
- data/spec/unit/parser/ast/definition.rb +0 -213
- data/spec/unit/parser/ast/function.rb +0 -83
- data/spec/unit/parser/ast/hostclass.rb +0 -148
- data/spec/unit/parser/ast/ifstatement.rb +0 -76
- data/spec/unit/parser/ast/leaf.rb +0 -298
- data/spec/unit/parser/ast/match_operator.rb +0 -50
- data/spec/unit/parser/ast/minus.rb +0 -36
- data/spec/unit/parser/ast/node.rb +0 -145
- data/spec/unit/parser/ast/nop.rb +0 -20
- data/spec/unit/parser/ast/not.rb +0 -30
- data/spec/unit/parser/ast/resource.rb +0 -103
- data/spec/unit/parser/ast/resource_override.rb +0 -51
- data/spec/unit/parser/ast/resource_reference.rb +0 -69
- data/spec/unit/parser/ast/selector.rb +0 -155
- data/spec/unit/parser/ast/vardef.rb +0 -47
- data/spec/unit/parser/collector.rb +0 -556
- data/spec/unit/parser/compiler.rb +0 -604
- data/spec/unit/parser/files.rb +0 -190
- data/spec/unit/parser/functions.rb +0 -83
- data/spec/unit/parser/functions/fqdn_rand.rb +0 -62
- data/spec/unit/parser/functions/generate.rb +0 -41
- data/spec/unit/parser/functions/inline_template.rb +0 -59
- data/spec/unit/parser/functions/realize.rb +0 -51
- data/spec/unit/parser/functions/regsubst.rb +0 -168
- data/spec/unit/parser/functions/require.rb +0 -69
- data/spec/unit/parser/functions/shellquote.rb +0 -92
- data/spec/unit/parser/functions/split.rb +0 -51
- data/spec/unit/parser/functions/sprintf.rb +0 -42
- data/spec/unit/parser/functions/template.rb +0 -62
- data/spec/unit/parser/functions/versioncmp.rb +0 -29
- data/spec/unit/parser/interpreter.rb +0 -147
- data/spec/unit/parser/lexer.rb +0 -731
- data/spec/unit/parser/loaded_code.rb +0 -215
- data/spec/unit/parser/parser.rb +0 -423
- data/spec/unit/parser/resource.rb +0 -529
- data/spec/unit/parser/resource/reference.rb +0 -111
- data/spec/unit/parser/scope.rb +0 -387
- data/spec/unit/parser/templatewrapper.rb +0 -134
- data/spec/unit/property.rb +0 -305
- data/spec/unit/property/keyvalue.rb +0 -168
- data/spec/unit/property/list.rb +0 -166
- data/spec/unit/property/ordered_list.rb +0 -64
- data/spec/unit/provider.rb +0 -31
- data/spec/unit/provider/augeas/augeas.rb +0 -413
- data/spec/unit/provider/confine.rb +0 -78
- data/spec/unit/provider/confine/exists.rb +0 -81
- data/spec/unit/provider/confine/false.rb +0 -53
- data/spec/unit/provider/confine/feature.rb +0 -60
- data/spec/unit/provider/confine/true.rb +0 -53
- data/spec/unit/provider/confine/variable.rb +0 -107
- data/spec/unit/provider/confine_collection.rb +0 -134
- data/spec/unit/provider/confiner.rb +0 -63
- data/spec/unit/provider/group/groupadd.rb +0 -31
- data/spec/unit/provider/group/ldap.rb +0 -105
- data/spec/unit/provider/ldap.rb +0 -248
- data/spec/unit/provider/macauthorization.rb +0 -147
- data/spec/unit/provider/mcx/mcxcontent.rb +0 -175
- data/spec/unit/provider/mount.rb +0 -130
- data/spec/unit/provider/mount/parsed.rb +0 -194
- data/spec/unit/provider/naginator.rb +0 -58
- data/spec/unit/provider/package/apt.rb +0 -138
- data/spec/unit/provider/package/dpkg.rb +0 -170
- data/spec/unit/provider/package/gem.rb +0 -87
- data/spec/unit/provider/package/hpux.rb +0 -52
- data/spec/unit/provider/package/pkgdmg.rb +0 -73
- data/spec/unit/provider/parsedfile.rb +0 -95
- data/spec/unit/provider/selboolean.rb +0 -37
- data/spec/unit/provider/selmodule.rb +0 -66
- data/spec/unit/provider/service/daemontools.rb +0 -166
- data/spec/unit/provider/service/debian.rb +0 -89
- data/spec/unit/provider/service/init.rb +0 -121
- data/spec/unit/provider/service/launchd.rb +0 -200
- data/spec/unit/provider/service/redhat.rb +0 -96
- data/spec/unit/provider/service/runit.rb +0 -140
- data/spec/unit/provider/ssh_authorized_key/parsed.rb +0 -206
- data/spec/unit/provider/sshkey/parsed.rb +0 -38
- data/spec/unit/provider/user/hpux.rb +0 -25
- data/spec/unit/provider/user/ldap.rb +0 -279
- data/spec/unit/provider/user/user_role_add.rb +0 -249
- data/spec/unit/provider/user/useradd.rb +0 -115
- data/spec/unit/provider/zfs/solaris.rb +0 -99
- data/spec/unit/provider/zone/solaris.rb +0 -42
- data/spec/unit/provider/zpool/solaris.rb +0 -179
- data/spec/unit/rails.rb +0 -133
- data/spec/unit/rails/host.rb +0 -163
- data/spec/unit/rails/param_value.rb +0 -49
- data/spec/unit/rails/resource.rb +0 -107
- data/spec/unit/relationship.rb +0 -236
- data/spec/unit/reports.rb +0 -61
- data/spec/unit/resource.rb +0 -495
- data/spec/unit/resource/catalog.rb +0 -1053
- data/spec/unit/resource/reference.rb +0 -111
- data/spec/unit/simple_graph.rb +0 -551
- data/spec/unit/ssl/certificate.rb +0 -124
- data/spec/unit/ssl/certificate_authority.rb +0 -741
- data/spec/unit/ssl/certificate_authority/interface.rb +0 -269
- data/spec/unit/ssl/certificate_factory.rb +0 -107
- data/spec/unit/ssl/certificate_request.rb +0 -193
- data/spec/unit/ssl/certificate_revocation_list.rb +0 -168
- data/spec/unit/ssl/host.rb +0 -704
- data/spec/unit/ssl/inventory.rb +0 -180
- data/spec/unit/ssl/key.rb +0 -198
- data/spec/unit/transaction.rb +0 -146
- data/spec/unit/transaction/change.rb +0 -187
- data/spec/unit/transaction/event.rb +0 -25
- data/spec/unit/transaction/report.rb +0 -40
- data/spec/unit/type.rb +0 -426
- data/spec/unit/type/augeas.rb +0 -106
- data/spec/unit/type/component.rb +0 -63
- data/spec/unit/type/computer.rb +0 -78
- data/spec/unit/type/cron.rb +0 -33
- data/spec/unit/type/exec.rb +0 -116
- data/spec/unit/type/file.rb +0 -810
- data/spec/unit/type/file/checksum.rb +0 -28
- data/spec/unit/type/file/content.rb +0 -297
- data/spec/unit/type/file/ensure.rb +0 -84
- data/spec/unit/type/file/group.rb +0 -123
- data/spec/unit/type/file/owner.rb +0 -143
- data/spec/unit/type/file/selinux.rb +0 -84
- data/spec/unit/type/file/source.rb +0 -264
- data/spec/unit/type/filebucket.rb +0 -74
- data/spec/unit/type/group.rb +0 -39
- data/spec/unit/type/macauthorization.rb +0 -111
- data/spec/unit/type/maillist.rb +0 -42
- data/spec/unit/type/mcx.rb +0 -100
- data/spec/unit/type/mount.rb +0 -211
- data/spec/unit/type/nagios.rb +0 -63
- data/spec/unit/type/noop_metaparam.rb +0 -37
- data/spec/unit/type/package.rb +0 -236
- data/spec/unit/type/resources.rb +0 -89
- data/spec/unit/type/schedule.rb +0 -333
- data/spec/unit/type/selboolean.rb +0 -45
- data/spec/unit/type/selmodule.rb +0 -18
- data/spec/unit/type/service.rb +0 -230
- data/spec/unit/type/ssh_authorized_key.rb +0 -140
- data/spec/unit/type/tidy.rb +0 -422
- data/spec/unit/type/user.rb +0 -285
- data/spec/unit/type/zfs.rb +0 -45
- data/spec/unit/type/zone.rb +0 -20
- data/spec/unit/type/zpool.rb +0 -110
- data/spec/unit/util/autoload.rb +0 -133
- data/spec/unit/util/autoload/file_cache.rb +0 -183
- data/spec/unit/util/backups.rb +0 -159
- data/spec/unit/util/cache_accumulator.rb +0 -69
- data/spec/unit/util/cacher.rb +0 -185
- data/spec/unit/util/checksums.rb +0 -113
- data/spec/unit/util/constant_inflector.rb +0 -70
- data/spec/unit/util/feature.rb +0 -72
- data/spec/unit/util/file_locking.rb +0 -115
- data/spec/unit/util/filetype.rb +0 -100
- data/spec/unit/util/json.rb +0 -21
- data/spec/unit/util/ldap/connection.rb +0 -169
- data/spec/unit/util/ldap/generator.rb +0 -54
- data/spec/unit/util/ldap/manager.rb +0 -654
- data/spec/unit/util/loadedfile.rb +0 -65
- data/spec/unit/util/log.rb +0 -202
- data/spec/unit/util/metric.rb +0 -95
- data/spec/unit/util/monkey_patches.rb +0 -103
- data/spec/unit/util/nagios_maker.rb +0 -126
- data/spec/unit/util/package.rb +0 -21
- data/spec/unit/util/posix.rb +0 -256
- data/spec/unit/util/queue.rb +0 -96
- data/spec/unit/util/queue/stomp.rb +0 -140
- data/spec/unit/util/reference_serializer.rb +0 -52
- data/spec/unit/util/resource_template.rb +0 -58
- data/spec/unit/util/selinux.rb +0 -280
- data/spec/unit/util/settings.rb +0 -1058
- data/spec/unit/util/settings/file_setting.rb +0 -248
- data/spec/unit/util/storage.rb +0 -248
- data/spec/unit/util/tagging.rb +0 -102
- data/spec/unit/util/user_attr.rb +0 -47
- data/spec/unit/util/warnings.rb +0 -39
- data/spec/unit/util/zaml.rb +0 -38
- data/test/language/ast/casestatement.rb +0 -103
- data/test/language/ast/resource.rb +0 -58
- data/test/language/ast/resource_reference.rb +0 -77
- data/test/language/ast/selector.rb +0 -61
- data/test/language/resource.rb +0 -172
- data/test/lib/puppettest/support/collection.rb +0 -29
- data/test/network/client/resource.rb +0 -52
- data/test/network/handler/bucket.rb +0 -313
- data/test/network/handler/resource.rb +0 -250
- data/test/other/dsl.rb +0 -215
- data/test/other/events.rb +0 -124
- data/test/ral/type/group.rb +0 -170
@@ -6,784 +6,833 @@ require 'puppettest'
|
|
6
6
|
require 'puppet/network/handler/fileserver'
|
7
7
|
|
8
8
|
class TestFileServer < Test::Unit::TestCase
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
9
|
+
include PuppetTest
|
10
|
+
|
11
|
+
def mkmount(path = nil)
|
12
|
+
mount = nil
|
13
|
+
name = "yaytest"
|
14
|
+
base = path || tempfile
|
15
|
+
Dir.mkdir(base) unless FileTest.exists?(base)
|
16
|
+
# Create a test file
|
17
|
+
File.open(File.join(base, "file"), "w") { |f| f.puts "bazoo" }
|
18
|
+
assert_nothing_raised {
|
19
|
+
mount = Puppet::Network::Handler.fileserver::Mount.new(name, base)
|
20
|
+
}
|
21
|
+
|
22
|
+
mount
|
23
|
+
end
|
24
|
+
# make a simple file source
|
25
|
+
def mktestdir
|
26
|
+
testdir = File.join(tmpdir, "remotefilecopytesting")
|
27
|
+
@@tmpfiles << testdir
|
28
|
+
|
29
|
+
# create a tmpfile
|
30
|
+
pattern = "tmpfile"
|
31
|
+
tmpfile = File.join(testdir, pattern)
|
32
|
+
assert_nothing_raised {
|
33
|
+
Dir.mkdir(testdir)
|
34
|
+
File.open(tmpfile, "w") { |f|
|
35
|
+
3.times { f.puts rand(100) }
|
36
|
+
}
|
37
|
+
}
|
38
|
+
|
39
|
+
[testdir, %r{#{pattern}}, tmpfile]
|
40
|
+
end
|
41
|
+
|
42
|
+
# make a bunch of random test files
|
43
|
+
def mktestfiles(testdir)
|
44
|
+
@@tmpfiles << testdir
|
45
|
+
assert_nothing_raised {
|
46
|
+
files = %w{a b c d e}.collect { |l|
|
47
|
+
name = File.join(testdir, "file#{l}")
|
48
|
+
File.open(name, "w") { |f|
|
49
|
+
f.puts rand(100)
|
50
|
+
}
|
51
|
+
|
52
|
+
name
|
53
|
+
}
|
54
|
+
|
55
|
+
return files
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
def assert_describe(base, file, server)
|
60
|
+
file = File.basename(file)
|
61
|
+
assert_nothing_raised {
|
62
|
+
desc = server.describe(base + file)
|
63
|
+
assert(desc, "Got no description for #{file}")
|
64
|
+
assert(desc != "", "Got no description for #{file}")
|
65
|
+
assert_match(/^\d+/, desc, "Got invalid description #{desc}")
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
# test for invalid names
|
70
|
+
def test_namefailures
|
71
|
+
server = nil
|
72
|
+
assert_nothing_raised {
|
73
|
+
|
74
|
+
server = Puppet::Network::Handler.fileserver.new(
|
75
|
+
|
76
|
+
:Local => true,
|
77
|
+
|
78
|
+
:Config => false
|
79
|
+
)
|
80
|
+
}
|
81
|
+
|
82
|
+
[" ", "=" "+", "&", "#", "*"].each do |char|
|
83
|
+
assert_raise(Puppet::Network::Handler::FileServerError, "'#{char}' did not throw a failure in fileserver module names") {
|
84
|
+
server.mount("/tmp", "invalid#{char}name")
|
85
|
+
}
|
25
86
|
end
|
26
|
-
|
27
|
-
def mktestdir
|
28
|
-
testdir = File.join(tmpdir(), "remotefilecopytesting")
|
29
|
-
@@tmpfiles << testdir
|
30
|
-
|
31
|
-
# create a tmpfile
|
32
|
-
pattern = "tmpfile"
|
33
|
-
tmpfile = File.join(testdir, pattern)
|
34
|
-
assert_nothing_raised {
|
35
|
-
Dir.mkdir(testdir)
|
36
|
-
File.open(tmpfile, "w") { |f|
|
37
|
-
3.times { f.puts rand(100) }
|
38
|
-
}
|
39
|
-
}
|
87
|
+
end
|
40
88
|
|
41
|
-
|
42
|
-
|
89
|
+
# verify that listing the root behaves as expected
|
90
|
+
def test_listroot
|
91
|
+
server = nil
|
92
|
+
testdir, pattern, tmpfile = mktestdir
|
43
93
|
|
44
|
-
|
45
|
-
|
46
|
-
@@tmpfiles << testdir
|
47
|
-
assert_nothing_raised {
|
48
|
-
files = %w{a b c d e}.collect { |l|
|
49
|
-
name = File.join(testdir, "file%s" % l)
|
50
|
-
File.open(name, "w") { |f|
|
51
|
-
f.puts rand(100)
|
52
|
-
}
|
53
|
-
|
54
|
-
name
|
55
|
-
}
|
94
|
+
file = nil
|
95
|
+
checks = Puppet::Network::Handler.fileserver::CHECKPARAMS
|
56
96
|
|
57
|
-
|
58
|
-
|
59
|
-
end
|
97
|
+
# and make our fileserver
|
98
|
+
assert_nothing_raised {
|
60
99
|
|
61
|
-
|
62
|
-
file = File.basename(file)
|
63
|
-
assert_nothing_raised {
|
64
|
-
desc = server.describe(base + file)
|
65
|
-
assert(desc, "Got no description for %s" % file)
|
66
|
-
assert(desc != "", "Got no description for %s" % file)
|
67
|
-
assert_match(/^\d+/, desc, "Got invalid description %s" % desc)
|
68
|
-
}
|
69
|
-
end
|
100
|
+
server = Puppet::Network::Handler.fileserver.new(
|
70
101
|
|
71
|
-
|
72
|
-
def test_namefailures
|
73
|
-
server = nil
|
74
|
-
assert_nothing_raised {
|
75
|
-
server = Puppet::Network::Handler.fileserver.new(
|
76
|
-
:Local => true,
|
77
|
-
:Config => false
|
78
|
-
)
|
79
|
-
}
|
102
|
+
:Local => true,
|
80
103
|
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
}
|
85
|
-
end
|
86
|
-
end
|
104
|
+
:Config => false
|
105
|
+
)
|
106
|
+
}
|
87
107
|
|
88
|
-
#
|
89
|
-
|
90
|
-
|
91
|
-
|
108
|
+
# mount the testdir
|
109
|
+
assert_nothing_raised {
|
110
|
+
server.mount(testdir, "test")
|
111
|
+
}
|
92
112
|
|
93
|
-
|
94
|
-
|
113
|
+
# and verify different iterations of 'root' return the same value
|
114
|
+
list = nil
|
115
|
+
assert_nothing_raised {
|
116
|
+
list = server.list("/test/", :manage, true, false)
|
117
|
+
}
|
95
118
|
|
96
|
-
|
97
|
-
assert_nothing_raised {
|
98
|
-
server = Puppet::Network::Handler.fileserver.new(
|
99
|
-
:Local => true,
|
100
|
-
:Config => false
|
101
|
-
)
|
102
|
-
}
|
119
|
+
assert(list =~ pattern)
|
103
120
|
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
121
|
+
assert_nothing_raised {
|
122
|
+
list = server.list("/test", :manage, true, false)
|
123
|
+
}
|
124
|
+
assert(list =~ pattern)
|
108
125
|
|
109
|
-
|
110
|
-
list = nil
|
111
|
-
assert_nothing_raised {
|
112
|
-
list = server.list("/test/", :manage, true, false)
|
113
|
-
}
|
126
|
+
end
|
114
127
|
|
115
|
-
|
128
|
+
# test listing individual files
|
129
|
+
def test_getfilelist
|
130
|
+
server = nil
|
131
|
+
testdir, pattern, tmpfile = mktestdir
|
116
132
|
|
117
|
-
|
118
|
-
list = server.list("/test", :manage, true, false)
|
119
|
-
}
|
120
|
-
assert(list =~ pattern)
|
133
|
+
file = nil
|
121
134
|
|
122
|
-
|
135
|
+
assert_nothing_raised {
|
123
136
|
|
124
|
-
|
125
|
-
def test_getfilelist
|
126
|
-
server = nil
|
127
|
-
testdir, pattern, tmpfile = mktestdir()
|
137
|
+
server = Puppet::Network::Handler.fileserver.new(
|
128
138
|
|
129
|
-
|
139
|
+
:Local => true,
|
130
140
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
:Config => false
|
135
|
-
)
|
136
|
-
}
|
141
|
+
:Config => false
|
142
|
+
)
|
143
|
+
}
|
137
144
|
|
138
|
-
|
139
|
-
|
140
|
-
|
145
|
+
assert_nothing_raised {
|
146
|
+
server.mount(testdir, "test")
|
147
|
+
}
|
141
148
|
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
149
|
+
# get our listing
|
150
|
+
list = nil
|
151
|
+
sfile = "/test/tmpfile"
|
152
|
+
assert_nothing_raised {
|
153
|
+
list = server.list(sfile, :manage, true, false)
|
154
|
+
}
|
148
155
|
|
149
|
-
|
156
|
+
output = "/\tfile"
|
150
157
|
|
151
|
-
|
152
|
-
|
158
|
+
# verify it got listed as a file
|
159
|
+
assert_equal(output, list)
|
153
160
|
|
154
|
-
|
155
|
-
|
161
|
+
# verify we got all fields
|
162
|
+
assert(list !~ /\t\t/)
|
156
163
|
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
164
|
+
# verify that we didn't get the directory itself
|
165
|
+
list.split("\n").each { |line|
|
166
|
+
assert(line !~ %r{remotefile})
|
167
|
+
}
|
161
168
|
|
162
|
-
|
163
|
-
|
169
|
+
# and then verify that the contents match
|
170
|
+
contents = File.read(tmpfile)
|
164
171
|
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
172
|
+
ret = nil
|
173
|
+
assert_nothing_raised {
|
174
|
+
ret = server.retrieve(sfile)
|
175
|
+
}
|
169
176
|
|
170
|
-
|
171
|
-
|
177
|
+
assert_equal(contents, ret)
|
178
|
+
end
|
172
179
|
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
180
|
+
# check that the fileserver is seeing newly created files
|
181
|
+
def test_seenewfiles
|
182
|
+
server = nil
|
183
|
+
testdir, pattern, tmpfile = mktestdir
|
177
184
|
|
178
185
|
|
179
|
-
|
186
|
+
newfile = File.join(testdir, "newfile")
|
180
187
|
|
181
|
-
|
182
|
-
|
183
|
-
|
188
|
+
# go through the whole schtick again...
|
189
|
+
file = nil
|
190
|
+
checks = Puppet::Network::Handler.fileserver::CHECKPARAMS
|
184
191
|
|
185
|
-
|
186
|
-
server = Puppet::Network::Handler.fileserver.new(
|
187
|
-
:Local => true,
|
188
|
-
:Config => false
|
189
|
-
)
|
190
|
-
}
|
192
|
+
assert_nothing_raised {
|
191
193
|
|
192
|
-
|
193
|
-
server.mount(testdir, "test")
|
194
|
-
}
|
194
|
+
server = Puppet::Network::Handler.fileserver.new(
|
195
195
|
|
196
|
-
|
197
|
-
sfile = "/test/"
|
198
|
-
assert_nothing_raised {
|
199
|
-
list = server.list(sfile, :manage, true, false)
|
200
|
-
}
|
196
|
+
:Local => true,
|
201
197
|
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
}
|
198
|
+
:Config => false
|
199
|
+
)
|
200
|
+
}
|
206
201
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
}
|
202
|
+
assert_nothing_raised {
|
203
|
+
server.mount(testdir, "test")
|
204
|
+
}
|
211
205
|
|
212
|
-
|
213
|
-
|
206
|
+
list = nil
|
207
|
+
sfile = "/test/"
|
208
|
+
assert_nothing_raised {
|
209
|
+
list = server.list(sfile, :manage, true, false)
|
210
|
+
}
|
214
211
|
|
215
|
-
|
216
|
-
|
217
|
-
|
212
|
+
# create the new file
|
213
|
+
File.open(newfile, "w") { |f|
|
214
|
+
3.times { f.puts rand(100) }
|
215
|
+
}
|
218
216
|
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
assert_nothing_raised {
|
224
|
-
server = Puppet::Network::Handler.fileserver.new(
|
225
|
-
:Local => true,
|
226
|
-
:Config => false
|
227
|
-
)
|
228
|
-
}
|
217
|
+
newlist = nil
|
218
|
+
assert_nothing_raised {
|
219
|
+
newlist = server.list(sfile, :manage, true, false)
|
220
|
+
}
|
229
221
|
|
230
|
-
|
231
|
-
|
232
|
-
}
|
222
|
+
# verify the list has changed
|
223
|
+
assert(list != newlist)
|
233
224
|
|
234
|
-
|
225
|
+
# and verify that we are specifically seeing the new file
|
226
|
+
assert(newlist =~ /newfile/)
|
227
|
+
end
|
235
228
|
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
229
|
+
# verify we can mount /, which is what local file servers will
|
230
|
+
# normally do
|
231
|
+
def test_mountroot
|
232
|
+
server = nil
|
233
|
+
assert_nothing_raised {
|
240
234
|
|
241
|
-
|
242
|
-
assert_nothing_raised {
|
243
|
-
list = server.list("/root" + testdir, :manage, true, false)
|
244
|
-
}
|
235
|
+
server = Puppet::Network::Handler.fileserver.new(
|
245
236
|
|
246
|
-
|
247
|
-
end
|
237
|
+
:Local => true,
|
248
238
|
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
239
|
+
:Config => false
|
240
|
+
)
|
241
|
+
}
|
242
|
+
|
243
|
+
assert_nothing_raised {
|
244
|
+
server.mount("/", "root")
|
245
|
+
}
|
246
|
+
|
247
|
+
testdir, pattern, tmpfile = mktestdir
|
248
|
+
|
249
|
+
list = nil
|
250
|
+
assert_nothing_raised {
|
251
|
+
list = server.list("/root/#{testdir}", :manage, true, false)
|
252
|
+
}
|
253
|
+
|
254
|
+
assert(list =~ pattern)
|
255
|
+
assert_nothing_raised {
|
256
|
+
list = server.list("/root#{testdir}", :manage, true, false)
|
257
|
+
}
|
258
|
+
|
259
|
+
assert(list =~ pattern)
|
260
|
+
end
|
261
|
+
|
262
|
+
# verify that we're correctly recursing the right number of levels
|
263
|
+
def test_recursionlevels
|
264
|
+
server = nil
|
265
|
+
assert_nothing_raised {
|
266
|
+
|
267
|
+
server = Puppet::Network::Handler.fileserver.new(
|
258
268
|
|
259
|
-
|
260
|
-
basedir = File.join(tmpdir(), "recurseremotetesting")
|
261
|
-
testdir = "%s/with/some/sub/directories/for/the/purposes/of/testing" % basedir
|
262
|
-
oldfile = File.join(testdir, "oldfile")
|
263
|
-
assert_nothing_raised {
|
264
|
-
system("mkdir -p %s" % testdir)
|
265
|
-
File.open(oldfile, "w") { |f|
|
266
|
-
3.times { f.puts rand(100) }
|
267
|
-
}
|
268
|
-
@@tmpfiles << basedir
|
269
|
-
}
|
269
|
+
:Local => true,
|
270
270
|
|
271
|
-
|
272
|
-
|
273
|
-
|
271
|
+
:Config => false
|
272
|
+
)
|
273
|
+
}
|
274
274
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
275
|
+
# make our deep recursion
|
276
|
+
basedir = File.join(tmpdir, "recurseremotetesting")
|
277
|
+
testdir = "#{basedir}/with/some/sub/directories/for/the/purposes/of/testing"
|
278
|
+
oldfile = File.join(testdir, "oldfile")
|
279
|
+
assert_nothing_raised {
|
280
|
+
system("mkdir -p #{testdir}")
|
281
|
+
File.open(oldfile, "w") { |f|
|
282
|
+
3.times { f.puts rand(100) }
|
283
|
+
}
|
284
|
+
@@tmpfiles << basedir
|
285
|
+
}
|
286
|
+
|
287
|
+
assert_nothing_raised {
|
288
|
+
server.mount(basedir, "test")
|
289
|
+
}
|
290
|
+
|
291
|
+
# get our list
|
292
|
+
list = nil
|
293
|
+
assert_nothing_raised {
|
294
|
+
list = server.list("/test/with", :manage, false, false)
|
295
|
+
}
|
296
|
+
|
297
|
+
# make sure we only got one line, since we're not recursing
|
298
|
+
assert(list !~ /\n/)
|
299
|
+
|
300
|
+
# for each level of recursion, make sure we get the right list
|
301
|
+
[0, 1, 2].each { |num|
|
302
|
+
assert_nothing_raised {
|
303
|
+
list = server.list("/test/with", :manage, num, false)
|
304
|
+
}
|
305
|
+
|
306
|
+
count = 0
|
307
|
+
while list =~ /\n/
|
308
|
+
list.sub!(/\n/, '')
|
309
|
+
count += 1
|
310
|
+
end
|
311
|
+
assert_equal(num, count)
|
312
|
+
}
|
313
|
+
end
|
314
|
+
|
315
|
+
# verify that we're not seeing the dir we ask for; i.e., that our
|
316
|
+
# list is relative to that dir, not it's parent dir
|
317
|
+
def test_listedpath
|
318
|
+
server = nil
|
319
|
+
assert_nothing_raised {
|
320
|
+
|
321
|
+
server = Puppet::Network::Handler.fileserver.new(
|
322
|
+
|
323
|
+
:Local => true,
|
324
|
+
|
325
|
+
:Config => false
|
326
|
+
)
|
327
|
+
}
|
328
|
+
|
329
|
+
|
330
|
+
# create a deep dir
|
331
|
+
basedir = tempfile
|
332
|
+
testdir = "#{basedir}/with/some/sub/directories/for/testing"
|
333
|
+
oldfile = File.join(testdir, "oldfile")
|
334
|
+
assert_nothing_raised {
|
335
|
+
system("mkdir -p #{testdir}")
|
336
|
+
File.open(oldfile, "w") { |f|
|
337
|
+
3.times { f.puts rand(100) }
|
338
|
+
}
|
339
|
+
@@tmpfiles << basedir
|
340
|
+
}
|
341
|
+
|
342
|
+
# mounty mounty
|
343
|
+
assert_nothing_raised {
|
344
|
+
server.mount(basedir, "localhost")
|
345
|
+
}
|
346
|
+
|
347
|
+
list = nil
|
348
|
+
# and then check a few dirs
|
349
|
+
assert_nothing_raised {
|
350
|
+
list = server.list("/localhost/with", :manage, false, false)
|
351
|
+
}
|
352
|
+
|
353
|
+
assert(list !~ /with/)
|
354
|
+
|
355
|
+
assert_nothing_raised {
|
356
|
+
list = server.list("/localhost/with/some/sub", :manage, true, false)
|
357
|
+
}
|
358
|
+
|
359
|
+
assert(list !~ /sub/)
|
360
|
+
end
|
361
|
+
|
362
|
+
# test many dirs, not necessarily very deep
|
363
|
+
def test_widelists
|
364
|
+
server = nil
|
365
|
+
assert_nothing_raised {
|
366
|
+
|
367
|
+
server = Puppet::Network::Handler.fileserver.new(
|
368
|
+
|
369
|
+
:Local => true,
|
370
|
+
|
371
|
+
:Config => false
|
372
|
+
)
|
373
|
+
}
|
374
|
+
|
375
|
+
basedir = tempfile
|
376
|
+
dirs = %w{a set of directories}
|
377
|
+
assert_nothing_raised {
|
378
|
+
Dir.mkdir(basedir)
|
379
|
+
dirs.each { |dir|
|
380
|
+
Dir.mkdir(File.join(basedir, dir))
|
381
|
+
}
|
382
|
+
@@tmpfiles << basedir
|
383
|
+
}
|
384
|
+
|
385
|
+
assert_nothing_raised {
|
386
|
+
server.mount(basedir, "localhost")
|
387
|
+
}
|
388
|
+
|
389
|
+
list = nil
|
390
|
+
assert_nothing_raised {
|
391
|
+
list = server.list("/localhost/", :manage, 1, false)
|
392
|
+
}
|
393
|
+
assert_instance_of(String, list, "Server returned %s instead of string")
|
394
|
+
list = list.split("\n")
|
395
|
+
|
396
|
+
assert_equal(dirs.length + 1, list.length)
|
397
|
+
end
|
398
|
+
|
399
|
+
# verify that 'describe' works as advertised
|
400
|
+
def test_describe
|
401
|
+
server = nil
|
402
|
+
testdir = tstdir
|
403
|
+
files = mktestfiles(testdir)
|
404
|
+
|
405
|
+
file = nil
|
406
|
+
checks = Puppet::Network::Handler.fileserver::CHECKPARAMS
|
407
|
+
|
408
|
+
assert_nothing_raised {
|
409
|
+
|
410
|
+
server = Puppet::Network::Handler.fileserver.new(
|
411
|
+
|
412
|
+
:Local => true,
|
413
|
+
|
414
|
+
:Config => false
|
415
|
+
)
|
416
|
+
}
|
417
|
+
|
418
|
+
assert_nothing_raised {
|
419
|
+
server.mount(testdir, "test")
|
420
|
+
}
|
421
|
+
|
422
|
+
# get our list
|
423
|
+
list = nil
|
424
|
+
sfile = "/test/"
|
425
|
+
assert_nothing_raised {
|
426
|
+
list = server.list(sfile, :manage, true, false)
|
427
|
+
}
|
428
|
+
|
429
|
+
# and describe each file in the list
|
430
|
+
assert_nothing_raised {
|
431
|
+
list.split("\n").each { |line|
|
432
|
+
file, type = line.split("\t")
|
433
|
+
|
434
|
+
desc = server.describe(sfile + file)
|
435
|
+
}
|
436
|
+
}
|
437
|
+
|
438
|
+
# and then make sure we can describe everything that we know is there
|
439
|
+
files.each { |file|
|
440
|
+
assert_describe(sfile, file, server)
|
441
|
+
}
|
280
442
|
|
281
|
-
|
282
|
-
|
443
|
+
# And then describe some files that we know aren't there
|
444
|
+
retval = nil
|
445
|
+
assert_nothing_raised("Describing non-existent files raised an error") {
|
446
|
+
retval = server.describe(sfile + "noexisties")
|
447
|
+
}
|
283
448
|
|
284
|
-
|
285
|
-
[0, 1, 2].each { |num|
|
286
|
-
assert_nothing_raised {
|
287
|
-
list = server.list("/test/with", :manage, num, false)
|
288
|
-
}
|
449
|
+
assert_equal("", retval, "Description of non-existent files returned a value")
|
289
450
|
|
290
|
-
|
291
|
-
|
292
|
-
list.sub!(/\n/, '')
|
293
|
-
count += 1
|
294
|
-
end
|
295
|
-
assert_equal(num, count)
|
296
|
-
}
|
297
|
-
end
|
451
|
+
# Now try to describe some sources that don't even exist
|
452
|
+
retval = nil
|
298
453
|
|
299
|
-
|
300
|
-
|
301
|
-
def test_listedpath
|
302
|
-
server = nil
|
303
|
-
assert_nothing_raised {
|
304
|
-
server = Puppet::Network::Handler.fileserver.new(
|
305
|
-
:Local => true,
|
306
|
-
:Config => false
|
307
|
-
)
|
308
|
-
}
|
309
|
-
|
310
|
-
|
311
|
-
# create a deep dir
|
312
|
-
basedir = tempfile()
|
313
|
-
testdir = "%s/with/some/sub/directories/for/testing" % basedir
|
314
|
-
oldfile = File.join(testdir, "oldfile")
|
315
|
-
assert_nothing_raised {
|
316
|
-
system("mkdir -p %s" % testdir)
|
317
|
-
File.open(oldfile, "w") { |f|
|
318
|
-
3.times { f.puts rand(100) }
|
319
|
-
}
|
320
|
-
@@tmpfiles << basedir
|
321
|
-
}
|
322
|
-
|
323
|
-
# mounty mounty
|
324
|
-
assert_nothing_raised {
|
325
|
-
server.mount(basedir, "localhost")
|
326
|
-
}
|
327
|
-
|
328
|
-
list = nil
|
329
|
-
# and then check a few dirs
|
330
|
-
assert_nothing_raised {
|
331
|
-
list = server.list("/localhost/with", :manage, false, false)
|
332
|
-
}
|
333
|
-
|
334
|
-
assert(list !~ /with/)
|
335
|
-
|
336
|
-
assert_nothing_raised {
|
337
|
-
list = server.list("/localhost/with/some/sub", :manage, true, false)
|
338
|
-
}
|
339
|
-
|
340
|
-
assert(list !~ /sub/)
|
341
|
-
end
|
342
|
-
|
343
|
-
# test many dirs, not necessarily very deep
|
344
|
-
def test_widelists
|
345
|
-
server = nil
|
346
|
-
assert_nothing_raised {
|
347
|
-
server = Puppet::Network::Handler.fileserver.new(
|
348
|
-
:Local => true,
|
349
|
-
:Config => false
|
350
|
-
)
|
351
|
-
}
|
352
|
-
|
353
|
-
basedir = tempfile()
|
354
|
-
dirs = %w{a set of directories}
|
355
|
-
assert_nothing_raised {
|
356
|
-
Dir.mkdir(basedir)
|
357
|
-
dirs.each { |dir|
|
358
|
-
Dir.mkdir(File.join(basedir, dir))
|
359
|
-
}
|
360
|
-
@@tmpfiles << basedir
|
361
|
-
}
|
362
|
-
|
363
|
-
assert_nothing_raised {
|
364
|
-
server.mount(basedir, "localhost")
|
365
|
-
}
|
366
|
-
|
367
|
-
list = nil
|
368
|
-
assert_nothing_raised {
|
369
|
-
list = server.list("/localhost/", :manage, 1, false)
|
370
|
-
}
|
371
|
-
assert_instance_of(String, list, "Server returned %s instead of string")
|
372
|
-
list = list.split("\n")
|
373
|
-
|
374
|
-
assert_equal(dirs.length + 1, list.length)
|
375
|
-
end
|
376
|
-
|
377
|
-
# verify that 'describe' works as advertised
|
378
|
-
def test_describe
|
379
|
-
server = nil
|
380
|
-
testdir = tstdir()
|
381
|
-
files = mktestfiles(testdir)
|
454
|
+
assert_raise(
|
455
|
+
Puppet::Network::Handler::FileServerError,
|
382
456
|
|
383
|
-
|
384
|
-
|
457
|
+
"Describing non-existent mount did not raise an error") {
|
458
|
+
retval = server.describe("/notmounted/noexisties")
|
459
|
+
}
|
385
460
|
|
386
|
-
|
387
|
-
|
388
|
-
:Local => true,
|
389
|
-
:Config => false
|
390
|
-
)
|
391
|
-
}
|
461
|
+
assert_nil(retval, "Description of non-existent mounts returned a value")
|
462
|
+
end
|
392
463
|
|
393
|
-
|
394
|
-
|
395
|
-
}
|
396
|
-
|
397
|
-
# get our list
|
398
|
-
list = nil
|
399
|
-
sfile = "/test/"
|
400
|
-
assert_nothing_raised {
|
401
|
-
list = server.list(sfile, :manage, true, false)
|
402
|
-
}
|
403
|
-
|
404
|
-
# and describe each file in the list
|
405
|
-
assert_nothing_raised {
|
406
|
-
list.split("\n").each { |line|
|
407
|
-
file, type = line.split("\t")
|
408
|
-
|
409
|
-
desc = server.describe(sfile + file)
|
410
|
-
}
|
411
|
-
}
|
412
|
-
|
413
|
-
# and then make sure we can describe everything that we know is there
|
414
|
-
files.each { |file|
|
415
|
-
assert_describe(sfile, file, server)
|
416
|
-
}
|
464
|
+
def test_describe_does_not_fail_when_mount_does_not_find_file
|
465
|
+
server = Puppet::Network::Handler.fileserver.new(:Local => true, :Config => false)
|
417
466
|
|
418
|
-
|
419
|
-
|
420
|
-
assert_nothing_raised("Describing non-existent files raised an error") {
|
421
|
-
retval = server.describe(sfile + "noexisties")
|
422
|
-
}
|
423
|
-
|
424
|
-
assert_equal("", retval, "Description of non-existent files returned a value")
|
425
|
-
|
426
|
-
# Now try to describe some sources that don't even exist
|
427
|
-
retval = nil
|
428
|
-
assert_raise(Puppet::Network::Handler::FileServerError,
|
429
|
-
"Describing non-existent mount did not raise an error") {
|
430
|
-
retval = server.describe("/notmounted/" + "noexisties")
|
431
|
-
}
|
432
|
-
|
433
|
-
assert_nil(retval, "Description of non-existent mounts returned a value")
|
434
|
-
end
|
435
|
-
|
436
|
-
def test_describe_does_not_fail_when_mount_does_not_find_file
|
437
|
-
server = Puppet::Network::Handler.fileserver.new(:Local => true, :Config => false)
|
438
|
-
|
439
|
-
assert_nothing_raised("Failed when describing missing plugins") do
|
440
|
-
server.describe "/plugins"
|
441
|
-
end
|
467
|
+
assert_nothing_raised("Failed when describing missing plugins") do
|
468
|
+
server.describe "/plugins"
|
442
469
|
end
|
470
|
+
end
|
443
471
|
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
472
|
+
# test that our config file is parsing and working as planned
|
473
|
+
def test_configfile
|
474
|
+
server = nil
|
475
|
+
basedir = File.join(tmpdir, "fileserverconfigfiletesting")
|
476
|
+
@@tmpfiles << basedir
|
449
477
|
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
478
|
+
# make some dirs for mounting
|
479
|
+
Dir.mkdir(basedir)
|
480
|
+
mounts = {}
|
481
|
+
%w{thing thus the-se those}.each { |dir|
|
482
|
+
path = File.join(basedir, dir)
|
483
|
+
Dir.mkdir(path)
|
484
|
+
mounts[dir] = mktestfiles(path)
|
457
485
|
|
458
|
-
|
486
|
+
}
|
459
487
|
|
460
|
-
|
461
|
-
|
462
|
-
|
488
|
+
# create an example file with each of them
|
489
|
+
conffile = tempfile
|
490
|
+
@@tmpfiles << conffile
|
463
491
|
|
464
|
-
|
465
|
-
|
492
|
+
File.open(conffile, "w") { |f|
|
493
|
+
f.print "# a test config file
|
466
494
|
|
467
495
|
[thing]
|
468
|
-
|
469
|
-
|
496
|
+
path #{basedir}/thing
|
497
|
+
allow 192.168.0.*
|
470
498
|
|
471
499
|
[thus]
|
472
|
-
|
473
|
-
|
474
|
-
|
500
|
+
path #{basedir}/thus
|
501
|
+
allow *.madstop.com, *.kanies.com
|
502
|
+
deny *.sub.madstop.com
|
475
503
|
|
476
504
|
[the-se]
|
477
|
-
|
505
|
+
path #{basedir}/the-se
|
478
506
|
|
479
507
|
[those]
|
480
|
-
|
508
|
+
path #{basedir}/those
|
481
509
|
|
482
510
|
"
|
483
|
-
|
511
|
+
}
|
484
512
|
|
485
513
|
|
486
|
-
|
487
|
-
|
488
|
-
server = Puppet::Network::Handler.fileserver.new(
|
489
|
-
:Local => false,
|
490
|
-
:Config => conffile
|
491
|
-
)
|
492
|
-
}
|
514
|
+
# create a server with the file
|
515
|
+
assert_nothing_raised {
|
493
516
|
|
494
|
-
|
495
|
-
# run through once with no host/ip info, to verify everything is working
|
496
|
-
mounts.each { |mount, files|
|
497
|
-
mount = "/#{mount}/"
|
498
|
-
assert_nothing_raised {
|
499
|
-
list = server.list(mount, :manage, true, false)
|
500
|
-
}
|
517
|
+
server = Puppet::Network::Handler.fileserver.new(
|
501
518
|
|
502
|
-
|
503
|
-
list.split("\n").each { |line|
|
504
|
-
file, type = line.split("\t")
|
519
|
+
:Local => false,
|
505
520
|
|
506
|
-
|
507
|
-
|
508
|
-
|
521
|
+
:Config => conffile
|
522
|
+
)
|
523
|
+
}
|
509
524
|
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
525
|
+
list = nil
|
526
|
+
# run through once with no host/ip info, to verify everything is working
|
527
|
+
mounts.each { |mount, files|
|
528
|
+
mount = "/#{mount}/"
|
529
|
+
assert_nothing_raised {
|
530
|
+
list = server.list(mount, :manage, true, false)
|
531
|
+
}
|
514
532
|
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
533
|
+
assert_nothing_raised {
|
534
|
+
list.split("\n").each { |line|
|
535
|
+
file, type = line.split("\t")
|
536
|
+
|
537
|
+
desc = server.describe(mount + file)
|
538
|
+
}
|
539
|
+
}
|
540
|
+
|
541
|
+
files.each { |f|
|
542
|
+
assert_describe(mount, f, server)
|
543
|
+
}
|
544
|
+
}
|
545
|
+
|
546
|
+
# now let's check that things are being correctly forbidden
|
547
|
+
# this is just a map of names and expected results
|
548
|
+
{
|
549
|
+
"thing" => {
|
550
|
+
:deny => [
|
551
|
+
["hostname.com", "192.168.1.0"],
|
552
|
+
["hostname.com", "192.158.0.0"]
|
553
|
+
],
|
554
|
+
:allow => [
|
555
|
+
["hostname.com", "192.168.0.0"],
|
556
|
+
["hostname.com", "192.168.0.245"],
|
557
|
+
]
|
558
|
+
},
|
559
|
+
"thus" => {
|
560
|
+
:deny => [
|
561
|
+
["hostname.com", "192.168.1.0"],
|
562
|
+
["name.sub.madstop.com", "192.158.0.0"]
|
563
|
+
],
|
564
|
+
:allow => [
|
565
|
+
["luke.kanies.com", "192.168.0.0"],
|
566
|
+
["luke.madstop.com", "192.168.0.245"],
|
567
|
+
]
|
568
|
+
}
|
569
|
+
}.each { |mount, hash|
|
570
|
+
mount = "/#{mount}/"
|
571
|
+
|
572
|
+
# run through the map
|
573
|
+
hash.each { |type, ary|
|
574
|
+
ary.each { |sub|
|
575
|
+
host, ip = sub
|
576
|
+
|
577
|
+
case type
|
578
|
+
when :deny
|
579
|
+
|
580
|
+
assert_raise(
|
581
|
+
Puppet::AuthorizationError,
|
582
|
+
|
583
|
+
"Host #{host}, ip #{ip}, allowed #{mount}") {
|
584
|
+
list = server.list(mount, :manage, true, false, host, ip)
|
537
585
|
}
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
# run through the map
|
542
|
-
hash.each { |type, ary|
|
543
|
-
ary.each { |sub|
|
544
|
-
host, ip = sub
|
545
|
-
|
546
|
-
case type
|
547
|
-
when :deny
|
548
|
-
assert_raise(Puppet::AuthorizationError,
|
549
|
-
"Host %s, ip %s, allowed %s" %
|
550
|
-
[host, ip, mount]) {
|
551
|
-
list = server.list(mount, :manage, true, false, host, ip)
|
552
|
-
}
|
553
|
-
when :allow
|
554
|
-
assert_nothing_raised("Host %s, ip %s, denied %s" %
|
555
|
-
[host, ip, mount]) {
|
556
|
-
list = server.list(mount, :manage, true, false, host, ip)
|
557
|
-
}
|
558
|
-
end
|
559
|
-
}
|
586
|
+
when :allow
|
587
|
+
assert_nothing_raised("Host #{host}, ip #{ip}, denied #{mount}") {
|
588
|
+
list = server.list(mount, :manage, true, false, host, ip)
|
560
589
|
}
|
590
|
+
end
|
561
591
|
}
|
592
|
+
}
|
593
|
+
}
|
562
594
|
|
563
|
-
|
595
|
+
end
|
564
596
|
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
597
|
+
# Test that we smoothly handle invalid config files
|
598
|
+
def test_configfailures
|
599
|
+
# create an example file with each of them
|
600
|
+
conffile = tempfile
|
569
601
|
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
|
602
|
+
invalidmounts = {
|
603
|
+
"noexist" => "[noexist]
|
604
|
+
path /this/path/does/not/exist
|
605
|
+
allow 192.168.0.*
|
574
606
|
"
|
575
607
|
}
|
576
608
|
|
577
|
-
|
578
|
-
"[not valid]
|
579
|
-
|
580
|
-
|
609
|
+
invalidconfigs = [
|
610
|
+
"[not valid]
|
611
|
+
path /this/path/does/not/exist
|
612
|
+
allow 192.168.0.*
|
581
613
|
",
|
582
614
|
"[valid]
|
583
|
-
|
584
|
-
|
585
|
-
|
615
|
+
invalidstatement
|
616
|
+
path /etc
|
617
|
+
allow 192.168.0.*
|
586
618
|
",
|
587
619
|
"[valid]
|
588
|
-
|
620
|
+
allow 192.168.0.*
|
589
621
|
"
|
590
622
|
]
|
591
623
|
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
624
|
+
invalidmounts.each { |mount, text|
|
625
|
+
File.open(conffile, "w") { |f|
|
626
|
+
f.print text
|
627
|
+
}
|
596
628
|
|
597
629
|
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
server = Puppet::Network::Handler.fileserver.new(
|
602
|
-
:Local => true,
|
603
|
-
:Config => conffile
|
604
|
-
)
|
605
|
-
}
|
630
|
+
# create a server with the file
|
631
|
+
server = nil
|
632
|
+
assert_nothing_raised {
|
606
633
|
|
607
|
-
|
608
|
-
"Invalid mount was mounted") {
|
609
|
-
server.list(mount, :manage)
|
610
|
-
}
|
611
|
-
}
|
634
|
+
server = Puppet::Network::Handler.fileserver.new(
|
612
635
|
|
613
|
-
|
614
|
-
File.open(conffile, "w") { |f|
|
615
|
-
f.print text
|
616
|
-
}
|
636
|
+
:Local => true,
|
617
637
|
|
638
|
+
:Config => conffile
|
639
|
+
)
|
640
|
+
}
|
618
641
|
|
619
|
-
# create a server with the file
|
620
|
-
server = nil
|
621
|
-
assert_raise(Puppet::Network::Handler::FileServerError,
|
622
|
-
"Invalid config %s did not raise error" % i) {
|
623
|
-
server = Puppet::Network::Handler.fileserver.new(
|
624
|
-
:Local => true,
|
625
|
-
:Config => conffile
|
626
|
-
)
|
627
|
-
}
|
628
|
-
}
|
629
|
-
end
|
630
642
|
|
631
|
-
|
632
|
-
|
633
|
-
server = nil
|
643
|
+
assert_raise(
|
644
|
+
Puppet::Network::Handler::FileServerError,
|
634
645
|
|
635
|
-
|
636
|
-
|
646
|
+
"Invalid mount was mounted") {
|
647
|
+
server.list(mount, :manage)
|
648
|
+
}
|
649
|
+
}
|
637
650
|
|
638
|
-
|
639
|
-
|
640
|
-
|
651
|
+
invalidconfigs.each_with_index { |text, i|
|
652
|
+
File.open(conffile, "w") { |f|
|
653
|
+
f.print text
|
654
|
+
}
|
641
655
|
|
642
|
-
[thing]
|
643
|
-
path #{dir}
|
644
|
-
allow test1.domain.com
|
645
|
-
"
|
646
|
-
}
|
647
656
|
|
648
|
-
|
649
|
-
|
657
|
+
# create a server with the file
|
658
|
+
server = nil
|
659
|
+
|
660
|
+
assert_raise(
|
661
|
+
Puppet::Network::Handler::FileServerError,
|
662
|
+
|
663
|
+
"Invalid config #{i} did not raise error") {
|
650
664
|
|
651
|
-
# start our server with a fast timeout
|
652
|
-
assert_nothing_raised {
|
653
665
|
server = Puppet::Network::Handler.fileserver.new(
|
654
|
-
:Local => false,
|
655
|
-
:Config => conffile
|
656
|
-
)
|
657
|
-
}
|
658
666
|
|
659
|
-
|
660
|
-
assert_nothing_raised {
|
661
|
-
list = server.list("/thing/", :manage, false, false,
|
662
|
-
"test1.domain.com", "127.0.0.1")
|
663
|
-
}
|
664
|
-
assert(list != "", "List returned nothing in rereard test")
|
667
|
+
:Local => true,
|
665
668
|
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
|
669
|
+
:Config => conffile
|
670
|
+
)
|
671
|
+
}
|
672
|
+
}
|
673
|
+
end
|
670
674
|
|
671
|
-
|
672
|
-
|
673
|
-
|
675
|
+
# verify we reread the config file when it changes
|
676
|
+
def test_filereread
|
677
|
+
server = nil
|
674
678
|
|
675
|
-
|
676
|
-
|
677
|
-
allow test2.domain.com
|
678
|
-
"
|
679
|
-
}
|
679
|
+
conffile = tempfile
|
680
|
+
dir = tstdir
|
680
681
|
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
}
|
682
|
+
files = mktestfiles(dir)
|
683
|
+
File.open(conffile, "w") { |f|
|
684
|
+
f.print "# a test config file
|
685
685
|
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
686
|
+
[thing]
|
687
|
+
path #{dir}
|
688
|
+
allow test1.domain.com
|
689
|
+
"
|
690
|
+
}
|
690
691
|
|
691
|
-
|
692
|
+
# Reset the timeout, so we reload faster
|
693
|
+
Puppet[:filetimeout] = 0.5
|
692
694
|
|
693
|
-
|
694
|
-
|
695
|
+
# start our server with a fast timeout
|
696
|
+
assert_nothing_raised {
|
695
697
|
|
696
|
-
|
697
|
-
def test_mountstring
|
698
|
-
mount = nil
|
699
|
-
name = "yaytest"
|
700
|
-
path = tmpdir()
|
701
|
-
assert_nothing_raised {
|
702
|
-
mount = Puppet::Network::Handler.fileserver::Mount.new(name, path)
|
703
|
-
}
|
698
|
+
server = Puppet::Network::Handler.fileserver.new(
|
704
699
|
|
705
|
-
|
706
|
-
end
|
700
|
+
:Local => false,
|
707
701
|
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
server = nil
|
712
|
-
source = tempfile()
|
713
|
-
file = File.join(source, "file")
|
714
|
-
link = File.join(source, "link")
|
715
|
-
Dir.mkdir(source)
|
716
|
-
File.open(file, "w") { |f| f.puts "yay" }
|
717
|
-
File.symlink(file, link)
|
718
|
-
assert_nothing_raised {
|
719
|
-
server = Puppet::Network::Handler.fileserver.new(
|
720
|
-
:Local => true,
|
721
|
-
:Config => false
|
722
|
-
)
|
723
|
-
}
|
702
|
+
:Config => conffile
|
703
|
+
)
|
704
|
+
}
|
724
705
|
|
725
|
-
|
726
|
-
|
727
|
-
}
|
706
|
+
list = nil
|
707
|
+
assert_nothing_raised {
|
728
708
|
|
729
|
-
|
730
|
-
|
731
|
-
assert_nothing_raised {
|
732
|
-
server.describe("/mount/link", :follow).split("\t").zip(
|
733
|
-
Puppet::Network::Handler.fileserver::CHECKPARAMS
|
734
|
-
).each { |v,p| results[p] = v }
|
735
|
-
}
|
709
|
+
list = server.list(
|
710
|
+
"/thing/", :manage, false, false,
|
736
711
|
|
737
|
-
|
712
|
+
"test1.domain.com", "127.0.0.1")
|
713
|
+
}
|
714
|
+
assert(list != "", "List returned nothing in rereard test")
|
738
715
|
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
server.describe("/mount/link", :manage).split("\t").zip(
|
743
|
-
Puppet::Network::Handler.fileserver::CHECKPARAMS
|
744
|
-
).each { |v,p| results[p] = v }
|
745
|
-
}
|
716
|
+
assert_raise(Puppet::AuthorizationError, "List allowed invalid host") {
|
717
|
+
list = server.list("/thing/", :manage, false, false, "test2.domain.com", "127.0.0.1")
|
718
|
+
}
|
746
719
|
|
747
|
-
|
720
|
+
sleep 1
|
721
|
+
File.open(conffile, "w") { |f|
|
722
|
+
f.print "# a test config file
|
748
723
|
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
724
|
+
[thing]
|
725
|
+
path #{dir}
|
726
|
+
allow test2.domain.com
|
727
|
+
"
|
728
|
+
}
|
729
|
+
|
730
|
+
assert_raise(Puppet::AuthorizationError, "List allowed invalid host") {
|
731
|
+
list = server.list("/thing/", :manage, false, false, "test1.domain.com", "127.0.0.1")
|
732
|
+
}
|
733
|
+
|
734
|
+
assert_nothing_raised {
|
735
|
+
list = server.list("/thing/", :manage, false, false, "test2.domain.com", "127.0.0.1")
|
736
|
+
}
|
737
|
+
|
738
|
+
assert(list != "", "List returned nothing in rereard test")
|
739
|
+
|
740
|
+
list = nil
|
741
|
+
end
|
742
|
+
|
743
|
+
# Verify that we get converted to the right kind of string
|
744
|
+
def test_mountstring
|
745
|
+
mount = nil
|
746
|
+
name = "yaytest"
|
747
|
+
path = tmpdir
|
748
|
+
assert_nothing_raised {
|
749
|
+
mount = Puppet::Network::Handler.fileserver::Mount.new(name, path)
|
750
|
+
}
|
751
|
+
|
752
|
+
assert_equal("mount[#{name}]", mount.to_s)
|
753
|
+
end
|
754
|
+
|
755
|
+
def test_servinglinks
|
756
|
+
# Disable the checking, so changes propagate immediately.
|
757
|
+
Puppet[:filetimeout] = -5
|
758
|
+
server = nil
|
759
|
+
source = tempfile
|
760
|
+
file = File.join(source, "file")
|
761
|
+
link = File.join(source, "link")
|
762
|
+
Dir.mkdir(source)
|
763
|
+
File.open(file, "w") { |f| f.puts "yay" }
|
764
|
+
File.symlink(file, link)
|
765
|
+
assert_nothing_raised {
|
766
|
+
|
767
|
+
server = Puppet::Network::Handler.fileserver.new(
|
768
|
+
|
769
|
+
:Local => true,
|
770
|
+
|
771
|
+
:Config => false
|
772
|
+
)
|
773
|
+
}
|
774
|
+
|
775
|
+
assert_nothing_raised {
|
776
|
+
server.mount(source, "mount")
|
777
|
+
}
|
778
|
+
|
779
|
+
# First describe the link when following
|
780
|
+
results = {}
|
781
|
+
assert_nothing_raised {
|
782
|
+
server.describe("/mount/link", :follow).split("\t").zip(
|
783
|
+
Puppet::Network::Handler.fileserver::CHECKPARAMS
|
784
|
+
).each { |v,p| results[p] = v }
|
785
|
+
}
|
786
|
+
|
787
|
+
assert_equal("file", results[:type])
|
788
|
+
|
789
|
+
# Then not
|
790
|
+
results = {}
|
791
|
+
assert_nothing_raised {
|
792
|
+
server.describe("/mount/link", :manage).split("\t").zip(
|
793
|
+
Puppet::Network::Handler.fileserver::CHECKPARAMS
|
794
|
+
).each { |v,p| results[p] = v }
|
795
|
+
}
|
796
|
+
|
797
|
+
assert_equal("link", results[:type])
|
798
|
+
|
799
|
+
results.each { |p,v|
|
800
|
+
assert(v, "#{p} has no value")
|
801
|
+
assert(v != "", "#{p} has no value")
|
802
|
+
}
|
803
|
+
end
|
804
|
+
|
805
|
+
# Test that substitution patterns in the path are exapanded
|
806
|
+
# properly. Disabled, because it was testing too much of the process
|
807
|
+
# and in a non-portable way. This is a thorough enough test that it should
|
808
|
+
# be kept, but it should be done in a way that is clearly portable (e.g.,
|
809
|
+
# no md5 sums of file paths).
|
810
|
+
def test_host_specific
|
811
|
+
client1 = "client1.example.com"
|
812
|
+
client2 = "client2.example.com"
|
813
|
+
ip = "127.0.0.1"
|
814
|
+
|
815
|
+
# Setup a directory hierarchy for the tests
|
816
|
+
fsdir = File.join(tmpdir, "host-specific")
|
817
|
+
@@tmpfiles << fsdir
|
818
|
+
hostdir = File.join(fsdir, "host")
|
819
|
+
fqdndir = File.join(fsdir, "fqdn")
|
820
|
+
client1_hostdir = File.join(hostdir, "client1")
|
821
|
+
client2_fqdndir = File.join(fqdndir, client2)
|
822
|
+
contents = {
|
823
|
+
client1_hostdir => "client1\n",
|
824
|
+
client2_fqdndir => client2 + "\n"
|
825
|
+
}
|
826
|
+
[fsdir, hostdir, fqdndir, client1_hostdir, client2_fqdndir].each { |d| Dir.mkdir(d) }
|
827
|
+
|
828
|
+
[client1_hostdir, client2_fqdndir].each do |d|
|
829
|
+
File.open(File.join(d, "file.txt"), "w") do |f|
|
830
|
+
f.print contents[d]
|
831
|
+
end
|
753
832
|
end
|
754
|
-
|
755
|
-
|
756
|
-
|
757
|
-
# and in a non-portable way. This is a thorough enough test that it should
|
758
|
-
# be kept, but it should be done in a way that is clearly portable (e.g.,
|
759
|
-
# no md5 sums of file paths).
|
760
|
-
def test_host_specific
|
761
|
-
client1 = "client1.example.com"
|
762
|
-
client2 = "client2.example.com"
|
763
|
-
ip = "127.0.0.1"
|
764
|
-
|
765
|
-
# Setup a directory hierarchy for the tests
|
766
|
-
fsdir = File.join(tmpdir(), "host-specific")
|
767
|
-
@@tmpfiles << fsdir
|
768
|
-
hostdir = File.join(fsdir, "host")
|
769
|
-
fqdndir = File.join(fsdir, "fqdn")
|
770
|
-
client1_hostdir = File.join(hostdir, "client1")
|
771
|
-
client2_fqdndir = File.join(fqdndir, client2)
|
772
|
-
contents = {
|
773
|
-
client1_hostdir => "client1\n",
|
774
|
-
client2_fqdndir => client2 + "\n"
|
775
|
-
}
|
776
|
-
[fsdir, hostdir, fqdndir,
|
777
|
-
client1_hostdir, client2_fqdndir].each { |d| Dir.mkdir(d) }
|
778
|
-
|
779
|
-
[client1_hostdir, client2_fqdndir].each do |d|
|
780
|
-
File.open(File.join(d, "file.txt"), "w") do |f|
|
781
|
-
f.print contents[d]
|
782
|
-
end
|
783
|
-
end
|
784
|
-
conffile = tempfile()
|
785
|
-
File.open(conffile, "w") do |f|
|
786
|
-
f.print("
|
833
|
+
conffile = tempfile
|
834
|
+
File.open(conffile, "w") do |f|
|
835
|
+
f.print("
|
787
836
|
[host]
|
788
837
|
path #{hostdir}/%h
|
789
838
|
allow *
|
@@ -791,400 +840,421 @@ allow *
|
|
791
840
|
path #{fqdndir}/%H
|
792
841
|
allow *
|
793
842
|
")
|
794
|
-
|
843
|
+
end
|
844
|
+
|
845
|
+
server = nil
|
846
|
+
assert_nothing_raised {
|
847
|
+
|
848
|
+
server = Puppet::Network::Handler.fileserver.new(
|
849
|
+
|
850
|
+
:Local => true,
|
851
|
+
|
852
|
+
:Config => conffile
|
853
|
+
)
|
854
|
+
}
|
855
|
+
|
856
|
+
# check that list returns the correct thing for the two clients
|
857
|
+
list = nil
|
858
|
+
sfile = "/host/file.txt"
|
859
|
+
assert_nothing_raised {
|
860
|
+
list = server.list(sfile, :manage, true, false, client1, ip)
|
861
|
+
}
|
862
|
+
assert_equal("/\tfile", list)
|
863
|
+
assert_nothing_raised {
|
864
|
+
list = server.list(sfile, :manage, true, false, client2, ip)
|
865
|
+
}
|
866
|
+
assert_equal("", list)
|
867
|
+
|
868
|
+
sfile = "/fqdn/file.txt"
|
869
|
+
assert_nothing_raised {
|
870
|
+
list = server.list(sfile, :manage, true, false, client1, ip)
|
871
|
+
}
|
872
|
+
assert_equal("", list)
|
873
|
+
assert_nothing_raised {
|
874
|
+
list = server.list(sfile, :manage, true, false, client2, ip)
|
875
|
+
}
|
876
|
+
assert_equal("/\tfile", list)
|
877
|
+
|
878
|
+
# check describe
|
879
|
+
sfile = "/host/file.txt"
|
880
|
+
assert_nothing_raised {
|
881
|
+
list = server.describe(sfile, :manage, client1, ip).split("\t")
|
882
|
+
}
|
883
|
+
assert_equal(5, list.size)
|
884
|
+
assert_equal("file", list[1])
|
885
|
+
md5 = Digest::MD5.hexdigest(contents[client1_hostdir])
|
886
|
+
assert_equal("{md5}#{md5}", list[4])
|
887
|
+
|
888
|
+
assert_nothing_raised {
|
889
|
+
list = server.describe(sfile, :manage, client2, ip).split("\t")
|
890
|
+
}
|
891
|
+
assert_equal([], list)
|
892
|
+
|
893
|
+
sfile = "/fqdn/file.txt"
|
894
|
+
assert_nothing_raised {
|
895
|
+
list = server.describe(sfile, :manage, client1, ip).split("\t")
|
896
|
+
}
|
897
|
+
assert_equal([], list)
|
898
|
+
|
899
|
+
assert_nothing_raised {
|
900
|
+
list = server.describe(sfile, :manage, client2, ip).split("\t")
|
901
|
+
}
|
902
|
+
assert_equal(5, list.size)
|
903
|
+
assert_equal("file", list[1])
|
904
|
+
md5 = Digest::MD5.hexdigest(contents[client2_fqdndir])
|
905
|
+
assert_equal("{md5}#{md5}", list[4])
|
906
|
+
|
907
|
+
# Check retrieve
|
908
|
+
sfile = "/host/file.txt"
|
909
|
+
assert_nothing_raised {
|
910
|
+
list = server.retrieve(sfile, :manage, client1, ip).chomp
|
911
|
+
}
|
912
|
+
assert_equal(contents[client1_hostdir].chomp, list)
|
913
|
+
|
914
|
+
assert_nothing_raised {
|
915
|
+
list = server.retrieve(sfile, :manage, client2, ip).chomp
|
916
|
+
}
|
917
|
+
assert_equal("", list)
|
918
|
+
|
919
|
+
sfile = "/fqdn/file.txt"
|
920
|
+
assert_nothing_raised {
|
921
|
+
list = server.retrieve(sfile, :manage, client1, ip).chomp
|
922
|
+
}
|
923
|
+
assert_equal("", list)
|
924
|
+
|
925
|
+
assert_nothing_raised {
|
926
|
+
list = server.retrieve(sfile, :manage, client2, ip).chomp
|
927
|
+
}
|
928
|
+
assert_equal(contents[client2_fqdndir].chomp, list)
|
929
|
+
end
|
930
|
+
|
931
|
+
# Make sure the 'subdir' method in Mount works.
|
932
|
+
def test_mount_subdir
|
933
|
+
mount = nil
|
934
|
+
base = tempfile
|
935
|
+
Dir.mkdir(base)
|
936
|
+
subdir = File.join(base, "subdir")
|
937
|
+
Dir.mkdir(subdir)
|
938
|
+
[base, subdir].each do |d|
|
939
|
+
File.open(File.join(d, "file"), "w") { |f| f.puts "bazoo" }
|
940
|
+
end
|
941
|
+
mount = mkmount(base)
|
795
942
|
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
:Local => true,
|
800
|
-
:Config => conffile
|
801
|
-
)
|
802
|
-
}
|
943
|
+
assert_equal(base, mount.subdir, "Did not default to base path")
|
944
|
+
assert_equal(subdir, mount.subdir("subdir"), "Did not default to base path")
|
945
|
+
end
|
803
946
|
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
assert_equal("/\tfile", list)
|
811
|
-
assert_nothing_raised {
|
812
|
-
list = server.list(sfile, :manage, true, false, client2, ip)
|
813
|
-
}
|
814
|
-
assert_equal("", list)
|
947
|
+
# Make sure mounts get correctly marked expandable or not, depending on
|
948
|
+
# the path.
|
949
|
+
def test_expandable
|
950
|
+
name = "yaytest"
|
951
|
+
dir = tempfile
|
952
|
+
Dir.mkdir(dir)
|
815
953
|
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
assert_equal("", list)
|
821
|
-
assert_nothing_raised {
|
822
|
-
list = server.list(sfile, :manage, true, false, client2, ip)
|
823
|
-
}
|
824
|
-
assert_equal("/\tfile", list)
|
954
|
+
mount = mkmount
|
955
|
+
assert_nothing_raised {
|
956
|
+
mount.path = dir
|
957
|
+
}
|
825
958
|
|
826
|
-
|
827
|
-
sfile = "/host/file.txt"
|
828
|
-
assert_nothing_raised {
|
829
|
-
list = server.describe(sfile, :manage, client1, ip).split("\t")
|
830
|
-
}
|
831
|
-
assert_equal(5, list.size)
|
832
|
-
assert_equal("file", list[1])
|
833
|
-
md5 = Digest::MD5.hexdigest(contents[client1_hostdir])
|
834
|
-
assert_equal("{md5}#{md5}", list[4])
|
959
|
+
assert(! mount.expandable?, "Mount incorrectly called expandable")
|
835
960
|
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
961
|
+
assert_nothing_raised {
|
962
|
+
mount.path = "/dir/a%a"
|
963
|
+
}
|
964
|
+
assert(mount.expandable?, "Mount not called expandable")
|
840
965
|
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
966
|
+
# This isn't a valid replacement pattern, so it should throw an error
|
967
|
+
# because the dir doesn't exist
|
968
|
+
assert_raise(Puppet::Network::Handler::FileServerError) {
|
969
|
+
mount.path = "/dir/a%"
|
970
|
+
}
|
846
971
|
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
assert_equal("{md5}#{md5}", list[4])
|
854
|
-
|
855
|
-
# Check retrieve
|
856
|
-
sfile = "/host/file.txt"
|
857
|
-
assert_nothing_raised {
|
858
|
-
list = server.retrieve(sfile, :manage, client1, ip).chomp
|
859
|
-
}
|
860
|
-
assert_equal(contents[client1_hostdir].chomp, list)
|
972
|
+
# Now send it back to a normal path
|
973
|
+
assert_nothing_raised {
|
974
|
+
mount.path = dir
|
975
|
+
}
|
976
|
+
# Make sure it got reverted
|
977
|
+
assert(! mount.expandable?, "Mount incorrectly called expandable")
|
861
978
|
|
862
|
-
assert_nothing_raised {
|
863
|
-
list = server.retrieve(sfile, :manage, client2, ip).chomp
|
864
|
-
}
|
865
|
-
assert_equal("", list)
|
866
979
|
|
867
|
-
|
868
|
-
assert_nothing_raised {
|
869
|
-
list = server.retrieve(sfile, :manage, client1, ip).chomp
|
870
|
-
}
|
871
|
-
assert_equal("", list)
|
980
|
+
end
|
872
981
|
|
873
|
-
|
874
|
-
|
875
|
-
}
|
876
|
-
assert_equal(contents[client2_fqdndir].chomp, list)
|
877
|
-
end
|
982
|
+
def test_mount_expand
|
983
|
+
mount = mkmount
|
878
984
|
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
base = tempfile()
|
883
|
-
Dir.mkdir(base)
|
884
|
-
subdir = File.join(base, "subdir")
|
885
|
-
Dir.mkdir(subdir)
|
886
|
-
[base, subdir].each do |d|
|
887
|
-
File.open(File.join(d, "file"), "w") { |f| f.puts "bazoo" }
|
888
|
-
end
|
889
|
-
mount = mkmount(base)
|
890
|
-
|
891
|
-
assert_equal(base, mount.subdir(), "Did not default to base path")
|
892
|
-
assert_equal(subdir, mount.subdir("subdir"), "Did not default to base path")
|
985
|
+
check = proc do |client, pattern, repl|
|
986
|
+
path = "/my/#{pattern}/file"
|
987
|
+
assert_equal("/my/#{repl}/file", mount.expand(path, client))
|
893
988
|
end
|
894
989
|
|
895
|
-
#
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
}
|
906
|
-
|
907
|
-
assert(! mount.expandable?, "Mount incorrectly called expandable")
|
908
|
-
|
909
|
-
assert_nothing_raised {
|
910
|
-
mount.path = "/dir/a%a"
|
911
|
-
}
|
912
|
-
assert(mount.expandable?, "Mount not called expandable")
|
990
|
+
# Do a round of checks with a fake client
|
991
|
+
client = "host.domain.com"
|
992
|
+
{"%h" => "host", # Short name
|
993
|
+
"%H" => client, # Full name
|
994
|
+
"%d" => "domain.com", # domain
|
995
|
+
"%%" => "%", # escape
|
996
|
+
"%o" => "%o" # other
|
997
|
+
}.each do |pat, repl|
|
998
|
+
result = check.call(client, pat, repl)
|
999
|
+
end
|
913
1000
|
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
}
|
1001
|
+
# Now, check that they use Facter info
|
1002
|
+
client = nil
|
1003
|
+
Facter.stubs(:value).with { |v| v.to_s == "hostname" }.returns("myhost")
|
1004
|
+
Facter.stubs(:value).with { |v| v.to_s == "domain" }.returns("mydomain.com")
|
919
1005
|
|
920
|
-
# Now send it back to a normal path
|
921
|
-
assert_nothing_raised {
|
922
|
-
mount.path = dir
|
923
|
-
}
|
924
|
-
# Make sure it got reverted
|
925
|
-
assert(! mount.expandable?, "Mount incorrectly called expandable")
|
926
1006
|
|
1007
|
+
Facter.stubs(:to_hash).returns(
|
1008
|
+
{
|
1009
|
+
:ipaddress => "127.0.0.1",
|
1010
|
+
:hostname => "myhost",
|
1011
|
+
:domain => "mydomain.com",
|
927
1012
|
|
928
|
-
|
1013
|
+
})
|
929
1014
|
|
930
|
-
def test_mount_expand
|
931
|
-
mount = mkmount()
|
932
|
-
|
933
|
-
check = proc do |client, pattern, repl|
|
934
|
-
path = "/my/#{pattern}/file"
|
935
|
-
assert_equal("/my/#{repl}/file", mount.expand(path, client))
|
936
|
-
end
|
937
|
-
|
938
|
-
# Do a round of checks with a fake client
|
939
|
-
client = "host.domain.com"
|
940
|
-
{"%h" => "host", # Short name
|
941
|
-
"%H" => client, # Full name
|
942
|
-
"%d" => "domain.com", # domain
|
943
|
-
"%%" => "%", # escape
|
944
|
-
"%o" => "%o" # other
|
945
|
-
}.each do |pat, repl|
|
946
|
-
result = check.call(client, pat, repl)
|
947
|
-
end
|
948
|
-
|
949
|
-
# Now, check that they use Facter info
|
950
|
-
client = nil
|
951
|
-
Facter.stubs(:value).with { |v| v.to_s == "hostname" }.returns("myhost")
|
952
|
-
Facter.stubs(:value).with { |v| v.to_s == "domain" }.returns("mydomain.com")
|
953
|
-
|
954
|
-
Facter.stubs(:to_hash).returns({
|
955
|
-
:ipaddress => "127.0.0.1",
|
956
|
-
:hostname => "myhost",
|
957
|
-
:domain => "mydomain.com",
|
958
|
-
})
|
959
|
-
|
960
|
-
|
961
|
-
{"%h" => "myhost", # Short name
|
962
|
-
"%H" => "myhost.mydomain.com", # Full name
|
963
|
-
"%d" => "mydomain.com", # domain
|
964
|
-
"%%" => "%", # escape
|
965
|
-
"%o" => "%o" # other
|
966
|
-
}.each do |pat, repl|
|
967
|
-
check.call(client, pat, repl)
|
968
|
-
end
|
969
1015
|
|
1016
|
+
{"%h" => "myhost", # Short name
|
1017
|
+
"%H" => "myhost.mydomain.com", # Full name
|
1018
|
+
"%d" => "mydomain.com", # domain
|
1019
|
+
"%%" => "%", # escape
|
1020
|
+
"%o" => "%o" # other
|
1021
|
+
}.each do |pat, repl|
|
1022
|
+
check.call(client, pat, repl)
|
970
1023
|
end
|
971
1024
|
|
972
|
-
|
973
|
-
def test_fileserver_expansion
|
974
|
-
server = nil
|
975
|
-
assert_nothing_raised {
|
976
|
-
server = Puppet::Network::Handler.fileserver.new(
|
977
|
-
:Local => true,
|
978
|
-
:Config => false
|
979
|
-
)
|
980
|
-
}
|
981
|
-
|
982
|
-
dir = tempfile()
|
1025
|
+
end
|
983
1026
|
|
984
|
-
|
985
|
-
|
1027
|
+
# Test that the fileserver expands the %h and %d things.
|
1028
|
+
def test_fileserver_expansion
|
1029
|
+
server = nil
|
1030
|
+
assert_nothing_raised {
|
986
1031
|
|
987
|
-
|
988
|
-
|
989
|
-
Facter.stubs(:to_hash).returns({
|
990
|
-
:kernel => kernel_fact,
|
991
|
-
:ipaddress => "127.0.0.1",
|
992
|
-
:hostname => "myhost",
|
993
|
-
:domain => "mydomain.com",
|
994
|
-
})
|
995
|
-
|
996
|
-
Dir.mkdir(dir)
|
997
|
-
host = "myhost.mydomain.com"
|
998
|
-
{
|
999
|
-
"%H" => "myhost.mydomain.com", "%h" => "myhost", "%d" => "mydomain.com"
|
1000
|
-
}.each do |pattern, string|
|
1001
|
-
file = File.join(dir, string)
|
1002
|
-
mount = File.join(dir, pattern)
|
1003
|
-
File.open(file, "w") do |f| f.puts "yayness: %s" % string end
|
1004
|
-
name = "name"
|
1005
|
-
obj = nil
|
1006
|
-
assert_nothing_raised {
|
1007
|
-
obj = server.mount(mount, name)
|
1008
|
-
}
|
1009
|
-
obj.allow "*"
|
1032
|
+
server = Puppet::Network::Handler.fileserver.new(
|
1010
1033
|
|
1011
|
-
|
1012
|
-
assert_nothing_raised do
|
1013
|
-
ret = server.list("/name", :manage, false, false, host, ip)
|
1014
|
-
end
|
1034
|
+
:Local => true,
|
1015
1035
|
|
1016
|
-
|
1036
|
+
:Config => false
|
1037
|
+
)
|
1038
|
+
}
|
1017
1039
|
|
1018
|
-
|
1019
|
-
ret = server.describe("/name", :manage, host, ip)
|
1020
|
-
end
|
1021
|
-
assert(ret =~ /\tfile\t/, "Did not get valid a description (#{ret.inspect})")
|
1040
|
+
dir = tempfile
|
1022
1041
|
|
1023
|
-
|
1024
|
-
|
1025
|
-
end
|
1042
|
+
# When mocks attack, part 2
|
1043
|
+
kernel_fact = Facter.value(:kernel)
|
1026
1044
|
|
1027
|
-
|
1045
|
+
ip = '127.0.0.1'
|
1028
1046
|
|
1029
|
-
server.umount(name)
|
1030
1047
|
|
1031
|
-
|
1032
|
-
|
1048
|
+
Facter.stubs(:to_hash).returns(
|
1049
|
+
{
|
1050
|
+
:kernel => kernel_fact,
|
1051
|
+
:ipaddress => "127.0.0.1",
|
1052
|
+
:hostname => "myhost",
|
1053
|
+
:domain => "mydomain.com",
|
1054
|
+
|
1055
|
+
})
|
1056
|
+
|
1057
|
+
Dir.mkdir(dir)
|
1058
|
+
host = "myhost.mydomain.com"
|
1059
|
+
{
|
1060
|
+
"%H" => "myhost.mydomain.com", "%h" => "myhost", "%d" => "mydomain.com"
|
1061
|
+
}.each do |pattern, string|
|
1062
|
+
file = File.join(dir, string)
|
1063
|
+
mount = File.join(dir, pattern)
|
1064
|
+
File.open(file, "w") do |f| f.puts "yayness: #{string}" end
|
1065
|
+
name = "name"
|
1066
|
+
obj = nil
|
1067
|
+
assert_nothing_raised {
|
1068
|
+
obj = server.mount(mount, name)
|
1069
|
+
}
|
1070
|
+
obj.allow "*"
|
1071
|
+
|
1072
|
+
ret = nil
|
1073
|
+
assert_nothing_raised do
|
1074
|
+
ret = server.list("/name", :manage, false, false, host, ip)
|
1075
|
+
end
|
1076
|
+
|
1077
|
+
assert_equal("/\tfile", ret)
|
1078
|
+
|
1079
|
+
assert_nothing_raised do
|
1080
|
+
ret = server.describe("/name", :manage, host, ip)
|
1081
|
+
end
|
1082
|
+
assert(ret =~ /\tfile\t/, "Did not get valid a description (#{ret.inspect})")
|
1083
|
+
|
1084
|
+
assert_nothing_raised do
|
1085
|
+
ret = server.retrieve("/name", :manage, host, ip)
|
1086
|
+
end
|
1087
|
+
|
1088
|
+
assert_equal(ret, File.read(file))
|
1089
|
+
|
1090
|
+
server.umount(name)
|
1091
|
+
|
1092
|
+
File.unlink(file)
|
1033
1093
|
end
|
1094
|
+
end
|
1095
|
+
|
1096
|
+
# Test the default modules fileserving
|
1097
|
+
def test_modules_default
|
1098
|
+
moddir = tempfile
|
1099
|
+
Dir.mkdir(moddir)
|
1100
|
+
mounts = {}
|
1101
|
+
Puppet[:modulepath] = moddir
|
1102
|
+
|
1103
|
+
mods = %w{green red}.collect do |name|
|
1104
|
+
path = File::join(moddir, name, Puppet::Module::FILES)
|
1105
|
+
FileUtils::mkdir_p(path)
|
1106
|
+
if name == "green"
|
1107
|
+
file = File::join(path, "test.txt")
|
1108
|
+
File::open(file, "w") { |f| f.print name }
|
1109
|
+
end
|
1034
1110
|
|
1035
|
-
|
1036
|
-
|
1037
|
-
moddir = tempfile
|
1038
|
-
Dir.mkdir(moddir)
|
1039
|
-
mounts = {}
|
1040
|
-
Puppet[:modulepath] = moddir
|
1041
|
-
|
1042
|
-
mods = %w{green red}.collect do |name|
|
1043
|
-
path = File::join(moddir, name, Puppet::Module::FILES)
|
1044
|
-
FileUtils::mkdir_p(path)
|
1045
|
-
if name == "green"
|
1046
|
-
file = File::join(path, "test.txt")
|
1047
|
-
File::open(file, "w") { |f| f.print name }
|
1048
|
-
end
|
1049
|
-
|
1050
|
-
Puppet::Module::find(name)
|
1051
|
-
end
|
1052
|
-
|
1053
|
-
conffile = tempfile
|
1054
|
-
|
1055
|
-
File.open(conffile, "w") { |f| f.puts "# a test config file" }
|
1056
|
-
|
1057
|
-
# create a server with the file
|
1058
|
-
server = nil
|
1059
|
-
assert_nothing_raised {
|
1060
|
-
server = Puppet::Network::Handler::FileServer.new(
|
1061
|
-
:Local => false ,
|
1062
|
-
:Config => conffile
|
1063
|
-
)
|
1064
|
-
}
|
1111
|
+
Puppet::Module::find(name)
|
1112
|
+
end
|
1065
1113
|
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1114
|
+
conffile = tempfile
|
1115
|
+
|
1116
|
+
File.open(conffile, "w") { |f| f.puts "# a test config file" }
|
1117
|
+
|
1118
|
+
# create a server with the file
|
1119
|
+
server = nil
|
1120
|
+
assert_nothing_raised {
|
1121
|
+
|
1122
|
+
server = Puppet::Network::Handler::FileServer.new(
|
1123
|
+
|
1124
|
+
:Local => false ,
|
1125
|
+
|
1126
|
+
:Config => conffile
|
1127
|
+
)
|
1128
|
+
}
|
1129
|
+
|
1130
|
+
mods.each do |mod|
|
1131
|
+
mount = "/#{mod.name}/"
|
1132
|
+
list = nil
|
1133
|
+
assert_nothing_raised {
|
1134
|
+
list = server.list(mount, :manage, true, false)
|
1135
|
+
}
|
1136
|
+
list = list.split("\n")
|
1137
|
+
if mod.name == "green"
|
1138
|
+
assert_equal(2, list.size)
|
1139
|
+
assert_equal("/\tdirectory", list[0])
|
1140
|
+
assert_equal("/test.txt\tfile", list[1])
|
1141
|
+
else
|
1142
|
+
assert_equal(1, list.size)
|
1143
|
+
assert_equal("/\tdirectory", list[0])
|
1144
|
+
end
|
1145
|
+
|
1146
|
+
assert_nothing_raised("Host 'allow' denied #{mount}") {
|
1147
|
+
server.list(mount, :manage, true, false, 'allow.example.com', "192.168.0.1")
|
1148
|
+
}
|
1087
1149
|
end
|
1150
|
+
end
|
1088
1151
|
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1152
|
+
# Test that configuring deny/allow for modules works
|
1153
|
+
def test_modules_config
|
1154
|
+
moddir = tempfile
|
1155
|
+
Dir.mkdir(moddir)
|
1156
|
+
mounts = {}
|
1157
|
+
Puppet[:modulepath] = moddir
|
1095
1158
|
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1159
|
+
path = File::join(moddir, "amod", Puppet::Module::FILES)
|
1160
|
+
file = File::join(path, "test.txt")
|
1161
|
+
FileUtils::mkdir_p(path)
|
1162
|
+
File::open(file, "w") { |f| f.print "Howdy" }
|
1100
1163
|
|
1101
|
-
|
1164
|
+
mod = Puppet::Module::find("amod")
|
1102
1165
|
|
1103
|
-
|
1104
|
-
|
1166
|
+
conffile = tempfile
|
1167
|
+
@@tmpfiles << conffile
|
1105
1168
|
|
1106
|
-
|
1107
|
-
|
1169
|
+
File.open(conffile, "w") { |f|
|
1170
|
+
f.print "# a test config file
|
1108
1171
|
[modules]
|
1109
|
-
|
1110
|
-
|
1172
|
+
path #{basedir}/thing
|
1173
|
+
allow 192.168.0.*
|
1111
1174
|
"
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1175
|
+
}
|
1176
|
+
|
1177
|
+
# create a server with the file
|
1178
|
+
server = nil
|
1179
|
+
assert_nothing_raised {
|
1180
|
+
|
1181
|
+
server = Puppet::Network::Handler::FileServer.new(
|
1182
|
+
|
1183
|
+
:Local => false,
|
1184
|
+
|
1185
|
+
:Config => conffile
|
1186
|
+
)
|
1187
|
+
}
|
1188
|
+
|
1189
|
+
list = nil
|
1190
|
+
mount = "/#{mod.name}/"
|
1191
|
+
assert_nothing_raised {
|
1192
|
+
list = server.list(mount, :manage, true, false)
|
1193
|
+
}
|
1194
|
+
|
1195
|
+
assert_nothing_raised {
|
1196
|
+
list.split("\n").each { |line|
|
1197
|
+
file, type = line.split("\t")
|
1198
|
+
server.describe(mount + file)
|
1199
|
+
}
|
1200
|
+
}
|
1201
|
+
|
1202
|
+
assert_describe(mount, file, server)
|
1203
|
+
|
1204
|
+
# now let's check that things are being correctly forbidden
|
1205
|
+
|
1206
|
+
assert_raise(
|
1207
|
+
Puppet::AuthorizationError,
|
1208
|
+
|
1209
|
+
"Host 'deny' allowed #{mount}") {
|
1210
|
+
server.list(mount, :manage, true, false, 'deny.example.com', "192.168.1.1")
|
1211
|
+
}
|
1212
|
+
assert_nothing_raised("Host 'allow' denied #{mount}") {
|
1213
|
+
server.list(mount, :manage, true, false, 'allow.example.com', "192.168.0.1")
|
1214
|
+
}
|
1215
|
+
end
|
1216
|
+
|
1217
|
+
# Make sure we successfully throw errors -- someone ran into this with
|
1218
|
+
# 0.22.4.
|
1219
|
+
def test_failures
|
1220
|
+
# create a server with the file
|
1221
|
+
server = nil
|
1222
|
+
|
1223
|
+
config = tempfile
|
1224
|
+
[
|
1225
|
+
"[this is invalid]\nallow one.two.com", # invalid name
|
1226
|
+
"[valid]\nallow *.testing something.com", # invalid allow
|
1227
|
+
"[valid]\nallow one.two.com\ndeny *.testing something.com", # invalid deny
|
1228
|
+
].each do |failer|
|
1229
|
+
File.open(config, "w") { |f| f.puts failer }
|
1230
|
+
assert_raise(Puppet::Network::Handler::FileServerError, "Did not fail on #{failer.inspect}") {
|
1231
|
+
|
1232
|
+
server = Puppet::Network::Handler::FileServer.new(
|
1233
|
+
|
1234
|
+
:Local => false,
|
1235
|
+
|
1236
|
+
:Config => config
|
1237
|
+
)
|
1238
|
+
}
|
1170
1239
|
end
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1240
|
+
end
|
1241
|
+
|
1242
|
+
def test_can_start_without_configuration
|
1243
|
+
Puppet[:fileserverconfig] = tempfile
|
1244
|
+
assert_nothing_raised("Could not create fileserver when configuration is absent") do
|
1245
|
+
server = Puppet::Network::Handler::FileServer.new(
|
1246
|
+
:Local => false
|
1247
|
+
)
|
1179
1248
|
end
|
1249
|
+
end
|
1180
1250
|
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1251
|
+
def test_creates_default_mounts_when_no_configuration_is_available
|
1252
|
+
Puppet[:fileserverconfig] = tempfile
|
1253
|
+
server = Puppet::Network::Handler::FileServer.new(:Local => false)
|
1184
1254
|
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1255
|
+
assert(server.mounted?("plugins"), "Did not create default plugins mount when missing configuration file")
|
1256
|
+
assert(server.mounted?("modules"), "Did not create default modules mount when missing configuration file")
|
1257
|
+
end
|
1188
1258
|
end
|
1189
1259
|
|
1190
1260
|
|