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.

Files changed (354) hide show
  1. data/CHANGELOG +206 -0
  2. data/Rakefile +53 -0
  3. data/bin/filebucket +0 -0
  4. data/bin/puppet +32 -11
  5. data/bin/puppetca +1 -0
  6. data/bin/puppetd +0 -0
  7. data/bin/puppetdoc +0 -0
  8. data/bin/puppetmasterd +0 -0
  9. data/bin/puppetrun +16 -8
  10. data/bin/ralsh +0 -0
  11. data/conf/debian/rules +0 -0
  12. data/conf/gentoo/init.d/puppetmaster +0 -0
  13. data/conf/osx/PackageInfo.plist +36 -0
  14. data/conf/osx/createpackage.sh +167 -0
  15. data/conf/osx/preflight +12 -0
  16. data/conf/redhat/client.init +1 -1
  17. data/conf/redhat/puppet.spec +34 -6
  18. data/conf/redhat/server.init +42 -7
  19. data/conf/redhat/server.sysconfig +22 -0
  20. data/conf/solaris/smf/svc-puppetd +0 -0
  21. data/conf/solaris/smf/svc-puppetmasterd +0 -0
  22. data/examples/etc/init.d/sleeper +0 -0
  23. data/examples/mac_dscl.pp +0 -0
  24. data/examples/mac_dscl_revert.pp +0 -0
  25. data/examples/mac_netinfo.pp +0 -0
  26. data/examples/mac_pkgdmg.pp +0 -0
  27. data/ext/bin/sleeper +0 -0
  28. data/ext/module_puppet +0 -0
  29. data/ext/nagios/check_puppet.rb +0 -0
  30. data/ext/passenger/README +63 -0
  31. data/ext/passenger/apache2.conf +29 -0
  32. data/ext/passenger/config.ru +40 -0
  33. data/ext/puppet-test +0 -0
  34. data/ext/puppetlast +6 -31
  35. data/ext/puppetstoredconfigclean.rb +87 -0
  36. data/install.rb +75 -20
  37. data/lib/puppet.rb +1 -1
  38. data/lib/puppet/daemon.rb +0 -0
  39. data/lib/puppet/defaults.rb +3 -7
  40. data/lib/puppet/external/base64.rb +0 -0
  41. data/lib/puppet/external/nagios.rb +0 -0
  42. data/lib/puppet/external/nagios/base.rb +0 -0
  43. data/lib/puppet/file_serving/fileset.rb +2 -2
  44. data/lib/puppet/file_serving/metadata.rb +3 -3
  45. data/lib/puppet/indirector/facts/facter.rb +3 -2
  46. data/lib/puppet/indirector/yaml.rb +10 -1
  47. data/lib/puppet/module.rb +36 -12
  48. data/lib/puppet/network/authstore.rb +0 -0
  49. data/lib/puppet/network/client/master.rb +12 -11
  50. data/lib/puppet/network/handler/filebucket.rb +0 -0
  51. data/lib/puppet/network/handler/fileserver.rb +38 -46
  52. data/lib/puppet/network/handler/master.rb +1 -1
  53. data/lib/puppet/network/handler/report.rb +0 -0
  54. data/lib/puppet/network/handler/resource.rb +0 -0
  55. data/lib/puppet/network/handler/runner.rb +0 -0
  56. data/lib/puppet/network/http_server/rack.rb +148 -0
  57. data/lib/puppet/network/rights.rb +0 -0
  58. data/lib/puppet/network/xmlrpc/client.rb +5 -5
  59. data/lib/puppet/node.rb +5 -9
  60. data/lib/puppet/node/environment.rb +1 -17
  61. data/lib/puppet/node/facts.rb +0 -0
  62. data/lib/puppet/parameter.rb +1 -28
  63. data/lib/puppet/parser/ast.rb +6 -0
  64. data/lib/puppet/parser/ast/arithmetic_operator.rb +41 -0
  65. data/lib/puppet/parser/ast/boolean_operator.rb +48 -0
  66. data/lib/puppet/parser/ast/collexpr.rb +6 -1
  67. data/lib/puppet/parser/ast/comparison_operator.rb +37 -0
  68. data/lib/puppet/parser/ast/minus.rb +23 -0
  69. data/lib/puppet/parser/ast/nop.rb +11 -0
  70. data/lib/puppet/parser/ast/not.rb +19 -0
  71. data/lib/puppet/parser/ast/resource_override.rb +23 -16
  72. data/lib/puppet/parser/ast/resource_reference.rb +10 -6
  73. data/lib/puppet/parser/ast/vardef.rb +2 -2
  74. data/lib/puppet/parser/collector.rb +2 -1
  75. data/lib/puppet/parser/functions.rb +7 -217
  76. data/lib/puppet/parser/functions/defined.rb +27 -0
  77. data/lib/puppet/parser/functions/fail.rb +4 -0
  78. data/lib/puppet/parser/functions/file.rb +21 -0
  79. data/lib/puppet/parser/functions/fqdn_rand.rb +15 -0
  80. data/lib/puppet/parser/functions/generate.rb +35 -0
  81. data/lib/puppet/parser/functions/include.rb +26 -0
  82. data/lib/puppet/parser/functions/realize.rb +14 -0
  83. data/lib/puppet/parser/functions/search.rb +7 -0
  84. data/lib/puppet/parser/functions/sha1.rb +6 -0
  85. data/lib/puppet/parser/functions/tag.rb +6 -0
  86. data/lib/puppet/parser/functions/tagged.rb +18 -0
  87. data/lib/puppet/parser/functions/template.rb +22 -0
  88. data/lib/puppet/parser/lexer.rb +15 -5
  89. data/lib/puppet/parser/parser.rb +1073 -715
  90. data/lib/puppet/parser/parser_support.rb +18 -13
  91. data/lib/puppet/parser/resource.rb +1 -1
  92. data/lib/puppet/parser/resource/param.rb +10 -2
  93. data/lib/puppet/parser/scope.rb +63 -5
  94. data/lib/puppet/parser/templatewrapper.rb +61 -15
  95. data/lib/puppet/property.rb +7 -1
  96. data/lib/puppet/property/keyvalue.rb +96 -0
  97. data/lib/puppet/property/list.rb +78 -0
  98. data/lib/puppet/provider/confine.rb +1 -1
  99. data/lib/puppet/provider/confine/variable.rb +10 -1
  100. data/lib/puppet/provider/cron/crontab.rb +0 -0
  101. data/lib/puppet/provider/mailalias/aliases.rb +0 -0
  102. data/lib/puppet/provider/maillist/mailman.rb +0 -0
  103. data/lib/puppet/provider/mount/parsed.rb +0 -0
  104. data/lib/puppet/provider/nameservice.rb +24 -39
  105. data/lib/puppet/provider/nameservice/directoryservice.rb +12 -3
  106. data/lib/puppet/provider/nameservice/netinfo.rb +12 -2
  107. data/lib/puppet/provider/nameservice/objectadd.rb +1 -10
  108. data/lib/puppet/provider/package/appdmg.rb +1 -1
  109. data/lib/puppet/provider/package/apple.rb +0 -0
  110. data/lib/puppet/provider/package/apt.rb +14 -21
  111. data/lib/puppet/provider/package/aptitude.rb +0 -0
  112. data/lib/puppet/provider/package/blastwave.rb +2 -0
  113. data/lib/puppet/provider/package/darwinport.rb +0 -0
  114. data/lib/puppet/provider/package/dpkg.rb +33 -51
  115. data/lib/puppet/provider/package/fink.rb +1 -1
  116. data/lib/puppet/provider/package/freebsd.rb +0 -0
  117. data/lib/puppet/provider/package/gem.rb +0 -0
  118. data/lib/puppet/provider/package/hpux.rb +46 -0
  119. data/lib/puppet/provider/package/openbsd.rb +0 -0
  120. data/lib/puppet/provider/package/pkgdmg.rb +1 -1
  121. data/lib/puppet/provider/package/portage.rb +3 -1
  122. data/lib/puppet/provider/package/ports.rb +3 -3
  123. data/lib/puppet/provider/package/rpm.rb +8 -1
  124. data/lib/puppet/provider/package/rug.rb +2 -2
  125. data/lib/puppet/provider/package/sun.rb +2 -0
  126. data/lib/puppet/provider/package/sunfreeware.rb +3 -0
  127. data/lib/puppet/provider/package/yum.rb +24 -17
  128. data/lib/puppet/provider/package/yumhelper.py +92 -11
  129. data/lib/puppet/provider/parsedfile.rb +0 -0
  130. data/lib/puppet/provider/port/parsed.rb +0 -0
  131. data/lib/puppet/provider/selboolean/getsetsebool.rb +47 -0
  132. data/lib/puppet/provider/selmodule/semodule.rb +143 -0
  133. data/lib/puppet/provider/service/base.rb +0 -0
  134. data/lib/puppet/provider/service/daemontools.rb +154 -0
  135. data/lib/puppet/provider/service/debian.rb +1 -1
  136. data/lib/puppet/provider/service/freebsd.rb +2 -0
  137. data/lib/puppet/provider/service/gentoo.rb +2 -0
  138. data/lib/puppet/provider/service/init.rb +0 -0
  139. data/lib/puppet/provider/service/redhat.rb +1 -1
  140. data/lib/puppet/provider/service/runit.rb +93 -0
  141. data/lib/puppet/provider/service/smf.rb +2 -0
  142. data/lib/puppet/provider/ssh_authorized_key/parsed.rb +7 -1
  143. data/lib/puppet/provider/sshkey/parsed.rb +0 -0
  144. data/lib/puppet/provider/user/hpux.rb +30 -0
  145. data/lib/puppet/provider/user/user_role_add.rb +156 -0
  146. data/lib/puppet/provider/user/useradd.rb +23 -14
  147. data/lib/puppet/rails/database/002_remove_duplicated_index_on_all_tables.rb +17 -0
  148. data/lib/puppet/rails/database/schema.rb +0 -8
  149. data/lib/puppet/rails/resource.rb +6 -6
  150. data/lib/puppet/reference/configuration.rb +0 -7
  151. data/lib/puppet/reports.rb +0 -0
  152. data/lib/puppet/reports/rrdgraph.rb +3 -2
  153. data/lib/puppet/sslcertificates.rb +0 -0
  154. data/lib/puppet/sslcertificates/inventory.rb +3 -2
  155. data/lib/puppet/sslcertificates/support.rb +3 -0
  156. data/lib/puppet/transaction/report.rb +1 -7
  157. data/lib/puppet/transportable.rb +10 -7
  158. data/lib/puppet/type.rb +2110 -14
  159. data/lib/puppet/type/cron.rb +0 -0
  160. data/lib/puppet/type/exec.rb +0 -0
  161. data/lib/puppet/type/file.rb +12 -2
  162. data/lib/puppet/type/file/checksum.rb +4 -0
  163. data/lib/puppet/type/file/content.rb +0 -0
  164. data/lib/puppet/type/file/ensure.rb +0 -0
  165. data/lib/puppet/type/file/group.rb +30 -43
  166. data/lib/puppet/type/file/mode.rb +0 -0
  167. data/lib/puppet/type/file/owner.rb +0 -0
  168. data/lib/puppet/type/file/selcontext.rb +104 -0
  169. data/lib/puppet/type/file/source.rb +0 -0
  170. data/lib/puppet/type/file/type.rb +0 -0
  171. data/lib/puppet/type/filebucket.rb +0 -0
  172. data/lib/puppet/type/group.rb +0 -8
  173. data/lib/puppet/type/host.rb +0 -0
  174. data/lib/puppet/type/mailalias.rb +0 -0
  175. data/lib/puppet/type/maillist.rb +0 -0
  176. data/lib/puppet/type/mount.rb +0 -0
  177. data/lib/puppet/type/package.rb +2 -2
  178. data/lib/puppet/type/port.rb +0 -0
  179. data/lib/puppet/type/schedule.rb +0 -0
  180. data/lib/puppet/type/selboolean.rb +31 -0
  181. data/lib/puppet/type/selmodule.rb +54 -0
  182. data/lib/puppet/type/ssh_authorized_key.rb +3 -3
  183. data/lib/puppet/type/sshkey.rb +0 -0
  184. data/lib/puppet/type/tidy.rb +0 -0
  185. data/lib/puppet/type/user.rb +153 -137
  186. data/lib/puppet/type/yumrepo.rb +18 -2
  187. data/lib/puppet/type/zone.rb +5 -1
  188. data/lib/puppet/util.rb +7 -7
  189. data/lib/puppet/util/filetype.rb +7 -0
  190. data/lib/puppet/util/instance_loader.rb +0 -0
  191. data/lib/puppet/util/ldap/connection.rb +11 -1
  192. data/lib/puppet/util/ldap/manager.rb +1 -1
  193. data/lib/puppet/util/loadedfile.rb +0 -0
  194. data/lib/puppet/util/log.rb +42 -43
  195. data/lib/puppet/util/metric.rb +23 -9
  196. data/lib/puppet/util/posix.rb +69 -18
  197. data/lib/puppet/util/selinux.rb +139 -0
  198. data/lib/puppet/util/settings.rb +5 -7
  199. data/lib/puppet/util/user_attr.rb +21 -0
  200. data/test/certmgr/ca.rb +0 -0
  201. data/test/certmgr/certmgr.rb +0 -0
  202. data/test/certmgr/inventory.rb +0 -0
  203. data/test/certmgr/support.rb +0 -0
  204. data/test/data/providers/ssh_authorized_key/parsed/authorized_keys1 +3 -0
  205. data/test/data/snippets/append.pp +11 -0
  206. data/test/data/snippets/arithmetic_expression.pp +8 -0
  207. data/test/data/snippets/arraytrailingcomma.pp +3 -0
  208. data/test/data/snippets/emptyifelse.pp +9 -0
  209. data/test/data/snippets/funccomma.pp +5 -0
  210. data/test/data/snippets/ifexpression.rb +6 -0
  211. data/test/data/snippets/subclass_name_duplication.pp +0 -0
  212. data/test/executables/filebucket.rb +0 -0
  213. data/test/executables/puppetbin.rb +0 -0
  214. data/test/executables/puppetca.rb +0 -0
  215. data/test/executables/puppetd.rb +0 -0
  216. data/test/executables/puppetmasterd.rb +0 -0
  217. data/test/executables/puppetmodule.rb +0 -0
  218. data/test/language/ast.rb +0 -0
  219. data/test/language/ast/casestatement.rb +0 -0
  220. data/test/language/ast/resource.rb +0 -0
  221. data/test/language/ast/resource_reference.rb +0 -28
  222. data/test/language/ast/selector.rb +0 -0
  223. data/test/language/ast/variable.rb +0 -0
  224. data/test/language/functions.rb +91 -12
  225. data/test/language/parser.rb +21 -0
  226. data/test/language/resource.rb +0 -0
  227. data/test/language/scope.rb +28 -0
  228. data/test/language/snippets.rb +14 -0
  229. data/test/language/transportable.rb +0 -0
  230. data/test/lib/puppettest.rb +0 -0
  231. data/test/lib/puppettest/reporttesting.rb +0 -2
  232. data/test/lib/puppettest/runnable_test.rb +2 -0
  233. data/test/lib/puppettest/support/resources.rb +0 -0
  234. data/test/network/authconfig.rb +0 -0
  235. data/test/network/authorization.rb +0 -0
  236. data/test/network/authstore.rb +0 -0
  237. data/test/network/client/ca.rb +0 -0
  238. data/test/network/client/client.rb +0 -0
  239. data/test/network/client/dipper.rb +0 -0
  240. data/test/network/client/master.rb +2 -6
  241. data/test/network/client/resource.rb +0 -0
  242. data/test/network/client_request.rb +0 -0
  243. data/test/network/daemon.rb +0 -0
  244. data/test/network/handler/bucket.rb +0 -0
  245. data/test/network/handler/ca.rb +0 -0
  246. data/test/network/handler/fileserver.rb +8 -0
  247. data/test/network/handler/handler.rb +0 -0
  248. data/test/network/handler/master.rb +3 -1
  249. data/test/network/handler/report.rb +0 -0
  250. data/test/network/handler/resource.rb +0 -0
  251. data/test/network/handler/runner.rb +0 -0
  252. data/test/network/rights.rb +0 -0
  253. data/test/network/server/mongrel_test.rb +0 -0
  254. data/test/network/server/webrick.rb +0 -0
  255. data/test/network/xmlrpc/client.rb +0 -0
  256. data/test/network/xmlrpc/processor.rb +0 -0
  257. data/test/network/xmlrpc/server.rb +0 -0
  258. data/test/network/xmlrpc/webrick_servlet.rb +0 -0
  259. data/test/other/dsl.rb +0 -0
  260. data/test/other/events.rb +0 -0
  261. data/test/other/overrides.rb +0 -0
  262. data/test/other/provider.rb +0 -0
  263. data/test/other/puppet.rb +0 -0
  264. data/test/other/relationships.rb +0 -0
  265. data/test/other/report.rb +2 -4
  266. data/test/other/transactions.rb +1 -1
  267. data/test/puppet/conffiles.rb +0 -0
  268. data/test/puppet/defaults.rb +0 -0
  269. data/test/puppet/errortest.rb +0 -0
  270. data/test/puppet/tc_suidmanager.rb +0 -0
  271. data/test/rails/ast.rb +0 -0
  272. data/test/rails/configuration.rb +0 -0
  273. data/test/rails/host.rb +0 -0
  274. data/test/rails/rails.rb +0 -0
  275. data/test/rails/railsparameter.rb +0 -0
  276. data/test/rails/railsresource.rb +0 -0
  277. data/test/ral/manager/attributes.rb +0 -0
  278. data/test/ral/manager/instances.rb +0 -0
  279. data/test/ral/manager/manager.rb +0 -0
  280. data/test/ral/manager/provider.rb +0 -0
  281. data/test/ral/manager/type.rb +0 -0
  282. data/test/ral/providers/cron/crontab.rb +0 -0
  283. data/test/ral/providers/group.rb +14 -13
  284. data/test/ral/providers/host/netinfo.rb +0 -0
  285. data/test/ral/providers/host/parsed.rb +0 -0
  286. data/test/ral/providers/mailalias/aliases.rb +0 -0
  287. data/test/ral/providers/mount/netinfo.rb +0 -0
  288. data/test/ral/providers/nameservice.rb +0 -0
  289. data/test/ral/providers/package.rb +0 -31
  290. data/test/ral/providers/package/aptitude.rb +1 -2
  291. data/test/ral/providers/package/aptrpm.rb +2 -2
  292. data/test/ral/providers/parsedfile.rb +0 -0
  293. data/test/ral/providers/port/parsed.rb +0 -0
  294. data/test/ral/providers/provider.rb +0 -0
  295. data/test/ral/providers/service/base.rb +0 -0
  296. data/test/ral/providers/service/debian.rb +0 -0
  297. data/test/ral/providers/sshkey/parsed.rb +0 -0
  298. data/test/ral/providers/user.rb +8 -8
  299. data/test/ral/providers/user/useradd.rb +0 -0
  300. data/test/ral/type/basic.rb +0 -0
  301. data/test/ral/type/cron.rb +0 -0
  302. data/test/ral/type/exec.rb +0 -0
  303. data/test/ral/type/file.rb +0 -0
  304. data/test/ral/type/file/target.rb +0 -0
  305. data/test/ral/type/filebucket.rb +0 -0
  306. data/test/ral/type/fileignoresource.rb +0 -0
  307. data/test/ral/type/filesources.rb +1 -3
  308. data/test/ral/type/group.rb +0 -0
  309. data/test/ral/type/host.rb +0 -0
  310. data/test/ral/type/mailalias.rb +1 -2
  311. data/test/ral/type/parameter.rb +0 -0
  312. data/test/ral/type/port.rb +0 -0
  313. data/test/ral/type/property.rb +0 -0
  314. data/test/ral/type/resources.rb +0 -0
  315. data/test/ral/type/service.rb +0 -0
  316. data/test/ral/type/sshkey.rb +0 -0
  317. data/test/ral/type/tidy.rb +0 -0
  318. data/test/ral/type/user.rb +0 -50
  319. data/test/ral/type/yumrepo.rb +7 -1
  320. data/test/ral/type/zone.rb +0 -0
  321. data/test/test +0 -0
  322. data/test/util/autoload.rb +0 -0
  323. data/test/util/classgen.rb +0 -0
  324. data/test/util/execution.rb +0 -0
  325. data/test/util/features.rb +0 -0
  326. data/test/util/fileparsing.rb +0 -0
  327. data/test/util/filetype.rb +0 -0
  328. data/test/util/inifile.rb +0 -0
  329. data/test/util/instance_loader.rb +0 -0
  330. data/test/util/log.rb +0 -59
  331. data/test/util/metrics.rb +0 -0
  332. data/test/util/package.rb +0 -0
  333. data/test/util/pidlock.rb +0 -0
  334. data/test/util/settings.rb +0 -0
  335. data/test/util/storage.rb +0 -0
  336. data/test/util/subclass_loader.rb +0 -0
  337. data/test/util/utiltest.rb +0 -0
  338. metadata +54 -19
  339. data/lib/puppet/metatype/attributes.rb +0 -685
  340. data/lib/puppet/metatype/closure.rb +0 -49
  341. data/lib/puppet/metatype/container.rb +0 -50
  342. data/lib/puppet/metatype/evaluation.rb +0 -163
  343. data/lib/puppet/metatype/instances.rb +0 -305
  344. data/lib/puppet/metatype/metaparams.rb +0 -423
  345. data/lib/puppet/metatype/providers.rb +0 -247
  346. data/lib/puppet/metatype/relationships.rb +0 -115
  347. data/lib/puppet/metatype/schedules.rb +0 -33
  348. data/lib/puppet/metatype/tags.rb +0 -38
  349. data/lib/puppet/util/plist.rb +0 -23
  350. data/lib/puppet/util/plist/generator.rb +0 -225
  351. data/lib/puppet/util/plist/parser.rb +0 -226
  352. data/test/ral/providers/package/apt.rb +0 -169
  353. data/test/ral/providers/package/dpkg.rb +0 -64
  354. data/test/util/posixtest.rb +0 -169
