puppet 0.24.5 → 0.24.6
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 +206 -0
- data/Rakefile +53 -0
- data/bin/filebucket +0 -0
- data/bin/puppet +32 -11
- data/bin/puppetca +1 -0
- data/bin/puppetd +0 -0
- data/bin/puppetdoc +0 -0
- data/bin/puppetmasterd +0 -0
- data/bin/puppetrun +16 -8
- data/bin/ralsh +0 -0
- data/conf/debian/rules +0 -0
- data/conf/gentoo/init.d/puppetmaster +0 -0
- data/conf/osx/PackageInfo.plist +36 -0
- data/conf/osx/createpackage.sh +167 -0
- data/conf/osx/preflight +12 -0
- data/conf/redhat/client.init +1 -1
- data/conf/redhat/puppet.spec +34 -6
- data/conf/redhat/server.init +42 -7
- data/conf/redhat/server.sysconfig +22 -0
- data/conf/solaris/smf/svc-puppetd +0 -0
- data/conf/solaris/smf/svc-puppetmasterd +0 -0
- data/examples/etc/init.d/sleeper +0 -0
- data/examples/mac_dscl.pp +0 -0
- data/examples/mac_dscl_revert.pp +0 -0
- data/examples/mac_netinfo.pp +0 -0
- data/examples/mac_pkgdmg.pp +0 -0
- data/ext/bin/sleeper +0 -0
- data/ext/module_puppet +0 -0
- data/ext/nagios/check_puppet.rb +0 -0
- data/ext/passenger/README +63 -0
- data/ext/passenger/apache2.conf +29 -0
- data/ext/passenger/config.ru +40 -0
- data/ext/puppet-test +0 -0
- data/ext/puppetlast +6 -31
- data/ext/puppetstoredconfigclean.rb +87 -0
- data/install.rb +75 -20
- data/lib/puppet.rb +1 -1
- data/lib/puppet/daemon.rb +0 -0
- data/lib/puppet/defaults.rb +3 -7
- data/lib/puppet/external/base64.rb +0 -0
- data/lib/puppet/external/nagios.rb +0 -0
- data/lib/puppet/external/nagios/base.rb +0 -0
- data/lib/puppet/file_serving/fileset.rb +2 -2
- data/lib/puppet/file_serving/metadata.rb +3 -3
- data/lib/puppet/indirector/facts/facter.rb +3 -2
- data/lib/puppet/indirector/yaml.rb +10 -1
- data/lib/puppet/module.rb +36 -12
- data/lib/puppet/network/authstore.rb +0 -0
- data/lib/puppet/network/client/master.rb +12 -11
- data/lib/puppet/network/handler/filebucket.rb +0 -0
- data/lib/puppet/network/handler/fileserver.rb +38 -46
- data/lib/puppet/network/handler/master.rb +1 -1
- data/lib/puppet/network/handler/report.rb +0 -0
- data/lib/puppet/network/handler/resource.rb +0 -0
- data/lib/puppet/network/handler/runner.rb +0 -0
- data/lib/puppet/network/http_server/rack.rb +148 -0
- data/lib/puppet/network/rights.rb +0 -0
- data/lib/puppet/network/xmlrpc/client.rb +5 -5
- data/lib/puppet/node.rb +5 -9
- data/lib/puppet/node/environment.rb +1 -17
- data/lib/puppet/node/facts.rb +0 -0
- data/lib/puppet/parameter.rb +1 -28
- data/lib/puppet/parser/ast.rb +6 -0
- data/lib/puppet/parser/ast/arithmetic_operator.rb +41 -0
- data/lib/puppet/parser/ast/boolean_operator.rb +48 -0
- data/lib/puppet/parser/ast/collexpr.rb +6 -1
- data/lib/puppet/parser/ast/comparison_operator.rb +37 -0
- data/lib/puppet/parser/ast/minus.rb +23 -0
- data/lib/puppet/parser/ast/nop.rb +11 -0
- data/lib/puppet/parser/ast/not.rb +19 -0
- data/lib/puppet/parser/ast/resource_override.rb +23 -16
- data/lib/puppet/parser/ast/resource_reference.rb +10 -6
- data/lib/puppet/parser/ast/vardef.rb +2 -2
- data/lib/puppet/parser/collector.rb +2 -1
- data/lib/puppet/parser/functions.rb +7 -217
- data/lib/puppet/parser/functions/defined.rb +27 -0
- data/lib/puppet/parser/functions/fail.rb +4 -0
- data/lib/puppet/parser/functions/file.rb +21 -0
- data/lib/puppet/parser/functions/fqdn_rand.rb +15 -0
- data/lib/puppet/parser/functions/generate.rb +35 -0
- data/lib/puppet/parser/functions/include.rb +26 -0
- data/lib/puppet/parser/functions/realize.rb +14 -0
- data/lib/puppet/parser/functions/search.rb +7 -0
- data/lib/puppet/parser/functions/sha1.rb +6 -0
- data/lib/puppet/parser/functions/tag.rb +6 -0
- data/lib/puppet/parser/functions/tagged.rb +18 -0
- data/lib/puppet/parser/functions/template.rb +22 -0
- data/lib/puppet/parser/lexer.rb +15 -5
- data/lib/puppet/parser/parser.rb +1073 -715
- data/lib/puppet/parser/parser_support.rb +18 -13
- data/lib/puppet/parser/resource.rb +1 -1
- data/lib/puppet/parser/resource/param.rb +10 -2
- data/lib/puppet/parser/scope.rb +63 -5
- data/lib/puppet/parser/templatewrapper.rb +61 -15
- data/lib/puppet/property.rb +7 -1
- data/lib/puppet/property/keyvalue.rb +96 -0
- data/lib/puppet/property/list.rb +78 -0
- data/lib/puppet/provider/confine.rb +1 -1
- data/lib/puppet/provider/confine/variable.rb +10 -1
- data/lib/puppet/provider/cron/crontab.rb +0 -0
- data/lib/puppet/provider/mailalias/aliases.rb +0 -0
- data/lib/puppet/provider/maillist/mailman.rb +0 -0
- data/lib/puppet/provider/mount/parsed.rb +0 -0
- data/lib/puppet/provider/nameservice.rb +24 -39
- data/lib/puppet/provider/nameservice/directoryservice.rb +12 -3
- data/lib/puppet/provider/nameservice/netinfo.rb +12 -2
- data/lib/puppet/provider/nameservice/objectadd.rb +1 -10
- data/lib/puppet/provider/package/appdmg.rb +1 -1
- data/lib/puppet/provider/package/apple.rb +0 -0
- data/lib/puppet/provider/package/apt.rb +14 -21
- data/lib/puppet/provider/package/aptitude.rb +0 -0
- data/lib/puppet/provider/package/blastwave.rb +2 -0
- data/lib/puppet/provider/package/darwinport.rb +0 -0
- data/lib/puppet/provider/package/dpkg.rb +33 -51
- data/lib/puppet/provider/package/fink.rb +1 -1
- data/lib/puppet/provider/package/freebsd.rb +0 -0
- data/lib/puppet/provider/package/gem.rb +0 -0
- data/lib/puppet/provider/package/hpux.rb +46 -0
- data/lib/puppet/provider/package/openbsd.rb +0 -0
- data/lib/puppet/provider/package/pkgdmg.rb +1 -1
- data/lib/puppet/provider/package/portage.rb +3 -1
- data/lib/puppet/provider/package/ports.rb +3 -3
- data/lib/puppet/provider/package/rpm.rb +8 -1
- data/lib/puppet/provider/package/rug.rb +2 -2
- data/lib/puppet/provider/package/sun.rb +2 -0
- data/lib/puppet/provider/package/sunfreeware.rb +3 -0
- data/lib/puppet/provider/package/yum.rb +24 -17
- data/lib/puppet/provider/package/yumhelper.py +92 -11
- data/lib/puppet/provider/parsedfile.rb +0 -0
- data/lib/puppet/provider/port/parsed.rb +0 -0
- data/lib/puppet/provider/selboolean/getsetsebool.rb +47 -0
- data/lib/puppet/provider/selmodule/semodule.rb +143 -0
- data/lib/puppet/provider/service/base.rb +0 -0
- data/lib/puppet/provider/service/daemontools.rb +154 -0
- data/lib/puppet/provider/service/debian.rb +1 -1
- data/lib/puppet/provider/service/freebsd.rb +2 -0
- data/lib/puppet/provider/service/gentoo.rb +2 -0
- data/lib/puppet/provider/service/init.rb +0 -0
- data/lib/puppet/provider/service/redhat.rb +1 -1
- data/lib/puppet/provider/service/runit.rb +93 -0
- data/lib/puppet/provider/service/smf.rb +2 -0
- data/lib/puppet/provider/ssh_authorized_key/parsed.rb +7 -1
- data/lib/puppet/provider/sshkey/parsed.rb +0 -0
- data/lib/puppet/provider/user/hpux.rb +30 -0
- data/lib/puppet/provider/user/user_role_add.rb +156 -0
- data/lib/puppet/provider/user/useradd.rb +23 -14
- data/lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb +17 -0
- data/lib/puppet/rails/database/schema.rb +0 -8
- data/lib/puppet/rails/resource.rb +6 -6
- data/lib/puppet/reference/configuration.rb +0 -7
- data/lib/puppet/reports.rb +0 -0
- data/lib/puppet/reports/rrdgraph.rb +3 -2
- data/lib/puppet/sslcertificates.rb +0 -0
- data/lib/puppet/sslcertificates/inventory.rb +3 -2
- data/lib/puppet/sslcertificates/support.rb +3 -0
- data/lib/puppet/transaction/report.rb +1 -7
- data/lib/puppet/transportable.rb +10 -7
- data/lib/puppet/type.rb +2110 -14
- data/lib/puppet/type/cron.rb +0 -0
- data/lib/puppet/type/exec.rb +0 -0
- data/lib/puppet/type/file.rb +12 -2
- data/lib/puppet/type/file/checksum.rb +4 -0
- data/lib/puppet/type/file/content.rb +0 -0
- data/lib/puppet/type/file/ensure.rb +0 -0
- data/lib/puppet/type/file/group.rb +30 -43
- data/lib/puppet/type/file/mode.rb +0 -0
- data/lib/puppet/type/file/owner.rb +0 -0
- data/lib/puppet/type/file/selcontext.rb +104 -0
- data/lib/puppet/type/file/source.rb +0 -0
- data/lib/puppet/type/file/type.rb +0 -0
- data/lib/puppet/type/filebucket.rb +0 -0
- data/lib/puppet/type/group.rb +0 -8
- data/lib/puppet/type/host.rb +0 -0
- data/lib/puppet/type/mailalias.rb +0 -0
- data/lib/puppet/type/maillist.rb +0 -0
- data/lib/puppet/type/mount.rb +0 -0
- data/lib/puppet/type/package.rb +2 -2
- data/lib/puppet/type/port.rb +0 -0
- data/lib/puppet/type/schedule.rb +0 -0
- data/lib/puppet/type/selboolean.rb +31 -0
- data/lib/puppet/type/selmodule.rb +54 -0
- data/lib/puppet/type/ssh_authorized_key.rb +3 -3
- data/lib/puppet/type/sshkey.rb +0 -0
- data/lib/puppet/type/tidy.rb +0 -0
- data/lib/puppet/type/user.rb +153 -137
- data/lib/puppet/type/yumrepo.rb +18 -2
- data/lib/puppet/type/zone.rb +5 -1
- data/lib/puppet/util.rb +7 -7
- data/lib/puppet/util/filetype.rb +7 -0
- data/lib/puppet/util/instance_loader.rb +0 -0
- data/lib/puppet/util/ldap/connection.rb +11 -1
- data/lib/puppet/util/ldap/manager.rb +1 -1
- data/lib/puppet/util/loadedfile.rb +0 -0
- data/lib/puppet/util/log.rb +42 -43
- data/lib/puppet/util/metric.rb +23 -9
- data/lib/puppet/util/posix.rb +69 -18
- data/lib/puppet/util/selinux.rb +139 -0
- data/lib/puppet/util/settings.rb +5 -7
- data/lib/puppet/util/user_attr.rb +21 -0
- data/test/certmgr/ca.rb +0 -0
- data/test/certmgr/certmgr.rb +0 -0
- data/test/certmgr/inventory.rb +0 -0
- data/test/certmgr/support.rb +0 -0
- data/test/data/providers/ssh_authorized_key/parsed/authorized_keys1 +3 -0
- data/test/data/snippets/append.pp +11 -0
- data/test/data/snippets/arithmetic_expression.pp +8 -0
- data/test/data/snippets/arraytrailingcomma.pp +3 -0
- data/test/data/snippets/emptyifelse.pp +9 -0
- data/test/data/snippets/funccomma.pp +5 -0
- data/test/data/snippets/ifexpression.rb +6 -0
- data/test/data/snippets/subclass_name_duplication.pp +0 -0
- data/test/executables/filebucket.rb +0 -0
- data/test/executables/puppetbin.rb +0 -0
- data/test/executables/puppetca.rb +0 -0
- data/test/executables/puppetd.rb +0 -0
- data/test/executables/puppetmasterd.rb +0 -0
- data/test/executables/puppetmodule.rb +0 -0
- data/test/language/ast.rb +0 -0
- data/test/language/ast/casestatement.rb +0 -0
- data/test/language/ast/resource.rb +0 -0
- data/test/language/ast/resource_reference.rb +0 -28
- data/test/language/ast/selector.rb +0 -0
- data/test/language/ast/variable.rb +0 -0
- data/test/language/functions.rb +91 -12
- data/test/language/parser.rb +21 -0
- data/test/language/resource.rb +0 -0
- data/test/language/scope.rb +28 -0
- data/test/language/snippets.rb +14 -0
- data/test/language/transportable.rb +0 -0
- data/test/lib/puppettest.rb +0 -0
- data/test/lib/puppettest/reporttesting.rb +0 -2
- data/test/lib/puppettest/runnable_test.rb +2 -0
- data/test/lib/puppettest/support/resources.rb +0 -0
- data/test/network/authconfig.rb +0 -0
- data/test/network/authorization.rb +0 -0
- data/test/network/authstore.rb +0 -0
- data/test/network/client/ca.rb +0 -0
- data/test/network/client/client.rb +0 -0
- data/test/network/client/dipper.rb +0 -0
- data/test/network/client/master.rb +2 -6
- data/test/network/client/resource.rb +0 -0
- data/test/network/client_request.rb +0 -0
- data/test/network/daemon.rb +0 -0
- data/test/network/handler/bucket.rb +0 -0
- data/test/network/handler/ca.rb +0 -0
- data/test/network/handler/fileserver.rb +8 -0
- data/test/network/handler/handler.rb +0 -0
- data/test/network/handler/master.rb +3 -1
- data/test/network/handler/report.rb +0 -0
- data/test/network/handler/resource.rb +0 -0
- data/test/network/handler/runner.rb +0 -0
- data/test/network/rights.rb +0 -0
- data/test/network/server/mongrel_test.rb +0 -0
- data/test/network/server/webrick.rb +0 -0
- data/test/network/xmlrpc/client.rb +0 -0
- data/test/network/xmlrpc/processor.rb +0 -0
- data/test/network/xmlrpc/server.rb +0 -0
- data/test/network/xmlrpc/webrick_servlet.rb +0 -0
- data/test/other/dsl.rb +0 -0
- data/test/other/events.rb +0 -0
- data/test/other/overrides.rb +0 -0
- data/test/other/provider.rb +0 -0
- data/test/other/puppet.rb +0 -0
- data/test/other/relationships.rb +0 -0
- data/test/other/report.rb +2 -4
- data/test/other/transactions.rb +1 -1
- data/test/puppet/conffiles.rb +0 -0
- data/test/puppet/defaults.rb +0 -0
- data/test/puppet/errortest.rb +0 -0
- data/test/puppet/tc_suidmanager.rb +0 -0
- data/test/rails/ast.rb +0 -0
- data/test/rails/configuration.rb +0 -0
- data/test/rails/host.rb +0 -0
- data/test/rails/rails.rb +0 -0
- data/test/rails/railsparameter.rb +0 -0
- data/test/rails/railsresource.rb +0 -0
- data/test/ral/manager/attributes.rb +0 -0
- data/test/ral/manager/instances.rb +0 -0
- data/test/ral/manager/manager.rb +0 -0
- data/test/ral/manager/provider.rb +0 -0
- data/test/ral/manager/type.rb +0 -0
- data/test/ral/providers/cron/crontab.rb +0 -0
- data/test/ral/providers/group.rb +14 -13
- data/test/ral/providers/host/netinfo.rb +0 -0
- data/test/ral/providers/host/parsed.rb +0 -0
- data/test/ral/providers/mailalias/aliases.rb +0 -0
- data/test/ral/providers/mount/netinfo.rb +0 -0
- data/test/ral/providers/nameservice.rb +0 -0
- data/test/ral/providers/package.rb +0 -31
- data/test/ral/providers/package/aptitude.rb +1 -2
- data/test/ral/providers/package/aptrpm.rb +2 -2
- data/test/ral/providers/parsedfile.rb +0 -0
- data/test/ral/providers/port/parsed.rb +0 -0
- data/test/ral/providers/provider.rb +0 -0
- data/test/ral/providers/service/base.rb +0 -0
- data/test/ral/providers/service/debian.rb +0 -0
- data/test/ral/providers/sshkey/parsed.rb +0 -0
- data/test/ral/providers/user.rb +8 -8
- data/test/ral/providers/user/useradd.rb +0 -0
- data/test/ral/type/basic.rb +0 -0
- data/test/ral/type/cron.rb +0 -0
- data/test/ral/type/exec.rb +0 -0
- data/test/ral/type/file.rb +0 -0
- data/test/ral/type/file/target.rb +0 -0
- data/test/ral/type/filebucket.rb +0 -0
- data/test/ral/type/fileignoresource.rb +0 -0
- data/test/ral/type/filesources.rb +1 -3
- data/test/ral/type/group.rb +0 -0
- data/test/ral/type/host.rb +0 -0
- data/test/ral/type/mailalias.rb +1 -2
- data/test/ral/type/parameter.rb +0 -0
- data/test/ral/type/port.rb +0 -0
- data/test/ral/type/property.rb +0 -0
- data/test/ral/type/resources.rb +0 -0
- data/test/ral/type/service.rb +0 -0
- data/test/ral/type/sshkey.rb +0 -0
- data/test/ral/type/tidy.rb +0 -0
- data/test/ral/type/user.rb +0 -50
- data/test/ral/type/yumrepo.rb +7 -1
- data/test/ral/type/zone.rb +0 -0
- data/test/test +0 -0
- data/test/util/autoload.rb +0 -0
- data/test/util/classgen.rb +0 -0
- data/test/util/execution.rb +0 -0
- data/test/util/features.rb +0 -0
- data/test/util/fileparsing.rb +0 -0
- data/test/util/filetype.rb +0 -0
- data/test/util/inifile.rb +0 -0
- data/test/util/instance_loader.rb +0 -0
- data/test/util/log.rb +0 -59
- data/test/util/metrics.rb +0 -0
- data/test/util/package.rb +0 -0
- data/test/util/pidlock.rb +0 -0
- data/test/util/settings.rb +0 -0
- data/test/util/storage.rb +0 -0
- data/test/util/subclass_loader.rb +0 -0
- data/test/util/utiltest.rb +0 -0
- metadata +54 -19
- data/lib/puppet/metatype/attributes.rb +0 -685
- data/lib/puppet/metatype/closure.rb +0 -49
- data/lib/puppet/metatype/container.rb +0 -50
- data/lib/puppet/metatype/evaluation.rb +0 -163
- data/lib/puppet/metatype/instances.rb +0 -305
- data/lib/puppet/metatype/metaparams.rb +0 -423
- data/lib/puppet/metatype/providers.rb +0 -247
- data/lib/puppet/metatype/relationships.rb +0 -115
- data/lib/puppet/metatype/schedules.rb +0 -33
- data/lib/puppet/metatype/tags.rb +0 -38
- data/lib/puppet/util/plist.rb +0 -23
- data/lib/puppet/util/plist/generator.rb +0 -225
- data/lib/puppet/util/plist/parser.rb +0 -226
- data/test/ral/providers/package/apt.rb +0 -169
- data/test/ral/providers/package/dpkg.rb +0 -64
- data/test/util/posixtest.rb +0 -169
@@ -1,169 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require File.dirname(__FILE__) + '/../../../lib/puppettest'
|
4
|
-
|
5
|
-
require 'mocha'
|
6
|
-
|
7
|
-
class AptPackageProviderTest < PuppetTest::TestCase
|
8
|
-
confine "Apt package provider missing" =>
|
9
|
-
Puppet::Type.type(:package).provider(:apt).suitable?
|
10
|
-
|
11
|
-
def setup
|
12
|
-
super
|
13
|
-
@type = Puppet::Type.type(:package)
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_install
|
17
|
-
pkg = @type.create :name => 'faff',
|
18
|
-
:provider => :apt,
|
19
|
-
:ensure => :present,
|
20
|
-
:source => "/tmp/faff.deb"
|
21
|
-
|
22
|
-
pkg.provider.expects(
|
23
|
-
:dpkgquery
|
24
|
-
).with(
|
25
|
-
'-W',
|
26
|
-
'--showformat',
|
27
|
-
'${Status} ${Package} ${Version}\n',
|
28
|
-
'faff'
|
29
|
-
).returns(
|
30
|
-
"deinstall ok config-files faff 1.2.3-1\n"
|
31
|
-
).times(1)
|
32
|
-
|
33
|
-
pkg.provider.expects(
|
34
|
-
:aptget
|
35
|
-
).with(
|
36
|
-
'-q',
|
37
|
-
'-y',
|
38
|
-
'-o',
|
39
|
-
'DPkg::Options::=--force-confold',
|
40
|
-
:install,
|
41
|
-
'faff'
|
42
|
-
).returns(0)
|
43
|
-
|
44
|
-
pkg.evaluate.each { |state| state.transaction = self; state.forward }
|
45
|
-
end
|
46
|
-
|
47
|
-
def test_purge
|
48
|
-
pkg = @type.create :name => 'faff', :provider => :apt, :ensure => :purged
|
49
|
-
|
50
|
-
pkg.provider.expects(
|
51
|
-
:dpkgquery
|
52
|
-
).with(
|
53
|
-
'-W',
|
54
|
-
'--showformat',
|
55
|
-
'${Status} ${Package} ${Version}\n',
|
56
|
-
'faff'
|
57
|
-
).returns(
|
58
|
-
"install ok installed faff 1.2.3-1\n"
|
59
|
-
).times(1)
|
60
|
-
pkg.provider.expects(
|
61
|
-
:aptget
|
62
|
-
).with(
|
63
|
-
'-y',
|
64
|
-
'-q',
|
65
|
-
'remove',
|
66
|
-
'--purge',
|
67
|
-
'faff'
|
68
|
-
).returns(0)
|
69
|
-
pkg.provider.expects(
|
70
|
-
:dpkg
|
71
|
-
).with(
|
72
|
-
'--purge',
|
73
|
-
'faff'
|
74
|
-
).returns(0)
|
75
|
-
|
76
|
-
pkg.evaluate.each { |state| state.transaction = self; state.forward }
|
77
|
-
end
|
78
|
-
|
79
|
-
def test_dont_try_to_purge_if_already_purged
|
80
|
-
pkg = @type.create :name => 'faff', :provider => :apt, :ensure => :purged
|
81
|
-
|
82
|
-
pkg.provider.expects(
|
83
|
-
:dpkgquery
|
84
|
-
).with(
|
85
|
-
'-W',
|
86
|
-
'--showformat',
|
87
|
-
'${Status} ${Package} ${Version}\n',
|
88
|
-
'faff'
|
89
|
-
).raises(
|
90
|
-
Puppet::ExecutionFailure,
|
91
|
-
"No packages found matching faff.\n"
|
92
|
-
).times(1)
|
93
|
-
pkg.provider.expects(
|
94
|
-
:aptget
|
95
|
-
).never
|
96
|
-
|
97
|
-
pkg.evaluate.each { |state| state.transaction = self; state.forward }
|
98
|
-
end
|
99
|
-
|
100
|
-
def test_dont_try_to_purge_if_already_purged_and_we_want_it_absent
|
101
|
-
pkg = @type.create :name => 'faff', :provider => :apt, :ensure => :absent
|
102
|
-
|
103
|
-
pkg.provider.expects(
|
104
|
-
:dpkgquery
|
105
|
-
).with(
|
106
|
-
'-W',
|
107
|
-
'--showformat',
|
108
|
-
'${Status} ${Package} ${Version}\n',
|
109
|
-
'faff'
|
110
|
-
).raises(
|
111
|
-
Puppet::ExecutionFailure,
|
112
|
-
"No packages found matching faff.\n"
|
113
|
-
).times(1)
|
114
|
-
pkg.provider.expects(
|
115
|
-
:aptget
|
116
|
-
).never
|
117
|
-
|
118
|
-
pkg.evaluate.each { |state| state.transaction = self; state.forward }
|
119
|
-
end
|
120
|
-
|
121
|
-
def test_make_sure_we_purge_if_package_still_has_conffiles
|
122
|
-
pkg = @type.create :name => 'faff', :provider => :apt, :ensure => :purged
|
123
|
-
|
124
|
-
pkg.provider.expects(
|
125
|
-
:dpkgquery
|
126
|
-
).with(
|
127
|
-
'-W',
|
128
|
-
'--showformat',
|
129
|
-
'${Status} ${Package} ${Version}\n',
|
130
|
-
'faff'
|
131
|
-
).returns(
|
132
|
-
"deinstall ok config-files faff 1.2.3-1\n"
|
133
|
-
).times(1)
|
134
|
-
pkg.provider.expects(
|
135
|
-
:aptget
|
136
|
-
).with(
|
137
|
-
'-y',
|
138
|
-
'-q',
|
139
|
-
'remove',
|
140
|
-
'--purge',
|
141
|
-
'faff'
|
142
|
-
).returns(0)
|
143
|
-
pkg.provider.expects(
|
144
|
-
:dpkg
|
145
|
-
).with(
|
146
|
-
'--purge',
|
147
|
-
'faff'
|
148
|
-
).returns(0)
|
149
|
-
|
150
|
-
pkg.evaluate.each { |state| state.transaction = self; state.forward }
|
151
|
-
end
|
152
|
-
|
153
|
-
|
154
|
-
def test_latest
|
155
|
-
pkg = @type.create :name => 'base-files', :provider => :apt
|
156
|
-
|
157
|
-
assert(pkg, "did not create pkg")
|
158
|
-
status = pkg.provider.query
|
159
|
-
assert(status, "base-files is not installed")
|
160
|
-
assert(status[:ensure] != :absent, "base-files is not installed")
|
161
|
-
|
162
|
-
latest = nil
|
163
|
-
assert_nothing_raised("Could not call latest") do
|
164
|
-
latest = pkg.provider.latest
|
165
|
-
end
|
166
|
-
assert(latest, "Could not get latest value from apt")
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|
@@ -1,64 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require File.dirname(__FILE__) + '/../../../lib/puppettest'
|
4
|
-
|
5
|
-
require 'mocha'
|
6
|
-
|
7
|
-
class DpkgPackageProviderTest < PuppetTest::TestCase
|
8
|
-
confine "dpkg package provider missing" =>
|
9
|
-
Puppet::Type.type(:package).provider(:dpkg).suitable?
|
10
|
-
def setup
|
11
|
-
super
|
12
|
-
@type = Puppet::Type.type(:package)
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_install
|
16
|
-
pkg = @type.create :name => 'faff',
|
17
|
-
:provider => :dpkg,
|
18
|
-
:ensure => :present,
|
19
|
-
:source => "/tmp/faff.deb"
|
20
|
-
|
21
|
-
pkg.provider.expects(
|
22
|
-
:dpkgquery
|
23
|
-
).with(
|
24
|
-
'-W',
|
25
|
-
'--showformat',
|
26
|
-
'${Status} ${Package} ${Version}\n',
|
27
|
-
'faff'
|
28
|
-
).returns(
|
29
|
-
"deinstall ok config-files faff 1.2.3-1\n"
|
30
|
-
).times(1)
|
31
|
-
|
32
|
-
pkg.provider.expects(
|
33
|
-
:dpkg
|
34
|
-
).with(
|
35
|
-
'-i',
|
36
|
-
'/tmp/faff.deb'
|
37
|
-
).returns(0)
|
38
|
-
|
39
|
-
pkg.evaluate.each { |state| state.transaction = self; state.forward }
|
40
|
-
end
|
41
|
-
|
42
|
-
def test_purge
|
43
|
-
pkg = @type.create :name => 'faff', :provider => :dpkg, :ensure => :purged
|
44
|
-
|
45
|
-
pkg.provider.expects(
|
46
|
-
:dpkgquery
|
47
|
-
).with(
|
48
|
-
'-W',
|
49
|
-
'--showformat',
|
50
|
-
'${Status} ${Package} ${Version}\n',
|
51
|
-
'faff'
|
52
|
-
).returns(
|
53
|
-
"install ok installed faff 1.2.3-1\n"
|
54
|
-
).times(1)
|
55
|
-
pkg.provider.expects(
|
56
|
-
:dpkg
|
57
|
-
).with(
|
58
|
-
'--purge',
|
59
|
-
'faff'
|
60
|
-
).returns(0)
|
61
|
-
|
62
|
-
pkg.evaluate.each { |state| state.transaction = self; state.forward }
|
63
|
-
end
|
64
|
-
end
|
data/test/util/posixtest.rb
DELETED
@@ -1,169 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
#
|
3
|
-
# Created by Luke Kanies on 2006-11-07.
|
4
|
-
# Copyright (c) 2006. All rights reserved.
|
5
|
-
|
6
|
-
require File.dirname(__FILE__) + '/../lib/puppettest'
|
7
|
-
|
8
|
-
require 'puppettest'
|
9
|
-
require 'puppet/util/posix'
|
10
|
-
|
11
|
-
class TestPosixUtil < Test::Unit::TestCase
|
12
|
-
include PuppetTest
|
13
|
-
include Puppet::Util::POSIX
|
14
|
-
|
15
|
-
def mk_posix_resource(type, obj)
|
16
|
-
field = idfield(type)
|
17
|
-
res = Puppet::Type.type(type).create(
|
18
|
-
:name => obj.name,
|
19
|
-
field => obj.send(field)
|
20
|
-
)
|
21
|
-
res.setdefaults
|
22
|
-
res
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_get_posix_field
|
26
|
-
{:group => nonrootgroup, :passwd => nonrootuser}.each do |space, obj|
|
27
|
-
id = Puppet::Util.idfield(space)
|
28
|
-
[obj.name, obj.send(id), obj.send(id).to_s].each do |test|
|
29
|
-
value = nil
|
30
|
-
assert_nothing_raised do
|
31
|
-
value = get_posix_field(space, :name, test)
|
32
|
-
end
|
33
|
-
assert_equal(obj.name, value, "did not get correct value from get_posix_field")
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def test_get_provider_value
|
39
|
-
user = nonrootuser
|
40
|
-
obj = mk_posix_resource(:user, user)
|
41
|
-
|
42
|
-
assert_nothing_raised do
|
43
|
-
assert_equal(user.uid, get_provider_value(:user, :uid, user.uid))
|
44
|
-
assert_equal(user.name, get_provider_value(:user, :name, user.name))
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
|
-
def test_gid_and_uid
|
49
|
-
{:user => nonrootuser, :group => nonrootgroup}.each do |type, obj|
|
50
|
-
method = idfield(type)
|
51
|
-
# First make sure we get it back with both name and id with no object
|
52
|
-
[obj.name, obj.send(method)].each do |value|
|
53
|
-
assert_equal(obj.send(method), send(method, value))
|
54
|
-
end
|
55
|
-
|
56
|
-
# Now make a Puppet resource and make sure we get it from that.
|
57
|
-
resource = mk_posix_resource(type, obj)
|
58
|
-
|
59
|
-
[obj.name, obj.send(method)].each do |value|
|
60
|
-
assert_equal(obj.send(method), send(method, value))
|
61
|
-
end
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_util_methods
|
66
|
-
assert(Puppet::Util.respond_to?(:uid), "util does not have methods")
|
67
|
-
end
|
68
|
-
|
69
|
-
# First verify we can convert a known user
|
70
|
-
def test_gidbyname
|
71
|
-
%x{groups}.split(" ").each { |group|
|
72
|
-
gid = nil
|
73
|
-
assert_nothing_raised {
|
74
|
-
gid = Puppet::Util.gid(group)
|
75
|
-
}
|
76
|
-
|
77
|
-
assert(gid, "Could not retrieve gid for %s" % group)
|
78
|
-
}
|
79
|
-
end
|
80
|
-
|
81
|
-
# Then verify we can retrieve a known group by gid
|
82
|
-
def test_gidbyid
|
83
|
-
%x{groups}.split(" ").each { |group|
|
84
|
-
obj = Puppet.type(:group).create(
|
85
|
-
:name => group,
|
86
|
-
:check => [:gid]
|
87
|
-
)
|
88
|
-
obj.setdefaults
|
89
|
-
current = obj.retrieve
|
90
|
-
id = nil
|
91
|
-
current.find { |prop, value| id = value if prop.name == :gid }
|
92
|
-
gid = nil
|
93
|
-
assert_nothing_raised {
|
94
|
-
gid = Puppet::Util.gid(id)
|
95
|
-
}
|
96
|
-
|
97
|
-
assert(gid, "Could not retrieve gid for %s" % group)
|
98
|
-
assert_equal(id, gid, "Got mismatched ids")
|
99
|
-
}
|
100
|
-
end
|
101
|
-
|
102
|
-
# Finally, verify that we can find groups by id even if we don't
|
103
|
-
# know them
|
104
|
-
def test_gidbyunknownid
|
105
|
-
gid = nil
|
106
|
-
group = Puppet::Util::SUIDManager.gid
|
107
|
-
assert_nothing_raised {
|
108
|
-
gid = Puppet::Util.gid(group)
|
109
|
-
}
|
110
|
-
|
111
|
-
assert(gid, "Could not retrieve gid for %s" % group)
|
112
|
-
assert_equal(group, gid, "Got mismatched ids")
|
113
|
-
end
|
114
|
-
|
115
|
-
def user
|
116
|
-
require 'etc'
|
117
|
-
unless defined? @user
|
118
|
-
obj = Etc.getpwuid(Puppet::Util::SUIDManager.uid)
|
119
|
-
@user = obj.name
|
120
|
-
end
|
121
|
-
return @user
|
122
|
-
end
|
123
|
-
|
124
|
-
# And do it all over again for users
|
125
|
-
# First verify we can convert a known user
|
126
|
-
def test_uidbyname
|
127
|
-
user = user()
|
128
|
-
uid = nil
|
129
|
-
assert_nothing_raised {
|
130
|
-
uid = Puppet::Util.uid(user)
|
131
|
-
}
|
132
|
-
|
133
|
-
assert(uid, "Could not retrieve uid for %s" % user)
|
134
|
-
assert_equal(Puppet::Util::SUIDManager.uid, uid, "UIDs did not match")
|
135
|
-
end
|
136
|
-
|
137
|
-
# Then verify we can retrieve a known user by uid
|
138
|
-
def test_uidbyid
|
139
|
-
user = user()
|
140
|
-
obj = Puppet.type(:user).create(
|
141
|
-
:name => user,
|
142
|
-
:check => [:uid]
|
143
|
-
)
|
144
|
-
obj.setdefaults
|
145
|
-
obj.retrieve
|
146
|
-
id = obj.provider.uid
|
147
|
-
uid = nil
|
148
|
-
assert_nothing_raised {
|
149
|
-
uid = Puppet::Util.uid(id)
|
150
|
-
}
|
151
|
-
|
152
|
-
assert(uid, "Could not retrieve uid for %s" % user)
|
153
|
-
assert_equal(id, uid, "Got mismatched ids")
|
154
|
-
end
|
155
|
-
|
156
|
-
# Finally, verify that we can find users by id even if we don't
|
157
|
-
# know them
|
158
|
-
def test_uidbyunknownid
|
159
|
-
uid = nil
|
160
|
-
user = Puppet::Util::SUIDManager.uid
|
161
|
-
assert_nothing_raised {
|
162
|
-
uid = Puppet::Util.uid(user)
|
163
|
-
}
|
164
|
-
|
165
|
-
assert(uid, "Could not retrieve uid for %s" % user)
|
166
|
-
assert_equal(user, uid, "Got mismatched ids")
|
167
|
-
end
|
168
|
-
end
|
169
|
-
|