File without changes
File without changes
@@ -368,7 +368,7 @@ module Puppet
368
368
  Find.find(self[:path]) do |f|
369
369
  if File.file?(f)
370
370
  sum = backup.backup(f)
371
- self.info "Filebucketed %s to %s with sum %s" %
371
+ self.notice "Filebucketed %s to %s with sum %s" %
372
372
  [f, backup.name, sum]
373
373
  end
374
374
  end
@@ -403,7 +403,7 @@ module Puppet
403
403
  case backup
404
404
  when Puppet::Network::Client.client(:Dipper):
405
405
  sum = backup.backup(file)
406
- self.info "Filebucketed to %s with sum %s" %
406
+ self.notice "Filebucketed to %s with sum %s" %
407
407
  [backup.name, sum]
408
408
  return true
409
409
  when String:
@@ -849,6 +849,8 @@ module Puppet
849
849
  # Keep track of all the files we found in the source, so we can purge
850
850
  # appropriately.
851
851
  sourced = []
852
+
853
+ success = false
852
854
 
853
855
  @parameters[:source].should.each do |source|
854
856
  sourceobj, path = uri2obj(source)
@@ -863,6 +865,8 @@ module Puppet
863
865
  if desc == ""
864
866
  next
865
867
  end
868
+
869
+ success = true
866
870
 
867
871
  # Now create a new child for every file returned in the list.
868
872
  result += desc.split("\n").collect { |line|
@@ -898,6 +902,11 @@ module Puppet
898
902
  return [result, sourced]
899
903
  end
900
904
  end
905
+
906
+ unless success
907
+ raise Puppet::Error, "None of the provided sources exist"
908
+ end
909
+
901
910
  return [result, sourced]
902
911
  end
903
912
 
@@ -1148,4 +1157,5 @@ module Puppet
1148
1157
  require 'puppet/type/file/group'
1149
1158
  require 'puppet/type/file/mode'
1150
1159
  require 'puppet/type/file/type'
1160
+ require 'puppet/type/file/selcontext' # SELinux file context
1151
1161
  end
@@ -53,6 +53,9 @@ Puppet::Type.type(:file).newproperty(:checksum) do
53
53
  else
54
54
  if FileTest.directory?(@resource[:path])
55
55
  return :time
56
+ elsif @resource[:source] and value.to_s != "md5"
57
+ self.warning("Files with source set must use md5 as checksum. Forcing to md5 from %s for %s" % [ value, @resource[:path] ])
58
+ return :md5
56
59
  else
57
60
  return symbolize(value)
58
61
  end
@@ -161,6 +164,7 @@ Puppet::Type.type(:file).newproperty(:checksum) do
161
164
 
162
165
  checktype = :mtime if checktype == :timestamp
163
166
  checktype = :ctime if checktype == :time
167
+ self.should = checktype = :md5 if @resource.property(:source)
164
168
 
165
169
  file ||= @resource[:path]
166
170
 
File without changes
File without changes
@@ -1,6 +1,10 @@
1
+ require 'puppet/util/posix'
2
+
1
3
  # Manage file group ownership.
2
4
  module Puppet
3
5
  Puppet.type(:file).newproperty(:group) do
6
+ include Puppet::Util::POSIX
7
+
4
8
  require 'etc'
5
9
  desc "Which group should own the file. Argument can be either group
6
10
  name or group ID."
@@ -42,32 +46,23 @@ module Puppet
42
46
  end
43
47
  end
44
48
 
45
- def retrieve
46
- if self.should
47
- @should = @should.collect do |val|
48
- unless val.is_a?(Integer)
49
- if tmp = validgroup?(val)
50
- val = tmp
51
- else
52
- raise "Could not find group %s" % val
53
- end
54
- else
55
- val
56
- end
49
+ def insync?(current)
50
+ @should.each do |value|
51
+ if value =~ /^\d+$/
52
+ gid = Integer(value)
53
+ elsif value.is_a?(String)
54
+ fail "Could not find group %s" % value unless gid = gid(value)
55
+ else
56
+ gid = value
57
57
  end
58
- end
59
- stat = @resource.stat(false)
60
58
 
61
- unless stat
62
- return :absent
59
+ return true if gid == current
63
60
  end
61
+ return false
62
+ end
64
63
 
65
- # Set our method appropriately, depending on links.
66
- if stat.ftype == "link" and @resource[:links] != :follow
67
- @method = :lchown
68
- else
69
- @method = :chown
70
- end
64
+ def retrieve
65
+ return :absent unless stat = resource.stat(false)
71
66
 
72
67
  currentvalue = stat.gid
73
68
 
@@ -84,12 +79,8 @@ module Puppet
84
79
 
85
80
  # Determine if the group is valid, and if so, return the GID
86
81
  def validgroup?(value)
87
- if value =~ /^\d+$/
88
- value = value.to_i
89
- end
90
-
91
- if gid = Puppet::Util.gid(value)
92
- return gid
82
+ if number = gid(value)
83
+ return number
93
84
  else
94
85
  return false
95
86
  end
@@ -99,32 +90,28 @@ module Puppet
99
90
  # we'll just let it fail, but we should probably set things up so
100
91
  # that users get warned if they try to change to an unacceptable group.
101
92
  def sync
102
- unless @resource.stat(false)
103
- stat = @resource.stat(true)
104
- currentvalue = self.retrieve
105
-
106
- unless stat
107
- self.debug "File '%s' does not exist; cannot chgrp" %
108
- @resource[:path]
109
- return nil
110
- end
93
+ # Set our method appropriately, depending on links.
94
+ if resource[:links] == :manage
95
+ method = :lchown
96
+ else
97
+ method = :chown
111
98
  end
112
99
 
113
100
  gid = nil
114
- unless gid = Puppet::Util.gid(self.should)
115
- raise Puppet::Error, "Could not find group %s" % self.should
101
+ @should.each do |group|
102
+ break if gid = validgroup?(group)
116
103
  end
117
104
 
105
+ raise Puppet::Error, "Could not find group(s) %s" % @should.join(",") unless gid
106
+
118
107
  begin
119
108
  # set owner to nil so it's ignored
120
- File.send(@method,nil,gid,@resource[:path])
109
+ File.send(method, nil, gid, resource[:path])
121
110
  rescue => detail
122
- error = Puppet::Error.new( "failed to chgrp %s to %s: %s" %
123
- [@resource[:path], self.should, detail.message])
111
+ error = Puppet::Error.new( "failed to chgrp %s to %s: %s" % [resource[:path], gid, detail.message])
124
112
  raise error
125
113
  end
126
114
  return :file_changed
127
115
  end
128
116
  end
129
117
  end
130
-
File without changes
File without changes
@@ -0,0 +1,104 @@
1
+ # Manage SELinux context of files.
2
+ #
3
+ # This code actually manages three pieces of data in the context.
4
+ #
5
+ # [root@delenn files]# ls -dZ /
6
+ # drwxr-xr-x root root system_u:object_r:root_t /
7
+ #
8
+ # The context of '/' here is 'system_u:object_r:root_t'. This is
9
+ # three seperate fields:
10
+ #
11
+ # system_u is the user context
12
+ # object_r is the role context
13
+ # root_t is the type context
14
+ #
15
+ # All three of these fields are returned in a single string by the
16
+ # output of the stat command, but set individually with the chcon
17
+ # command. This allows the user to specify a subset of the three
18
+ # values while leaving the others alone.
19
+ #
20
+ # See http://www.nsa.gov/selinux/ for complete docs on SELinux.
21
+
22
+ module Puppet
23
+ require 'puppet/util/selinux'
24
+
25
+ class SELFileContext < Puppet::Property
26
+ include Puppet::Util::SELinux
27
+
28
+ def retrieve
29
+ unless @resource.stat(false)
30
+ return :absent
31
+ end
32
+ context = self.get_selinux_current_context(@resource[:path])
33
+ return parse_selinux_context(name, context)
34
+ end
35
+
36
+ def retrieve_default_context(property)
37
+ unless context = self.get_selinux_default_context(@resource[:path])
38
+ return nil
39
+ end
40
+ property_default = self.parse_selinux_context(property, context)
41
+ self.debug "Found #{property} default '#{property_default}' for #{@resource[:path]}"
42
+ return property_default
43
+ end
44
+
45
+ def sync
46
+ unless @resource.stat(false)
47
+ stat = @resource.stat(true)
48
+ unless stat
49
+ return nil
50
+ end
51
+ end
52
+
53
+ self.set_selinux_context(@resource[:path], @should, name)
54
+ return :file_changed
55
+ end
56
+ end
57
+
58
+ Puppet.type(:file).newproperty(:seluser, :parent => Puppet::SELFileContext) do
59
+ desc "What the SELinux user component of the context of the file should be.
60
+ Any valid SELinux user component is accepted. For example ``user_u``.
61
+ If not specified it defaults to the value returned by matchpathcon for
62
+ the file, if any exists. Only valid on systems with SELinux support
63
+ enabled."
64
+
65
+ @event = :file_changed
66
+ defaultto { self.retrieve_default_context(:seluser) }
67
+ end
68
+
69
+ Puppet.type(:file).newproperty(:selrole, :parent => Puppet::SELFileContext) do
70
+ desc "What the SELinux role component of the context of the file should be.
71
+ Any valid SELinux role component is accepted. For example ``role_r``.
72
+ If not specified it defaults to the value returned by matchpathcon for
73
+ the file, if any exists. Only valid on systems with SELinux support
74
+ enabled."
75
+
76
+ @event = :file_changed
77
+ defaultto { self.retrieve_default_context(:selrole) }
78
+ end
79
+
80
+ Puppet.type(:file).newproperty(:seltype, :parent => Puppet::SELFileContext) do
81
+ desc "What the SELinux type component of the context of the file should be.
82
+ Any valid SELinux type component is accepted. For example ``tmp_t``.
83
+ If not specified it defaults to the value returned by matchpathcon for
84
+ the file, if any exists. Only valid on systems with SELinux support
85
+ enabled."
86
+
87
+ @event = :file_changed
88
+ defaultto { self.retrieve_default_context(:seltype) }
89
+ end
90
+
91
+ Puppet.type(:file).newproperty(:selrange, :parent => Puppet::SELFileContext) do
92
+ desc "What the SELinux range component of the context of the file should be.
93
+ Any valid SELinux range component is accepted. For example ``s0`` or
94
+ ``SystemHigh``. If not specified it defaults to the value returned by
95
+ matchpathcon for the file, if any exists. Only valid on systems with
96
+ SELinux support enabled and that have support for MCS (Multi-Category
97
+ Security)."
98
+
99
+ @event = :file_changed
100
+ defaultto { self.retrieve_default_context(:selrange) }
101
+ end
102
+
103
+ end
104
+
File without changes
File without changes
File without changes
@@ -118,14 +118,6 @@ module Puppet
118
118
 
119
119
  defaultto false
120
120
  end
121
-
122
- def retrieve
123
- if self.provider and @provider.exists?
124
- return super
125
- else
126
- return currentpropvalues(:absent)
127
- end
128
- end
129
121
  end
130
122
  end
131
123
 
File without changes
File without changes
File without changes
File without changes
@@ -138,8 +138,8 @@ module Puppet
138
138
  # that can't query versions.
139
139
  return true
140
140
  else
141
- self.debug "is is %s, latest %s is %s" %
142
- [is.inspect, @resource.name, @latest.inspect]
141
+ self.debug "%s %s is installed, latest is %s" %
142
+ [@resource.name, is.inspect, @latest.inspect]
143
143
  end
144
144
  when :absent
145
145
  return true if is == :absent or is == :purged
File without changes
File without changes
@@ -0,0 +1,31 @@
1
+ #
2
+ # Simple module for manageing SELinux booleans
3
+ #
4
+
5
+ module Puppet
6
+ newtype(:selboolean) do
7
+ @doc = "Manages SELinux booleans on systems with SELinux support. The supported booleans
8
+ are any of the ones found in /selinux/booleans/."
9
+
10
+ newparam(:name) do
11
+ desc "The name of the SELinux boolean to be managed."
12
+ isnamevar
13
+ end
14
+
15
+ newproperty(:value) do
16
+ desc "Whether the the SELinux boolean should be enabled or disabled."
17
+ newvalue(:on)
18
+ newvalue(:off)
19
+ end
20
+
21
+ newparam(:persistent) do
22
+ desc "If set true, SELinux booleans will be written to disk and persist accross reboots.
23
+ The default is ``false``."
24
+
25
+ defaultto :false
26
+ newvalues(:true, :false)
27
+ end
28
+
29
+ end
30
+ end
31
+
@@ -0,0 +1,54 @@
1
+ #
2
+ # Simple module for manageing SELinux policy modules
3
+ #
4
+
5
+ Puppet::Type.newtype(:selmodule) do
6
+ @doc = "Manages loading and unloading of SELinux policy modules
7
+ on the system. Requires SELinux support. See man semodule(8)
8
+ for more information on SELinux policy modules."
9
+
10
+ ensurable
11
+
12
+ newparam(:name) do
13
+ desc "The name of the SELinux policy to be managed. You should not
14
+ include the customary trailing .pp extension."
15
+ isnamevar
16
+ end
17
+
18
+ newparam(:selmoduledir) do
19
+
20
+ desc "The directory to look for the compiled pp module file in.
21
+ Currently defaults to /usr/share/selinux/targeted. If selmodulepath
22
+ is not specified the module will be looked for in this directory in a
23
+ in a file called NAME.pp, where NAME is the value of the name parameter."
24
+
25
+ defaultto "/usr/share/selinux/targeted"
26
+ end
27
+
28
+ newparam(:selmodulepath) do
29
+
30
+ desc "The full path to the compiled .pp policy module. You only need to use
31
+ this if the module file is not in the directory pointed at by selmoduledir."
32
+
33
+ end
34
+
35
+ newproperty(:syncversion) do
36
+
37
+ desc "If set to ``true``, the policy will be reloaded if the
38
+ version found in the on-disk file differs from the loaded
39
+ version. If set to ``false`` (the default) the the only check
40
+ that will be made is if the policy is loaded at all or not."
41
+
42
+ newvalue(:true)
43
+ newvalue(:false)
44
+ end
45
+
46
+ autorequire(:file) do
47
+ if self[:selmodulepath]
48
+ [self[:selmodulepath]]
49
+ else
50
+ ["#{self[:selmoduledir]}/#{self[:name]}.pp"]
51
+ end
52
+ end
53
+ end
54
+
@@ -1,6 +1,7 @@
1
1
  module Puppet
2
2
  newtype(:ssh_authorized_key) do
3
- @doc = "Manages ssh authorized keys."
3
+ @doc = "Manages SSH authorized keys. Currently only type 2 keys are
4
+ supported."
4
5
 
5
6
  ensurable
6
7
 
@@ -11,8 +12,7 @@ module Puppet
11
12
  end
12
13
 
13
14
  newproperty(:type) do
14
- desc "The encryption type used. Usually ssh-dss or ssh-rsa for
15
- SSH version 2. Not used for SSH version 1."
15
+ desc "The encryption type used: ssh-dss or ssh-rsa."
16
16
 
17
17
  newvalue("ssh-dss")
18
18
  newvalue("ssh-rsa")