puppet 3.1.1 → 3.2.0.rc1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (477) hide show
  1. data/CONTRIBUTING.md +2 -2
  2. data/Gemfile +32 -19
  3. data/README_DEVELOPER.md +332 -14
  4. data/Rakefile +9 -5
  5. data/ext/build_defaults.yaml +2 -3
  6. data/ext/debian/changelog.erb +6 -0
  7. data/ext/debian/control +6 -6
  8. data/ext/envpuppet +4 -4
  9. data/ext/project_data.yaml +1 -0
  10. data/ext/puppet-nm-dispatcher +13 -0
  11. data/ext/redhat/puppet.spec.erb +17 -0
  12. data/ext/suse/client.init +1 -1
  13. data/ext/systemd/puppetagent.service +2 -2
  14. data/ext/systemd/puppetmaster.service +2 -2
  15. data/lib/hiera/scope.rb +29 -11
  16. data/lib/hiera_puppet.rb +1 -3
  17. data/lib/puppet/agent.rb +3 -3
  18. data/lib/puppet/application.rb +2 -2
  19. data/lib/puppet/application/agent.rb +27 -12
  20. data/lib/puppet/application/apply.rb +11 -1
  21. data/lib/puppet/application/describe.rb +1 -1
  22. data/lib/puppet/application/doc.rb +13 -9
  23. data/lib/puppet/application/filebucket.rb +0 -1
  24. data/lib/puppet/application/kick.rb +1 -0
  25. data/lib/puppet/application/master.rb +16 -8
  26. data/lib/puppet/daemon.rb +19 -64
  27. data/lib/puppet/defaults.rb +61 -5
  28. data/lib/puppet/error.rb +15 -4
  29. data/lib/puppet/external/nagios/grammar.ry +1 -1
  30. data/lib/puppet/external/nagios/makefile +1 -1
  31. data/lib/puppet/external/nagios/parser.rb +185 -618
  32. data/lib/puppet/external/pson/pure/parser.rb +47 -1
  33. data/lib/puppet/face/certificate.rb +3 -3
  34. data/lib/puppet/face/module.rb +1 -1
  35. data/lib/puppet/face/module/changes.rb +3 -1
  36. data/lib/puppet/face/module/uninstall.rb +1 -1
  37. data/lib/puppet/face/node/clean.rb +5 -5
  38. data/lib/puppet/feature/base.rb +3 -1
  39. data/lib/puppet/feature/libuser.rb +8 -0
  40. data/lib/puppet/file_serving/fileset.rb +9 -1
  41. data/lib/puppet/forge.rb +28 -5
  42. data/lib/puppet/forge/errors.rb +34 -0
  43. data/lib/puppet/forge/repository.rb +1 -1
  44. data/lib/puppet/indirector.rb +4 -1
  45. data/lib/puppet/indirector/catalog/compiler.rb +37 -30
  46. data/lib/puppet/indirector/facts/inventory_active_record.rb +1 -0
  47. data/lib/puppet/indirector/indirection.rb +28 -15
  48. data/lib/puppet/indirector/rest.rb +18 -10
  49. data/lib/puppet/interface.rb +11 -4
  50. data/lib/puppet/interface/action.rb +1 -3
  51. data/lib/puppet/interface/action_builder.rb +0 -3
  52. data/lib/puppet/interface/action_manager.rb +0 -3
  53. data/lib/puppet/interface/face_collection.rb +0 -2
  54. data/lib/puppet/interface/option.rb +0 -2
  55. data/lib/puppet/interface/option_builder.rb +0 -2
  56. data/lib/puppet/interface/option_manager.rb +0 -2
  57. data/lib/puppet/metatype/manager.rb +1 -1
  58. data/lib/puppet/module_tool.rb +1 -0
  59. data/lib/puppet/module_tool/applications/application.rb +0 -3
  60. data/lib/puppet/module_tool/applications/builder.rb +8 -20
  61. data/lib/puppet/module_tool/applications/checksummer.rb +1 -1
  62. data/lib/puppet/module_tool/applications/installer.rb +1 -0
  63. data/lib/puppet/module_tool/applications/unpacker.rb +3 -11
  64. data/lib/puppet/module_tool/checksums.rb +1 -1
  65. data/lib/puppet/module_tool/errors/installer.rb +18 -1
  66. data/lib/puppet/module_tool/modulefile.rb +2 -2
  67. data/lib/puppet/module_tool/skeleton/templates/generator/Modulefile.erb +1 -1
  68. data/lib/puppet/module_tool/tar.rb +17 -0
  69. data/lib/puppet/module_tool/tar/gnu.rb +9 -0
  70. data/lib/puppet/module_tool/tar/mini.rb +39 -0
  71. data/lib/puppet/module_tool/tar/solaris.rb +5 -0
  72. data/lib/puppet/network/http.rb +1 -0
  73. data/lib/puppet/network/http/connection.rb +9 -23
  74. data/lib/puppet/network/http/handler.rb +38 -7
  75. data/lib/puppet/network/http/rack/rest.rb +14 -3
  76. data/lib/puppet/network/http/webrick.rb +3 -1
  77. data/lib/puppet/network/http/webrick/rest.rb +11 -2
  78. data/lib/puppet/node/environment.rb +3 -1
  79. data/lib/puppet/parameter.rb +32 -29
  80. data/lib/puppet/parameter/package_options.rb +1 -1
  81. data/lib/puppet/parameter/path.rb +1 -1
  82. data/lib/puppet/parameter/value.rb +1 -1
  83. data/lib/puppet/parameter/value_collection.rb +7 -3
  84. data/lib/puppet/parser/ast.rb +3 -1
  85. data/lib/puppet/parser/ast/arithmetic_operator.rb +56 -12
  86. data/lib/puppet/parser/ast/astarray.rb +1 -1
  87. data/lib/puppet/parser/ast/block_expression.rb +41 -0
  88. data/lib/puppet/parser/ast/function.rb +13 -2
  89. data/lib/puppet/parser/ast/lambda.rb +107 -0
  90. data/lib/puppet/parser/ast/leaf.rb +1 -2
  91. data/lib/puppet/parser/ast/method_call.rb +77 -0
  92. data/lib/puppet/parser/ast/vardef.rb +7 -0
  93. data/lib/puppet/parser/compiler.rb +27 -16
  94. data/lib/puppet/parser/e_parser_adapter.rb +120 -0
  95. data/lib/puppet/parser/files.rb +7 -6
  96. data/lib/puppet/parser/functions.rb +10 -8
  97. data/lib/puppet/parser/functions/collect.rb +43 -0
  98. data/lib/puppet/parser/functions/each.rb +96 -0
  99. data/lib/puppet/parser/functions/foreach.rb +96 -0
  100. data/lib/puppet/parser/functions/fqdn_rand.rb +2 -2
  101. data/lib/puppet/parser/functions/hiera.rb +20 -2
  102. data/lib/puppet/parser/functions/hiera_array.rb +21 -2
  103. data/lib/puppet/parser/functions/hiera_hash.rb +23 -2
  104. data/lib/puppet/parser/functions/hiera_include.rb +33 -2
  105. data/lib/puppet/parser/functions/inline_template.rb +4 -4
  106. data/lib/puppet/parser/functions/reduce.rb +74 -0
  107. data/lib/puppet/parser/functions/reject.rb +46 -0
  108. data/lib/puppet/parser/functions/select.rb +46 -0
  109. data/lib/puppet/parser/functions/slice.rb +96 -0
  110. data/lib/puppet/parser/functions/template.rb +2 -2
  111. data/lib/puppet/parser/grammar.ra +7 -4
  112. data/lib/puppet/parser/lexer.rb +10 -0
  113. data/lib/puppet/parser/methods.rb +69 -0
  114. data/lib/puppet/parser/parser.rb +855 -808
  115. data/lib/puppet/parser/parser_factory.rb +62 -0
  116. data/lib/puppet/parser/parser_support.rb +8 -2
  117. data/lib/puppet/parser/scope.rb +153 -47
  118. data/lib/puppet/parser/templatewrapper.rb +28 -21
  119. data/lib/puppet/parser/type_loader.rb +3 -1
  120. data/lib/puppet/pops.rb +40 -0
  121. data/lib/puppet/pops/adaptable.rb +190 -0
  122. data/lib/puppet/pops/adapters.rb +65 -0
  123. data/lib/puppet/pops/containment.rb +37 -0
  124. data/lib/puppet/pops/issues.rb +258 -0
  125. data/lib/puppet/pops/label_provider.rb +71 -0
  126. data/lib/puppet/pops/model/ast_transformer.rb +636 -0
  127. data/lib/puppet/pops/model/ast_tree_dumper.rb +378 -0
  128. data/lib/puppet/pops/model/factory.rb +804 -0
  129. data/lib/puppet/pops/model/model.rb +567 -0
  130. data/lib/puppet/pops/model/model_label_provider.rb +75 -0
  131. data/lib/puppet/pops/model/model_tree_dumper.rb +352 -0
  132. data/lib/puppet/pops/model/tree_dumper.rb +59 -0
  133. data/lib/puppet/pops/parser/egrammar.ra +723 -0
  134. data/lib/puppet/pops/parser/eparser.rb +2300 -0
  135. data/lib/puppet/pops/parser/grammar.ra +746 -0
  136. data/lib/puppet/pops/parser/lexer.rb +842 -0
  137. data/lib/puppet/pops/parser/makefile +13 -0
  138. data/lib/puppet/pops/parser/parser_support.rb +203 -0
  139. data/lib/puppet/pops/patterns.rb +35 -0
  140. data/lib/puppet/pops/utils.rb +104 -0
  141. data/lib/puppet/pops/validation.rb +297 -0
  142. data/lib/puppet/pops/validation/checker3_1.rb +551 -0
  143. data/lib/puppet/pops/validation/validator_factory_3_1.rb +41 -0
  144. data/lib/puppet/pops/visitable.rb +6 -0
  145. data/lib/puppet/pops/visitor.rb +50 -0
  146. data/lib/puppet/property.rb +37 -28
  147. data/lib/puppet/property/ensure.rb +2 -2
  148. data/lib/puppet/property/ordered_list.rb +1 -1
  149. data/lib/puppet/provider.rb +26 -30
  150. data/lib/puppet/provider/aixobject.rb +45 -44
  151. data/lib/puppet/provider/augeas/augeas.rb +0 -1
  152. data/lib/puppet/provider/confiner.rb +1 -1
  153. data/lib/puppet/provider/cron/crontab.rb +107 -67
  154. data/lib/puppet/provider/group/groupadd.rb +59 -3
  155. data/lib/puppet/provider/interface/cisco.rb +4 -4
  156. data/lib/puppet/provider/mount/parsed.rb +1 -1
  157. data/lib/puppet/provider/nameservice.rb +22 -6
  158. data/lib/puppet/provider/nameservice/pw.rb +1 -1
  159. data/lib/puppet/provider/package/aix.rb +28 -4
  160. data/lib/puppet/provider/package/gem.rb +0 -2
  161. data/lib/puppet/provider/package/macports.rb +1 -1
  162. data/lib/puppet/provider/package/nim.rb +249 -4
  163. data/lib/puppet/provider/package/opkg.rb +77 -0
  164. data/lib/puppet/provider/package/pacman.rb +2 -2
  165. data/lib/puppet/provider/package/rpm.rb +30 -16
  166. data/lib/puppet/provider/package/yum.rb +3 -3
  167. data/lib/puppet/provider/parsedfile.rb +80 -3
  168. data/lib/puppet/provider/selmodule/semodule.rb +2 -2
  169. data/lib/puppet/provider/service/debian.rb +0 -4
  170. data/lib/puppet/provider/service/freebsd.rb +2 -2
  171. data/lib/puppet/provider/service/gentoo.rb +0 -9
  172. data/lib/puppet/provider/service/init.rb +27 -2
  173. data/lib/puppet/provider/service/launchd.rb +1 -1
  174. data/lib/puppet/provider/service/openwrt.rb +36 -0
  175. data/lib/puppet/provider/service/redhat.rb +0 -9
  176. data/lib/puppet/provider/service/src.rb +38 -4
  177. data/lib/puppet/provider/service/systemd.rb +2 -2
  178. data/lib/puppet/provider/service/upstart.rb +1 -8
  179. data/lib/puppet/provider/user/aix.rb +4 -10
  180. data/lib/puppet/provider/user/pw.rb +6 -10
  181. data/lib/puppet/provider/user/useradd.rb +129 -31
  182. data/lib/puppet/provider/vlan/cisco.rb +4 -4
  183. data/lib/puppet/reference/function.rb +2 -2
  184. data/lib/puppet/reference/indirection.rb +46 -5
  185. data/lib/puppet/reference/metaparameter.rb +2 -2
  186. data/lib/puppet/reports.rb +5 -5
  187. data/lib/puppet/reports/rrdgraph.rb +4 -4
  188. data/lib/puppet/reports/tagmail.rb +1 -1
  189. data/lib/puppet/resource.rb +1 -1
  190. data/lib/puppet/resource/type.rb +13 -11
  191. data/lib/puppet/scheduler.rb +16 -0
  192. data/lib/puppet/scheduler/job.rb +53 -0
  193. data/lib/puppet/scheduler/scheduler.rb +45 -0
  194. data/lib/puppet/scheduler/splay_job.rb +32 -0
  195. data/lib/puppet/scheduler/timer.rb +13 -0
  196. data/lib/puppet/settings/base_setting.rb +1 -1
  197. data/lib/puppet/simple_graph.rb +4 -4
  198. data/lib/puppet/ssl/base.rb +12 -2
  199. data/lib/puppet/ssl/certificate.rb +4 -1
  200. data/lib/puppet/ssl/certificate_request.rb +4 -1
  201. data/lib/puppet/ssl/certificate_revocation_list.rb +4 -1
  202. data/lib/puppet/ssl/configuration.rb +32 -0
  203. data/lib/puppet/ssl/host.rb +18 -21
  204. data/lib/puppet/ssl/key.rb +4 -1
  205. data/lib/puppet/ssl/validator.rb +116 -0
  206. data/lib/puppet/transaction.rb +1 -1
  207. data/lib/puppet/transaction/event.rb +3 -10
  208. data/lib/puppet/transaction/event_manager.rb +8 -1
  209. data/lib/puppet/transaction/report.rb +17 -16
  210. data/lib/puppet/type.rb +77 -69
  211. data/lib/puppet/type/cron.rb +20 -8
  212. data/lib/puppet/type/exec.rb +9 -3
  213. data/lib/puppet/type/file.rb +95 -21
  214. data/lib/puppet/type/file/content.rb +1 -1
  215. data/lib/puppet/type/file/mode.rb +7 -1
  216. data/lib/puppet/type/file/source.rb +2 -2
  217. data/lib/puppet/type/group.rb +11 -0
  218. data/lib/puppet/type/scheduled_task.rb +5 -1
  219. data/lib/puppet/type/service.rb +1 -1
  220. data/lib/puppet/type/ssh_authorized_key.rb +2 -2
  221. data/lib/puppet/type/user.rb +24 -6
  222. data/lib/puppet/util.rb +12 -2
  223. data/lib/puppet/util/classgen.rb +4 -4
  224. data/lib/puppet/util/colors.rb +55 -0
  225. data/lib/puppet/util/command_line/trollop.rb +4 -4
  226. data/lib/puppet/util/errors.rb +39 -3
  227. data/lib/puppet/util/fileparsing.rb +5 -0
  228. data/lib/puppet/util/filetype.rb +11 -9
  229. data/lib/puppet/util/instrumentation/instrumentable.rb +2 -2
  230. data/lib/puppet/util/libuser.conf +15 -0
  231. data/lib/puppet/util/libuser.rb +12 -0
  232. data/lib/puppet/util/monkey_patches.rb +48 -0
  233. data/lib/puppet/util/network_device.rb +1 -1
  234. data/lib/puppet/util/network_device/base.rb +2 -2
  235. data/lib/puppet/util/network_device/cisco/device.rb +29 -19
  236. data/lib/puppet/util/network_device/config.rb +5 -2
  237. data/lib/puppet/util/network_device/ipcalc.rb +1 -1
  238. data/lib/puppet/util/network_device/transport/ssh.rb +4 -3
  239. data/lib/puppet/util/network_device/transport/telnet.rb +4 -2
  240. data/lib/puppet/util/plugins.rb +4 -4
  241. data/lib/puppet/util/posix.rb +1 -1
  242. data/lib/puppet/util/profiler.rb +28 -0
  243. data/lib/puppet/util/profiler/logging.rb +47 -0
  244. data/lib/puppet/util/profiler/none.rb +8 -0
  245. data/lib/puppet/util/profiler/object_counts.rb +17 -0
  246. data/lib/puppet/util/profiler/wall_clock.rb +34 -0
  247. data/lib/puppet/util/provider_features.rb +1 -1
  248. data/lib/puppet/util/rdoc/parser.rb +5 -5
  249. data/lib/puppet/util/ssl.rb +38 -0
  250. data/lib/puppet/util/subclass_loader.rb +1 -5
  251. data/lib/puppet/util/windows.rb +1 -0
  252. data/lib/puppet/util/windows/process.rb +3 -0
  253. data/lib/puppet/util/windows/root_certs.rb +86 -0
  254. data/lib/puppet/util/windows/security.rb +1 -0
  255. data/lib/puppet/version.rb +1 -1
  256. data/spec/fixtures/integration/provider/cron/crontab/create_normal_entry +19 -0
  257. data/spec/fixtures/integration/provider/cron/crontab/create_special_entry +18 -0
  258. data/spec/fixtures/integration/provider/cron/crontab/crontab_user1 +15 -0
  259. data/spec/fixtures/integration/provider/cron/crontab/crontab_user2 +4 -0
  260. data/spec/fixtures/integration/provider/cron/crontab/modify_entry +13 -0
  261. data/spec/fixtures/integration/provider/cron/crontab/moved_cronjob_input1 +15 -0
  262. data/spec/fixtures/integration/provider/cron/crontab/moved_cronjob_input2 +6 -0
  263. data/spec/fixtures/integration/provider/cron/crontab/remove_named_resource +12 -0
  264. data/spec/fixtures/integration/provider/cron/crontab/remove_unnamed_resource +14 -0
  265. data/spec/fixtures/unit/pops/parser/lexer/aliastest.pp +16 -0
  266. data/spec/fixtures/unit/pops/parser/lexer/append.pp +11 -0
  267. data/spec/fixtures/unit/pops/parser/lexer/argumentdefaults.pp +14 -0
  268. data/spec/fixtures/unit/pops/parser/lexer/arithmetic_expression.pp +8 -0
  269. data/spec/fixtures/unit/pops/parser/lexer/arraytrailingcomma.pp +3 -0
  270. data/spec/fixtures/unit/pops/parser/lexer/casestatement.pp +65 -0
  271. data/spec/fixtures/unit/pops/parser/lexer/classheirarchy.pp +15 -0
  272. data/spec/fixtures/unit/pops/parser/lexer/classincludes.pp +17 -0
  273. data/spec/fixtures/unit/pops/parser/lexer/classpathtest.pp +11 -0
  274. data/spec/fixtures/unit/pops/parser/lexer/collection.pp +10 -0
  275. data/spec/fixtures/unit/pops/parser/lexer/collection_override.pp +8 -0
  276. data/spec/fixtures/unit/pops/parser/lexer/collection_within_virtual_definitions.pp +20 -0
  277. data/spec/fixtures/unit/pops/parser/lexer/componentmetaparams.pp +11 -0
  278. data/spec/fixtures/unit/pops/parser/lexer/componentrequire.pp +8 -0
  279. data/spec/fixtures/unit/pops/parser/lexer/deepclassheirarchy.pp +23 -0
  280. data/spec/fixtures/unit/pops/parser/lexer/defineoverrides.pp +17 -0
  281. data/spec/fixtures/unit/pops/parser/lexer/emptyclass.pp +9 -0
  282. data/spec/fixtures/unit/pops/parser/lexer/emptyexec.pp +3 -0
  283. data/spec/fixtures/unit/pops/parser/lexer/emptyifelse.pp +9 -0
  284. data/spec/fixtures/unit/pops/parser/lexer/falsevalues.pp +3 -0
  285. data/spec/fixtures/unit/pops/parser/lexer/filecreate.pp +11 -0
  286. data/spec/fixtures/unit/pops/parser/lexer/fqdefinition.pp +5 -0
  287. data/spec/fixtures/unit/pops/parser/lexer/fqparents.pp +11 -0
  288. data/spec/fixtures/unit/pops/parser/lexer/funccomma.pp +5 -0
  289. data/spec/fixtures/unit/pops/parser/lexer/hash.pp +33 -0
  290. data/spec/fixtures/unit/pops/parser/lexer/ifexpression.pp +12 -0
  291. data/spec/fixtures/unit/pops/parser/lexer/implicititeration.pp +15 -0
  292. data/spec/fixtures/unit/pops/parser/lexer/multilinecomments.pp +10 -0
  293. data/spec/fixtures/unit/pops/parser/lexer/multipleclass.pp +9 -0
  294. data/spec/fixtures/unit/pops/parser/lexer/multipleinstances.pp +7 -0
  295. data/spec/fixtures/unit/pops/parser/lexer/multisubs.pp +13 -0
  296. data/spec/fixtures/unit/pops/parser/lexer/namevartest.pp +9 -0
  297. data/spec/fixtures/unit/pops/parser/lexer/scopetest.pp +13 -0
  298. data/spec/fixtures/unit/pops/parser/lexer/selectorvalues.pp +49 -0
  299. data/spec/fixtures/unit/pops/parser/lexer/simpledefaults.pp +5 -0
  300. data/spec/fixtures/unit/pops/parser/lexer/simpleselector.pp +38 -0
  301. data/spec/fixtures/unit/pops/parser/lexer/singleary.pp +19 -0
  302. data/spec/fixtures/unit/pops/parser/lexer/singlequote.pp +11 -0
  303. data/spec/fixtures/unit/pops/parser/lexer/singleselector.pp +22 -0
  304. data/spec/fixtures/unit/pops/parser/lexer/subclass_name_duplication.pp +11 -0
  305. data/spec/fixtures/unit/pops/parser/lexer/tag.pp +9 -0
  306. data/spec/fixtures/unit/pops/parser/lexer/tagged.pp +35 -0
  307. data/spec/fixtures/unit/pops/parser/lexer/virtualresources.pp +14 -0
  308. data/spec/fixtures/unit/provider/cron/crontab/single_line.yaml +4 -4
  309. data/spec/fixtures/unit/provider/cron/crontab/vixie_header.txt +3 -0
  310. data/spec/fixtures/unit/provider/cron/parsed/managed +6 -0
  311. data/spec/fixtures/unit/provider/cron/parsed/simple +9 -0
  312. data/spec/fixtures/unit/provider/parsedfile/simple.txt +4 -0
  313. data/spec/fixtures/unit/provider/service/systemd/list_units +18 -0
  314. data/spec/integration/parser/collector_spec.rb +1 -1
  315. data/spec/integration/parser/compiler_spec.rb +252 -227
  316. data/spec/integration/parser/parser_spec.rb +171 -53
  317. data/spec/integration/parser/scope_spec.rb +1 -1
  318. data/spec/integration/provider/cron/crontab_spec.rb +187 -0
  319. data/spec/integration/provider/service/systemd_spec.rb +20 -0
  320. data/spec/integration/type/file_spec.rb +21 -21
  321. data/spec/integration/type/package_spec.rb +1 -1
  322. data/spec/lib/puppet_spec/database.rb +2 -5
  323. data/spec/spec_helper.rb +6 -1
  324. data/spec/unit/application/apply_spec.rb +16 -1
  325. data/spec/unit/application/describe_spec.rb +1 -1
  326. data/spec/unit/application/doc_spec.rb +55 -32
  327. data/spec/unit/application/kick_spec.rb +8 -6
  328. data/spec/unit/application/master_spec.rb +4 -4
  329. data/spec/unit/daemon_spec.rb +1 -1
  330. data/spec/unit/forge/errors_spec.rb +40 -0
  331. data/spec/unit/forge/repository_spec.rb +11 -1
  332. data/spec/unit/forge_spec.rb +13 -3
  333. data/spec/unit/hiera/backend/puppet_backend_spec.rb +1 -0
  334. data/spec/unit/hiera/scope_spec.rb +48 -25
  335. data/spec/unit/indirector/catalog/active_record_spec.rb +6 -3
  336. data/spec/unit/indirector/catalog/compiler_spec.rb +3 -28
  337. data/spec/unit/indirector/catalog/static_compiler_spec.rb +1 -1
  338. data/spec/unit/indirector/facts/inventory_active_record_spec.rb +154 -150
  339. data/spec/unit/indirector/indirection_spec.rb +5 -0
  340. data/spec/unit/indirector/resource/active_record_spec.rb +5 -22
  341. data/spec/unit/indirector_spec.rb +7 -1
  342. data/spec/unit/interface/action_builder_spec.rb +1 -1
  343. data/spec/unit/interface/action_manager_spec.rb +0 -2
  344. data/spec/unit/interface/action_spec.rb +1 -1
  345. data/spec/unit/interface/documentation_spec.rb +0 -2
  346. data/spec/unit/interface/face_collection_spec.rb +1 -1
  347. data/spec/unit/interface/option_builder_spec.rb +1 -1
  348. data/spec/unit/interface/option_spec.rb +0 -1
  349. data/spec/unit/module_spec.rb +17 -19
  350. data/spec/unit/module_tool/application_spec.rb +1 -3
  351. data/spec/unit/module_tool/applications/builder_spec.rb +38 -0
  352. data/spec/unit/module_tool/applications/checksummer_spec.rb +134 -0
  353. data/spec/unit/module_tool/applications/installer_spec.rb +71 -91
  354. data/spec/unit/module_tool/applications/searcher_spec.rb +1 -3
  355. data/spec/unit/module_tool/applications/uninstaller_spec.rb +18 -26
  356. data/spec/unit/module_tool/applications/unpacker_spec.rb +19 -52
  357. data/spec/unit/module_tool/tar/gnu_spec.rb +19 -0
  358. data/spec/unit/module_tool/tar/mini_spec.rb +59 -0
  359. data/spec/unit/module_tool/tar/solaris_spec.rb +19 -0
  360. data/spec/unit/network/http/connection_spec.rb +17 -2
  361. data/spec/unit/network/http/handler_spec.rb +195 -167
  362. data/spec/unit/network/http/rack/rest_spec.rb +26 -4
  363. data/spec/unit/network/http/webrick/rest_spec.rb +28 -1
  364. data/spec/unit/network/http/webrick_spec.rb +12 -3
  365. data/spec/unit/node/environment_spec.rb +421 -404
  366. data/spec/unit/parser/ast/arithmetic_operator_spec.rb +98 -2
  367. data/spec/unit/parser/collector_spec.rb +4 -4
  368. data/spec/unit/parser/compiler_spec.rb +13 -13
  369. data/spec/unit/parser/eparser_adapter_spec.rb +407 -0
  370. data/spec/unit/parser/functions/extlookup_spec.rb +20 -17
  371. data/spec/unit/parser/functions/fqdn_rand_spec.rb +5 -0
  372. data/spec/unit/parser/functions/hiera_include_spec.rb +0 -2
  373. data/spec/unit/parser/functions/hiera_spec.rb +0 -2
  374. data/spec/unit/parser/functions_spec.rb +27 -15
  375. data/spec/unit/parser/methods/collect_spec.rb +110 -0
  376. data/spec/unit/parser/methods/each_spec.rb +91 -0
  377. data/spec/unit/parser/methods/foreach_spec.rb +91 -0
  378. data/spec/unit/parser/methods/reduce_spec.rb +67 -0
  379. data/spec/unit/parser/methods/reject_spec.rb +73 -0
  380. data/spec/unit/parser/methods/select_spec.rb +79 -0
  381. data/spec/unit/parser/methods/shared.rb +61 -0
  382. data/spec/unit/parser/methods/slice_spec.rb +97 -0
  383. data/spec/unit/parser/parser_spec.rb +2 -2
  384. data/spec/unit/parser/scope_spec.rb +39 -16
  385. data/spec/unit/parser/templatewrapper_spec.rb +6 -5
  386. data/spec/unit/parser/type_loader_spec.rb +191 -165
  387. data/spec/unit/pops/adaptable_spec.rb +143 -0
  388. data/spec/unit/pops/containment_spec.rb +25 -0
  389. data/spec/unit/pops/factory_rspec_helper.rb +77 -0
  390. data/spec/unit/pops/factory_spec.rb +329 -0
  391. data/spec/unit/pops/issues_spec.rb +26 -0
  392. data/spec/unit/pops/label_provider_spec.rb +42 -0
  393. data/spec/unit/pops/model/ast_transformer_spec.rb +65 -0
  394. data/spec/unit/pops/model/model_spec.rb +37 -0
  395. data/spec/unit/pops/parser/lexer_spec.rb +884 -0
  396. data/spec/unit/pops/parser/parse_basic_expressions_spec.rb +248 -0
  397. data/spec/unit/pops/parser/parse_calls_spec.rb +93 -0
  398. data/spec/unit/pops/parser/parse_conditionals_spec.rb +159 -0
  399. data/spec/unit/pops/parser/parse_containers_spec.rb +175 -0
  400. data/spec/unit/pops/parser/parse_resource_spec.rb +228 -0
  401. data/spec/unit/pops/parser/parser_rspec_helper.rb +11 -0
  402. data/spec/unit/pops/parser/parser_spec.rb +15 -0
  403. data/spec/unit/pops/parser/rgen_sanitycheck_spec.rb +16 -0
  404. data/spec/unit/pops/transformer/transform_basic_expressions_spec.rb +243 -0
  405. data/spec/unit/pops/transformer/transform_calls_spec.rb +80 -0
  406. data/spec/unit/pops/transformer/transform_conditionals_spec.rb +132 -0
  407. data/spec/unit/pops/transformer/transform_containers_spec.rb +182 -0
  408. data/spec/unit/pops/transformer/transform_resource_spec.rb +185 -0
  409. data/spec/unit/pops/transformer/transformer_rspec_helper.rb +27 -0
  410. data/spec/unit/pops/visitor_spec.rb +94 -0
  411. data/spec/unit/property_spec.rb +11 -0
  412. data/spec/unit/provider/augeas/augeas_spec.rb +3 -0
  413. data/spec/unit/provider/cron/crontab_spec.rb +97 -7
  414. data/spec/unit/provider/cron/parsed_spec.rb +325 -0
  415. data/spec/unit/provider/exec/posix_spec.rb +1 -1
  416. data/spec/unit/provider/group/groupadd_spec.rb +33 -3
  417. data/spec/unit/provider/group/pw_spec.rb +5 -5
  418. data/spec/unit/provider/nameservice_spec.rb +304 -0
  419. data/spec/unit/provider/package/aix_spec.rb +53 -11
  420. data/spec/unit/provider/package/aptrpm_spec.rb +6 -0
  421. data/spec/unit/provider/package/gem_spec.rb +6 -11
  422. data/spec/unit/provider/package/nim_spec.rb +216 -7
  423. data/spec/unit/provider/package/opkg_spec.rb +180 -0
  424. data/spec/unit/provider/package/rpm_spec.rb +149 -3
  425. data/spec/unit/provider/package/yum_spec.rb +6 -5
  426. data/spec/unit/provider/parsedfile_spec.rb +122 -28
  427. data/spec/unit/provider/service/freebsd_spec.rb +18 -0
  428. data/spec/unit/provider/service/init_spec.rb +108 -87
  429. data/spec/unit/provider/service/launchd_spec.rb +2 -2
  430. data/spec/unit/provider/service/openwrt_spec.rb +109 -0
  431. data/spec/unit/provider/service/src_spec.rb +117 -41
  432. data/spec/unit/provider/service/systemd_spec.rb +125 -17
  433. data/spec/unit/provider/service/upstart_spec.rb +1 -1
  434. data/spec/unit/provider/user/aix_spec.rb +42 -0
  435. data/spec/unit/provider/user/directoryservice_spec.rb +1 -0
  436. data/spec/unit/provider/user/pw_spec.rb +24 -12
  437. data/spec/unit/provider/user/user_role_add_spec.rb +1 -1
  438. data/spec/unit/provider/user/useradd_spec.rb +179 -15
  439. data/spec/unit/resource/type_spec.rb +3 -3
  440. data/spec/unit/scheduler/job_spec.rb +79 -0
  441. data/spec/unit/scheduler/scheduler_spec.rb +129 -0
  442. data/spec/unit/scheduler/splay_job_spec.rb +35 -0
  443. data/spec/unit/ssl/base_spec.rb +3 -9
  444. data/spec/unit/ssl/certificate_authority_spec.rb +1 -0
  445. data/spec/unit/ssl/certificate_request_spec.rb +3 -1
  446. data/spec/unit/ssl/certificate_spec.rb +3 -1
  447. data/spec/unit/ssl/configuration_spec.rb +74 -0
  448. data/spec/unit/ssl/host_spec.rb +28 -7
  449. data/spec/unit/ssl/validator_spec.rb +311 -0
  450. data/spec/unit/transaction/event_manager_spec.rb +49 -0
  451. data/spec/unit/transaction/event_spec.rb +20 -5
  452. data/spec/unit/transaction/report_spec.rb +8 -0
  453. data/spec/unit/type/cron_spec.rb +9 -0
  454. data/spec/unit/type/exec_spec.rb +11 -0
  455. data/spec/unit/type/file/content_spec.rb +20 -20
  456. data/spec/unit/type/file/mode_spec.rb +6 -0
  457. data/spec/unit/type/file/source_spec.rb +9 -7
  458. data/spec/unit/type/file_spec.rb +22 -3
  459. data/spec/unit/type/service_spec.rb +34 -21
  460. data/spec/unit/type_spec.rb +46 -1
  461. data/spec/unit/util/backups_spec.rb +2 -2
  462. data/spec/unit/util/execution_spec.rb +4 -1
  463. data/spec/unit/util/filetype_spec.rb +6 -0
  464. data/spec/unit/util/monkey_patches_spec.rb +18 -0
  465. data/spec/unit/util/network_device/cisco/device_spec.rb +37 -0
  466. data/spec/unit/util/network_device/config_spec.rb +14 -0
  467. data/spec/unit/util/network_device_spec.rb +3 -3
  468. data/spec/unit/util/profiler/logging_spec.rb +81 -0
  469. data/spec/unit/util/profiler/none_spec.rb +12 -0
  470. data/spec/unit/util/profiler/object_counts_spec.rb +14 -0
  471. data/spec/unit/util/profiler/wall_clock_spec.rb +13 -0
  472. data/spec/unit/util/pson_spec.rb +5 -0
  473. data/spec/unit/util/ssl_spec.rb +51 -0
  474. data/spec/unit/util/windows/root_certs_spec.rb +15 -0
  475. data/spec/unit/util_spec.rb +28 -0
  476. metadata +2593 -2307
  477. data/spec/unit/module_tool/applications/application_spec.rb +0 -19
@@ -12,6 +12,8 @@ class Puppet::Application::Apply < Puppet::Application
12
12
  option("--use-nodes")
13
13
  option("--detailed-exitcodes")
14
14
 
15
+ option("--write-catalog-summary")
16
+
15
17
  option("--catalog catalog", "-c catalog") do |arg|
16
18
  options[:catalog] = arg
17
19
  end
@@ -45,7 +47,7 @@ USAGE
45
47
  -----
46
48
  puppet apply [-h|--help] [-V|--version] [-d|--debug] [-v|--verbose]
47
49
  [-e|--execute] [--detailed-exitcodes] [-l|--logdest <file>] [--noop]
48
- [--catalog <catalog>] <file>
50
+ [--catalog <catalog>] [--write-catalog-summary] <file>
49
51
 
50
52
 
51
53
  DESCRIPTION
@@ -113,6 +115,9 @@ configuration options can also be generated by running puppet with
113
115
  Apply a JSON catalog (such as one generated with 'puppet master --compile'). You can
114
116
  either specify a JSON file or pipe in JSON from standard input.
115
117
 
118
+ * --write-catalog-summary
119
+ After compiling the catalog saves the resource list and classes list to the node
120
+ in the state directory named classes.txt and resources.txt
116
121
 
117
122
  EXAMPLE
118
123
  -------
@@ -210,6 +215,11 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
210
215
 
211
216
  catalog.retrieval_duration = Time.now - starttime
212
217
 
218
+ if options[:write_catalog_summary]
219
+ catalog.write_class_file
220
+ catalog.write_resource_file
221
+ end
222
+
213
223
  exit_status = apply_catalog(catalog)
214
224
 
215
225
  if not exit_status
@@ -70,7 +70,7 @@ class TypeDoc
70
70
  }.each do |name|
71
71
  type = @types[name]
72
72
  s = type.doc.gsub(/\s+/, " ")
73
- n = s.index(".")
73
+ n = s.index(". ")
74
74
  if n.nil?
75
75
  s = ".. no documentation .."
76
76
  elsif n > 45
@@ -235,6 +235,8 @@ HELP
235
235
  else
236
236
  setup_reference
237
237
  end
238
+
239
+ setup_logging
238
240
  end
239
241
 
240
242
  def setup_reference
@@ -261,16 +263,18 @@ HELP
261
263
  Puppet.settings.handlearg(option[:opt], option[:arg])
262
264
  end
263
265
  end
266
+ end
264
267
 
265
- # Handle the logging settings.
266
- if options[:debug] or options[:verbose]
267
- if options[:debug]
268
- Puppet::Util::Log.level = :debug
269
- else
270
- Puppet::Util::Log.level = :info
271
- end
272
-
273
- Puppet::Util::Log.newdestination(:console)
268
+ def setup_logging
269
+ # Handle the logging settings.
270
+ if options[:debug]
271
+ Puppet::Util::Log.level = :debug
272
+ elsif options[:verbose]
273
+ Puppet::Util::Log.level = :info
274
+ else
275
+ Puppet::Util::Log.level = :warning
274
276
  end
277
+
278
+ Puppet::Util::Log.newdestination(:console)
275
279
  end
276
280
  end
@@ -180,6 +180,5 @@ Copyright (c) 2011 Puppet Labs, LLC Licensed under the Apache 2.0 License
180
180
  exit(1)
181
181
  end
182
182
  end
183
-
184
183
  end
185
184
 
@@ -9,6 +9,7 @@ class Puppet::Application::Kick < Puppet::Application
9
9
  option("--debug","-d")
10
10
  option("--ping","-P")
11
11
  option("--test")
12
+ option("--ignoreschedules")
12
13
 
13
14
  option("--host HOST") do |arg|
14
15
  @hosts << arg
@@ -57,22 +57,26 @@ executable is not used.
57
57
 
58
58
  OPTIONS
59
59
  -------
60
- Note that any configuration parameter that's valid in the configuration
61
- file is also a valid long argument. For example, 'ssldir' is a valid
62
- configuration parameter, so you can specify '--ssldir <directory>' as an
63
- argument.
60
+
61
+ Note that any Puppet setting that's valid in the configuration file is also a
62
+ valid long argument. For example, 'server' is a valid setting, so you can
63
+ specify '--server <servername>' as an argument. Boolean settings translate into
64
+ '--setting' and '--no-setting' pairs.
64
65
 
65
66
  See the configuration file documentation at
66
67
  http://docs.puppetlabs.com/references/stable/configuration.html for the
67
- full list of acceptable parameters. A commented list of all
68
- configuration options can also be generated by running puppet master
69
- with '--genconfig'.
68
+ full list of acceptable settings. A commented list of all settings can also be
69
+ generated by running puppet master with '--genconfig'.
70
70
 
71
71
  * --daemonize:
72
72
  Send the process into the background. This is the default.
73
+ (This is a Puppet setting, and can go in puppet.conf. Note the special 'no-'
74
+ prefix for boolean settings on the command line.)
73
75
 
74
76
  * --no-daemonize:
75
77
  Do not send the process into the background.
78
+ (This is a Puppet setting, and can go in puppet.conf. Note the special 'no-'
79
+ prefix for boolean settings on the command line.)
76
80
 
77
81
  * --debug:
78
82
  Enable full debugging.
@@ -85,6 +89,10 @@ with '--genconfig'.
85
89
  file. Defaults to sending messages to syslog, or the console if
86
90
  debugging or verbosity is enabled.
87
91
 
92
+ * --masterport:
93
+ The port on which to listen for traffic.
94
+ (This is a Puppet setting, and can go in puppet.conf.)
95
+
88
96
  * --verbose:
89
97
  Enable verbosity.
90
98
 
@@ -165,7 +173,7 @@ Copyright (c) 2012 Puppet Labs, LLC Licensed under the Apache 2.0 License
165
173
  raise "Could not compile catalog for #{options[:node]}"
166
174
  end
167
175
 
168
- jj catalog.to_resource
176
+ puts PSON::pretty_generate(catalog.to_resource, :allow_nan => true, :max_nesting => false)
169
177
  rescue => detail
170
178
  $stderr.puts detail
171
179
  exit(30)
data/lib/puppet/daemon.rb CHANGED
@@ -1,6 +1,7 @@
1
1
  require 'puppet'
2
2
  require 'puppet/util/pidlock'
3
3
  require 'puppet/application'
4
+ require 'puppet/scheduler'
4
5
 
5
6
  # A module that handles operations common to all daemons. This is included
6
7
  # into the Server and Client base classes.
@@ -79,7 +80,7 @@ class Puppet::Daemon
79
80
  return
80
81
  end
81
82
 
82
- agent.run
83
+ agent.run({:splay => false})
83
84
  end
84
85
 
85
86
  # Remove the pid file for our daemon.
@@ -146,73 +147,27 @@ class Puppet::Daemon
146
147
  end
147
148
 
148
149
  def run_event_loop
149
- # Now, we loop waiting for either the configuration file to change, or the
150
- # next agent run to be due. Fun times.
151
- #
152
- # We want to trigger the reparse if 15 seconds passed since the previous
153
- # wakeup, and the agent run if Puppet[:runinterval] seconds have passed
154
- # since the previous wakeup.
155
- #
156
- # We always want to run the agent on startup, so it was always before now.
157
- # Because 0 means "continuously run", `to_i` does the right thing when the
158
- # input is strange or badly formed by returning 0. Integer will raise,
159
- # which we don't want, and we want to protect against -1 or below.
160
- next_agent_run = 0
161
- agent_run_interval = [Puppet[:runinterval], 0].max
162
-
163
- # We may not want to reparse; that can be disable. Fun times.
164
- next_reparse = 0
165
- reparse_interval = Puppet[:filetimeout]
166
-
167
- loop do
168
- now = Time.now.to_i
169
-
170
- # We set a default wakeup of "one hour from now", which will
171
- # recheck everything at a minimum every hour. Just in case something in
172
- # the math messes up or something; it should be inexpensive enough to
173
- # wake once an hour, then go back to sleep after doing nothing, if
174
- # someone only wants listen mode.
175
- next_event = now + 60 * 60
176
-
177
- # Handle reparsing of configuration files, if desired and required.
178
- # `reparse` will just check if the action is required, and would be
179
- # better named `reparse_if_changed` instead.
180
- if reparse_interval > 0 and now >= next_reparse
181
- Puppet.settings.reparse_config_files
182
-
183
- # The time to the next reparse might have changed, so recalculate
184
- # now. That way we react dynamically to reconfiguration.
185
- reparse_interval = Puppet[:filetimeout]
186
-
187
- # Set up the next reparse check based on the new reparse_interval.
188
- if reparse_interval > 0
189
- next_reparse = now + reparse_interval
190
- next_event > next_reparse and next_event = next_reparse
191
- end
192
-
193
- # We should also recalculate the agent run interval, and adjust the
194
- # next time it is scheduled to run, just in case. In the event that
195
- # we made no change the result will be a zero second adjustment.
196
- new_run_interval = [Puppet[:runinterval], 0].max
197
- next_agent_run += agent_run_interval - new_run_interval
198
- agent_run_interval = new_run_interval
150
+ agent_run = Puppet::Scheduler.create_job(Puppet[:runinterval], Puppet[:splay], Puppet[:splaylimit]) do
151
+ # Splay for the daemon is handled in the scheduler
152
+ agent.run(:splay => false)
153
+ end
154
+
155
+ reparse_run = Puppet::Scheduler.create_job(Puppet[:filetimeout]) do
156
+ Puppet.settings.reparse_config_files
157
+ agent_run.run_interval = Puppet[:runinterval]
158
+ if Puppet[:filetimeout] == 0
159
+ reparse_run.disable
160
+ else
161
+ reparse_run.run_interval = Puppet[:filetimeout]
199
162
  end
163
+ end
200
164
 
201
- # Handle triggering another agent run. This will block the next check
202
- # for configuration reparsing, which is a desired and deliberate
203
- # behaviour. You should not change that. --daniel 2012-02-21
204
- if agent and now >= next_agent_run
205
- agent.run
165
+ reparse_run.disable if Puppet[:filetimeout] == 0
166
+ agent_run.disable unless agent
206
167
 
207
- # Set up the next agent run time
208
- next_agent_run = now + agent_run_interval
209
- next_event > next_agent_run and next_event = next_agent_run
210
- end
168
+ scheduler = Puppet::Scheduler::Scheduler.new([reparse_run, agent_run])
211
169
 
212
- # Finally, an interruptable able sleep until the next scheduled event.
213
- how_long = next_event - now
214
- how_long > 0 and select([], [], [], how_long)
215
- end
170
+ scheduler.run_loop
216
171
  end
217
172
  end
218
173
 
@@ -49,6 +49,11 @@ module Puppet
49
49
  :type => :boolean,
50
50
  :desc => "Whether to print stack traces on some errors",
51
51
  },
52
+ :profile => {
53
+ :default => false,
54
+ :type => :boolean,
55
+ :desc => "Whether to enable experimental performance profiling",
56
+ },
52
57
  :autoflush => {
53
58
  :default => true,
54
59
  :type => :boolean,
@@ -214,7 +219,7 @@ module Puppet
214
219
  :node_cache_terminus => {
215
220
  :type => :terminus,
216
221
  :default => nil,
217
- :desc => "How to store cached nodes.
222
+ :desc => "How to store cached nodes.
218
223
  Valid values are (none), 'json', 'yaml' or write only yaml ('write_only_yaml').
219
224
  The master application defaults to 'write_only_yaml', all others to none.",
220
225
  },
@@ -225,7 +230,7 @@ module Puppet
225
230
  },
226
231
  :hiera_config => {
227
232
  :default => "$confdir/hiera.yaml",
228
- :desc => "The hiera configuration file",
233
+ :desc => "The hiera configuration file. Puppet only reads this file on startup, so you must restart the puppet master every time you edit it.",
229
234
  :type => :file,
230
235
  },
231
236
  :catalog_terminus => {
@@ -772,7 +777,9 @@ EOT
772
777
  },
773
778
  :masterport => {
774
779
  :default => 8140,
775
- :desc => "Which port puppet master listens on.",
780
+ :desc => "The port for puppet master traffic. For puppet master,
781
+ this is the port to listen on; for puppet agent, this is the port
782
+ to make requests on. Both applications use this setting to get the port.",
776
783
  },
777
784
  :node_name => {
778
785
  :default => "cert",
@@ -813,13 +820,26 @@ EOT
813
820
  :default => "HTTP_X_CLIENT_DN",
814
821
  :desc => "The header containing an authenticated client's SSL DN.
815
822
  This header must be set by the proxy to the authenticated client's SSL
816
- DN (e.g., `/CN=puppet.puppetlabs.com`).",
823
+ DN (e.g., `/CN=puppet.puppetlabs.com`). Puppet will parse out the Common
824
+ Name (CN) from the Distinguished Name (DN) and use the value of the CN
825
+ field for authorization.
826
+
827
+ Note that the name of the HTTP header gets munged by the web server
828
+ common gateway inteface: an `HTTP_` prefix is added, dashes are converted
829
+ to underscores, and all letters are uppercased. Thus, to use the
830
+ `X-Client-DN` header, this setting should be `HTTP_X_CLIENT_DN`.",
817
831
  },
818
832
  :ssl_client_verify_header => {
819
833
  :default => "HTTP_X_CLIENT_VERIFY",
820
834
  :desc => "The header containing the status message of the client
821
835
  verification. This header must be set by the proxy to 'SUCCESS' if the
822
- client successfully authenticated, and anything else otherwise.",
836
+ client successfully authenticated, and anything else otherwise.
837
+
838
+ Note that the name of the HTTP header gets munged by the web server
839
+ common gateway inteface: an `HTTP_` prefix is added, dashes are converted
840
+ to underscores, and all letters are uppercased. Thus, to use the
841
+ `X-Client-Verify` header, this setting should be
842
+ `HTTP_X_CLIENT_VERIFY`.",
823
843
  },
824
844
  # To make sure this directory is created before we try to use it on the server, we need
825
845
  # it to be in the server section (#1138).
@@ -1504,8 +1524,44 @@ between Puppet 2.7.3 and 2.7.14. If you used them during this window, we
1504
1524
  apologize for the inconvenience --- you can temporarily set this to `true`
1505
1525
  in order to upgrade, and can rename your variables at your leisure. Please
1506
1526
  revert it to `false` after you have renamed all affected variables.
1527
+ EOT
1528
+ },
1529
+ :parser => {
1530
+ :default => "current",
1531
+ :desc => <<-'EOT'
1532
+ Selects the parser to use for parsing puppet manifests (in puppet DSL language/'.pp' files).
1533
+ Available choices are 'current' (the default), and 'future'.
1534
+
1535
+ The 'curent' parser means that the released version of the parser should be used.
1536
+
1537
+ The 'future' parser is a "time travel to the future" allowing early exposure to new language features.
1538
+ What these fatures are will vary from release to release and they may be invididually configurable.
1539
+
1540
+ Available Since Puppet 3.2.
1541
+ EOT
1542
+ },
1543
+ :max_errors => {
1544
+ :default => 10,
1545
+ :desc => <<-'EOT'
1546
+ Sets the max number of logged/displayed parser validation errors in case multiple errors have been detected.
1547
+ A value of 0 is the same as value 1. The count is per manifest.
1548
+ EOT
1549
+ },
1550
+ :max_warnings => {
1551
+ :default => 10,
1552
+ :desc => <<-'EOT'
1553
+ Sets the max number of logged/displayed parser validation warnings in case multiple errors have been detected.
1554
+ A value of 0 is the same as value 1. The count is per manifest.
1555
+ EOT
1556
+ },
1557
+ :max_deprecations => {
1558
+ :default => 10,
1559
+ :desc => <<-'EOT'
1560
+ Sets the max number of logged/displayed parser validation deprecation warnings in case multiple errors have been detected.
1561
+ A value of 0 is the same as value 1. The count is per manifest.
1507
1562
  EOT
1508
1563
  }
1564
+
1509
1565
  )
1510
1566
  define_settings(:puppetdoc,
1511
1567
  :document_all => {
data/lib/puppet/error.rb CHANGED
@@ -12,18 +12,29 @@ module Puppet
12
12
  # This module implements logging with a filename and line number. Use this
13
13
  # for errors that need to report a location in a non-ruby file that we
14
14
  # parse.
15
- attr_accessor :line, :file
15
+ attr_accessor :line, :file, :pos
16
16
 
17
- def initialize(message, file=nil, line=nil, original=nil)
17
+ # May be called with 3 arguments for message, file, line, and exception, or
18
+ # 4 args including the position on the line.
19
+ #
20
+ def initialize(message, file=nil, line=nil, pos=nil, original=nil)
21
+ if pos.kind_of? Exception
22
+ original = pos
23
+ pos = nil
24
+ end
18
25
  super(message, original)
19
26
  @file = file
20
27
  @line = line
28
+ @pos = pos
21
29
  end
22
-
23
30
  def to_s
24
31
  msg = super
25
- if @file and @line
32
+ if @file and @line and @pos
33
+ "#{msg} at #{@file}:#{@line}:#{@pos}"
34
+ elsif @file and @line
26
35
  "#{msg} at #{@file}:#{@line}"
36
+ elsif @line and @pos
37
+ "#{msg} at line #{@line}:#{@pos}"
27
38
  elsif @line
28
39
  "#{msg} at line #{@line}"
29
40
  elsif @file
@@ -40,7 +40,7 @@ vars: var
40
40
  }
41
41
  ;
42
42
 
43
- var: PARAM VALUE icomment returns { result = {val[0],val[1]} }
43
+ var: PARAM VALUE icomment returns { result = {val[0] => val[1]} }
44
44
  ;
45
45
 
46
46
  returns: RETURN
@@ -3,7 +3,7 @@ all: parser.rb
3
3
  debug: parser.rb setdebug
4
4
 
5
5
  parser.rb: grammar.ry
6
- racc -E -oparser.rb grammar.ry
6
+ racc -oparser.rb grammar.ry
7
7
 
8
8
  setdebug:
9
9
  perl -pi -e 's{\@yydebug =.*$$}{\@yydebug = true}' parser.rb
@@ -1,581 +1,175 @@
1
1
  #
2
2
  # DO NOT MODIFY!!!!
3
- # This file is automatically generated by racc 1.4.5
4
- # from racc grammer file "grammar.ry".
3
+ # This file is automatically generated by Racc 1.4.9
4
+ # from Racc grammer file "".
5
5
  #
6
- #
7
- # parser.rb: generated by racc (runtime embedded)
8
- #
9
- ###### racc/parser.rb begin
10
- unless $LOADED_FEATURES.index 'racc/parser.rb'
11
- $LOADED_FEATURES.push 'racc/parser.rb'
12
-
13
- self.class.module_eval <<'..end racc/parser.rb modeval..id5256434e8a', 'racc/parser.rb', 1
14
- #
15
- # $Id: parser.rb,v 1.7 2005/11/20 17:31:32 aamine Exp $
16
- #
17
- # Copyright (c) 1999-2005 Minero Aoki
18
- #
19
- # This program is free software.
20
- # You can distribute/modify this program under the same terms of ruby.
21
- #
22
- # As a special exception, when this code is copied by Racc
23
- # into a Racc output file, you may use that output file
24
- # without restriction.
25
- #
26
-
27
- NotImplementedError = NotImplementError unless defined?(NotImplementedError)
28
-
29
- module Racc
30
- class ParseError < StandardError; end
31
- end
32
- ParseError = Racc::ParseError unless defined?(::ParseError)
33
-
34
- module Racc
35
-
36
- Racc_No_Extentions = false unless defined?(Racc_No_Extentions)
37
-
38
- class Parser
39
-
40
- Racc_Runtime_Version = '1.4.5'
41
- Racc_Runtime_Revision = '$Revision: 1.7 $'.split[1]
42
-
43
- Racc_Runtime_Core_Version_R = '1.4.5'
44
- Racc_Runtime_Core_Revision_R = '$Revision: 1.7 $'.split[1]
45
- begin
46
- require 'racc/cparse'
47
- # Racc_Runtime_Core_Version_C = (defined in extention)
48
- Racc_Runtime_Core_Revision_C = Racc_Runtime_Core_Id_C.split[2]
49
- raise LoadError, 'old cparse.so' unless new.respond_to?(:_racc_do_parse_c, true)
50
- raise LoadError, 'selecting ruby version of racc runtime core' if Racc_No_Extentions
51
-
52
- Racc_Main_Parsing_Routine = :_racc_do_parse_c
53
- Racc_YY_Parse_Method = :_racc_yyparse_c
54
- Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_C
55
- Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_C
56
- Racc_Runtime_Type = 'c'
57
- rescue LoadError
58
- Racc_Main_Parsing_Routine = :_racc_do_parse_rb
59
- Racc_YY_Parse_Method = :_racc_yyparse_rb
60
- Racc_Runtime_Core_Version = Racc_Runtime_Core_Version_R
61
- Racc_Runtime_Core_Revision = Racc_Runtime_Core_Revision_R
62
- Racc_Runtime_Type = 'ruby'
63
- end
64
-
65
- def Parser.racc_runtime_type
66
- Racc_Runtime_Type
67
- end
68
-
69
- private
70
-
71
- def _racc_setup
72
- @yydebug = false unless self.class::Racc_debug_parser
73
- @yydebug ||= false
74
- if @yydebug
75
- @racc_debug_out ||= $stderr
76
- @racc_debug_out ||= $stderr
77
- end
78
- arg = self.class::Racc_arg
79
- arg[13] = true if arg.size < 14
80
- arg
81
- end
82
-
83
- def _racc_init_sysvars
84
- @racc_state = [0]
85
- @racc_tstack = []
86
- @racc_vstack = []
87
-
88
- @racc_t = nil
89
- @racc_val = nil
90
-
91
- @racc_read_next = true
92
-
93
- @racc_user_yyerror = false
94
- @racc_error_status = 0
95
- end
96
-
97
- ###
98
- ### do_parse
99
- ###
100
-
101
- def do_parse
102
- __send__(Racc_Main_Parsing_Routine, _racc_setup, false)
103
- end
104
-
105
- def next_token
106
- raise NotImplementedError, "#{self.class}\#next_token is not defined"
107
- end
108
-
109
- def _racc_do_parse_rb(arg, in_debug)
110
- action_table, action_check, action_default, action_pointer,
111
- goto_table, goto_check, goto_default, goto_pointer,
112
- nt_base, reduce_table, token_table, shift_n,
113
- reduce_n, use_result, * = arg
114
-
115
- _racc_init_sysvars
116
- tok = act = i = nil
117
- nerr = 0
118
-
119
- catch(:racc_end_parse) {
120
- while true
121
- if i = action_pointer[@racc_state[-1]]
122
- if @racc_read_next
123
- if @racc_t != 0 # not EOF
124
- tok, @racc_val = next_token
125
- unless tok # EOF
126
- @racc_t = 0
127
- else
128
- @racc_t = (token_table[tok] or 1) # error token
129
- end
130
- racc_read_token(@racc_t, tok, @racc_val) if @yydebug
131
- @racc_read_next = false
132
- end
133
- end
134
- i += @racc_t
135
- unless i >= 0 and
136
- act = action_table[i] and
137
- action_check[i] == @racc_state[-1]
138
- act = action_default[@racc_state[-1]]
139
- end
140
- else
141
- act = action_default[@racc_state[-1]]
142
- end
143
- while act = _racc_evalact(act, arg)
144
- ;
145
- end
146
- end
147
- }
148
- end
149
-
150
- ###
151
- ### yyparse
152
- ###
153
-
154
- def yyparse(recv, mid)
155
- __send__(Racc_YY_Parse_Method, recv, mid, _racc_setup, true)
156
- end
157
-
158
- def _racc_yyparse_rb(recv, mid, arg, c_debug)
159
- action_table, action_check, action_default, action_pointer,
160
- goto_table, goto_check, goto_default, goto_pointer,
161
- nt_base, reduce_table, token_table, shift_n,
162
- reduce_n, use_result, * = arg
163
-
164
- _racc_init_sysvars
165
- tok = nil
166
- act = nil
167
- i = nil
168
- nerr = 0
169
-
170
- catch(:racc_end_parse) {
171
- until i = action_pointer[@racc_state[-1]]
172
- while act = _racc_evalact(action_default[@racc_state[-1]], arg)
173
- ;
174
- end
175
- end
176
- recv.__send__(mid) do |tok, val|
177
- unless tok
178
- @racc_t = 0
179
- else
180
- @racc_t = (token_table[tok] or 1) # error token
181
- end
182
- @racc_val = val
183
- @racc_read_next = false
184
-
185
- i += @racc_t
186
- unless i >= 0 and
187
- act = action_table[i] and
188
- action_check[i] == @racc_state[-1]
189
- act = action_default[@racc_state[-1]]
190
- end
191
- while act = _racc_evalact(act, arg)
192
- ;
193
- end
194
-
195
- while not (i = action_pointer[@racc_state[-1]]) or
196
- not @racc_read_next or
197
- @racc_t == 0 # $
198
- unless i and i += @racc_t and
199
- i >= 0 and
200
- act = action_table[i] and
201
- action_check[i] == @racc_state[-1]
202
- act = action_default[@racc_state[-1]]
203
- end
204
- while act = _racc_evalact(act, arg)
205
- ;
206
- end
207
- end
208
- end
209
- }
210
- end
211
-
212
- ###
213
- ### common
214
- ###
215
-
216
- def _racc_evalact(act, arg)
217
- action_table, action_check, action_default, action_pointer,
218
- goto_table, goto_check, goto_default, goto_pointer,
219
- nt_base, reduce_table, token_table, shift_n,
220
- reduce_n, use_result, * = arg
221
- nerr = 0 # tmp
222
-
223
- if act > 0 and act < shift_n
224
- #
225
- # shift
226
- #
227
- if @racc_error_status > 0
228
- @racc_error_status -= 1 unless @racc_t == 1 # error token
229
- end
230
- @racc_vstack.push @racc_val
231
- @racc_state.push act
232
- @racc_read_next = true
233
- if @yydebug
234
- @racc_tstack.push @racc_t
235
- racc_shift @racc_t, @racc_tstack, @racc_vstack
236
- end
237
-
238
- elsif act < 0 and act > -reduce_n
239
- #
240
- # reduce
241
- #
242
- code = catch(:racc_jump) {
243
- @racc_state.push _racc_do_reduce(arg, act)
244
- false
245
- }
246
- if code
247
- case code
248
- when 1 # yyerror
249
- @racc_user_yyerror = true # user_yyerror
250
- return -reduce_n
251
- when 2 # yyaccept
252
- return shift_n
253
- else
254
- raise '[Racc Bug] unknown jump code'
255
- end
256
- end
257
-
258
- elsif act == shift_n
259
- #
260
- # accept
261
- #
262
- racc_accept if @yydebug
263
- throw :racc_end_parse, @racc_vstack[0]
264
-
265
- elsif act == -reduce_n
266
- #
267
- # error
268
- #
269
- case @racc_error_status
270
- when 0
271
- unless arg[21] # user_yyerror
272
- nerr += 1
273
- on_error @racc_t, @racc_val, @racc_vstack
274
- end
275
- when 3
276
- if @racc_t == 0 # is $
277
- throw :racc_end_parse, nil
278
- end
279
- @racc_read_next = true
280
- end
281
- @racc_user_yyerror = false
282
- @racc_error_status = 3
283
- while true
284
- if i = action_pointer[@racc_state[-1]]
285
- i += 1 # error token
286
- if i >= 0 and
287
- (act = action_table[i]) and
288
- action_check[i] == @racc_state[-1]
289
- break
290
- end
291
- end
292
- throw :racc_end_parse, nil if @racc_state.size <= 1
293
- @racc_state.pop
294
- @racc_vstack.pop
295
- if @yydebug
296
- @racc_tstack.pop
297
- racc_e_pop @racc_state, @racc_tstack, @racc_vstack
298
- end
299
- end
300
- return act
301
-
302
- else
303
- raise "[Racc Bug] unknown action #{act.inspect}"
304
- end
305
-
306
- racc_next_state(@racc_state[-1], @racc_state) if @yydebug
307
-
308
- nil
309
- end
310
-
311
- def _racc_do_reduce(arg, act)
312
- action_table, action_check, action_default, action_pointer,
313
- goto_table, goto_check, goto_default, goto_pointer,
314
- nt_base, reduce_table, token_table, shift_n,
315
- reduce_n, use_result, * = arg
316
- state = @racc_state
317
- vstack = @racc_vstack
318
- tstack = @racc_tstack
319
-
320
- i = act * -3
321
- len = reduce_table[i]
322
- reduce_to = reduce_table[i+1]
323
- method_id = reduce_table[i+2]
324
- void_array = []
325
-
326
- tmp_t = tstack[-len, len] if @yydebug
327
- tmp_v = vstack[-len, len]
328
- tstack[-len, len] = void_array if @yydebug
329
- vstack[-len, len] = void_array
330
- state[-len, len] = void_array
331
-
332
- # tstack must be updated AFTER method call
333
- if use_result
334
- vstack.push __send__(method_id, tmp_v, vstack, tmp_v[0])
335
- else
336
- vstack.push __send__(method_id, tmp_v, vstack)
337
- end
338
- tstack.push reduce_to
339
-
340
- racc_reduce(tmp_t, reduce_to, tstack, vstack) if @yydebug
341
-
342
- k1 = reduce_to - nt_base
343
- if i = goto_pointer[k1]
344
- i += state[-1]
345
- if i >= 0 and (curstate = goto_table[i]) and goto_check[i] == k1
346
- return curstate
347
- end
348
- end
349
- goto_default[k1]
350
- end
351
-
352
- def on_error(t, val, vstack)
353
- raise ParseError, sprintf("\nparse error on value %s (%s)", val.inspect, token_to_str(t) || '?')
354
- end
355
-
356
- def yyerror
357
- throw :racc_jump, 1
358
- end
359
-
360
- def yyaccept
361
- throw :racc_jump, 2
362
- end
363
-
364
- def yyerrok
365
- @racc_error_status = 0
366
- end
367
-
368
- #
369
- # for debugging output
370
- #
371
-
372
- def racc_read_token(t, tok, val)
373
- @racc_debug_out.print 'read '
374
- @racc_debug_out.print tok.inspect, '(', racc_token2str(t), ') '
375
- @racc_debug_out.puts val.inspect
376
- @racc_debug_out.puts
377
- end
378
-
379
- def racc_shift(tok, tstack, vstack)
380
- @racc_debug_out.puts "shift #{racc_token2str tok}"
381
- racc_print_stacks tstack, vstack
382
- @racc_debug_out.puts
383
- end
384
-
385
- def racc_reduce(toks, sim, tstack, vstack)
386
- out = @racc_debug_out
387
- out.print 'reduce '
388
- if toks.empty?
389
- out.print ' <none>'
390
- else
391
- toks.each {|t| out.print ' ', racc_token2str(t) }
392
- end
393
- out.puts " --> #{racc_token2str(sim)}"
394
-
395
- racc_print_stacks tstack, vstack
396
- @racc_debug_out.puts
397
- end
398
-
399
- def racc_accept
400
- @racc_debug_out.puts 'accept'
401
- @racc_debug_out.puts
402
- end
403
-
404
- def racc_e_pop(state, tstack, vstack)
405
- @racc_debug_out.puts 'error recovering mode: pop token'
406
- racc_print_states state
407
- racc_print_stacks tstack, vstack
408
- @racc_debug_out.puts
409
- end
410
-
411
- def racc_next_state(curstate, state)
412
- @racc_debug_out.puts "goto #{curstate}"
413
- racc_print_states state
414
- @racc_debug_out.puts
415
- end
416
-
417
- def racc_print_stacks(t, v)
418
- out = @racc_debug_out
419
- out.print ' ['
420
- t.each_index do |i|
421
- out.print ' (', racc_token2str(t[i]), ' ', v[i].inspect, ')'
422
- end
423
- out.puts ' ]'
424
- end
425
-
426
- def racc_print_states(s)
427
- out = @racc_debug_out
428
- out.print ' ['
429
- s.each {|st| out.print ' ', st }
430
- out.puts ' ]'
431
- end
432
-
433
- def racc_token2str(tok)
434
- self.class::Racc_token_to_s_table[tok] or
435
- raise "[Racc Bug] can't convert token #{tok} to string"
436
- end
437
-
438
- def token_to_str(t)
439
- self.class::Racc_token_to_s_table[t]
440
- end
441
-
442
- end
443
-
444
- end
445
- ..end racc/parser.rb modeval..id5256434e8a
446
- end
447
- ###### racc/parser.rb end
448
-
449
6
 
7
+ require 'racc/parser.rb'
450
8
  module Nagios
451
-
452
9
  class Parser < Racc::Parser
453
10
 
454
- module_eval <<'..end grammar.ry modeval..idcb2ea30b34', 'grammar.ry', 57
11
+ module_eval(<<'...end grammar.ry/module_eval...', 'grammar.ry', 57)
455
12
 
456
13
  class ::Nagios::Parser::SyntaxError < RuntimeError; end
457
14
 
458
15
  def parse(src)
459
- @src = src
16
+ @src = src
460
17
 
461
- # state variables
462
- @invar = false
463
- @inobject = false
464
- @done = false
18
+ # state variables
19
+ @invar = false
20
+ @inobject = false
21
+ @done = false
465
22
 
466
- @line = 0
467
- @yydebug = true
23
+ @line = 0
24
+ @yydebug = true
468
25
 
469
- do_parse
26
+ do_parse
470
27
  end
471
28
 
472
29
  # The lexer. Very simple.
473
30
  def token
474
- @src.sub!(/\A\n/,'')
475
- if $MATCH
476
- @line += 1
477
- return [ :RETURN, "\n" ]
31
+ @src.sub!(/\A\n/,'')
32
+ if $&
33
+ @line += 1
34
+ return [ :RETURN, "\n" ]
478
35
  end
479
36
 
480
- return nil if @done
37
+ if @done
38
+ return nil
39
+ end
481
40
  yytext = String.new
482
41
 
483
42
 
484
43
  # remove comments from this line
485
44
  @src.sub!(/\A[ \t]*;.*\n/,"\n")
486
- return [:INLINECOMMENT, ""] if $MATCH
45
+ if $&
46
+ return [:INLINECOMMENT, ""]
47
+ end
487
48
 
488
49
  @src.sub!(/\A#.*\n/,"\n")
489
- return [:COMMENT, ""] if $MATCH
50
+ if $&
51
+ return [:COMMENT, ""]
52
+ end
490
53
 
491
54
  @src.sub!(/#.*/,'')
492
55
 
493
56
  if @src.length == 0
494
- @done = true
495
- return [false, '$']
57
+ @done = true
58
+ return [false, '$']
496
59
  end
497
60
 
498
61
  if @invar
499
- @src.sub!(/\A[ \t]+/,'')
500
- @src.sub!(/\A([^;\n]+)(\n|;)/,'\2')
501
- if $1
502
- yytext += $1
62
+ @src.sub!(/\A[ \t]+/,'')
63
+ @src.sub!(/\A([^;\n]+)(\n|;)/,'\2')
64
+ if $1
65
+ yytext += $1
503
66
  end
504
67
  @invar = false
505
68
  return [:VALUE, yytext]
506
69
  else
507
- @src.sub!(/\A[\t ]*(\S+)([\t ]*|$)/,'')
508
- if $1
509
- yytext = $1
510
- case yytext
511
- when 'define'
512
- #puts "got define"
513
- return [:DEFINE, yytext]
514
- when '{'
515
- #puts "got {"
516
- @inobject = true
517
- return [:LCURLY, yytext]
518
- else
519
- unless @inobject
520
- #puts "got type: #{yytext}"
521
- if yytext =~ /\W/
522
- giveback = yytext.dup
523
- giveback.sub!(/^\w+/,'')
524
- #puts "giveback #{giveback}"
525
- #puts "yytext #{yytext}"
526
- yytext.sub!(/\W.*$/,'')
527
- #puts "yytext #{yytext}"
528
- #puts "all [#{giveback} #{yytext} #{orig}]"
529
- @src = giveback + @src
530
- end
531
- return [:NAME, yytext]
532
- else
533
- if yytext == '}'
534
- #puts "got closure: #{yytext}"
535
- @inobject = false
536
- return [:RCURLY, '}']
537
- end
538
-
539
- unless @invar
540
- @invar = true
541
- return [:PARAM, $1]
542
- else
543
- end
70
+ @src.sub!(/\A[\t ]*(\S+)([\t ]*|$)/,'')
71
+ if $1
72
+ yytext = $1
73
+ case yytext
74
+ when 'define'
75
+ #puts "got define"
76
+ return [:DEFINE, yytext]
77
+ when '{'
78
+ #puts "got {"
79
+ @inobject = true
80
+ return [:LCURLY, yytext]
81
+ else
82
+ unless @inobject
83
+ #puts "got type: #{yytext}"
84
+ if yytext =~ /\W/
85
+ giveback = yytext.dup
86
+ giveback.sub!(/^\w+/,'')
87
+ #puts "giveback " + giveback
88
+ #puts "yytext " + yytext
89
+ yytext.sub!(/\W.*$/,'')
90
+ #puts "yytext " + yytext
91
+ #puts "all [#{giveback} #{yytext} #{orig}]"
92
+ @src = giveback + @src
93
+ end
94
+ return [:NAME, yytext]
95
+ else
96
+ if yytext == '}'
97
+ #puts "got closure: #{yytext}"
98
+ @inobject = false
99
+ return [:RCURLY, '}']
100
+ end
101
+
102
+ unless @invar
103
+ @invar = true
104
+ return [:PARAM, $1]
105
+ else
106
+ end
107
+ end
108
+ end
544
109
  end
545
- end
546
- end
547
110
  end
548
111
  end
549
112
 
550
113
  def next_token
551
- token
114
+ token
552
115
  end
553
116
 
554
117
  def yydebug
555
- 1
118
+ 1
556
119
  end
557
120
 
558
121
  def yywrap
559
- 0
122
+ 0
560
123
  end
561
124
 
562
125
  def on_error(token, value, vstack )
563
- msg = ""
564
- unless value.nil?
565
- msg = "line #{@line}: syntax error at '#{value}'"
126
+ msg = ""
127
+ unless value.nil?
128
+ msg = "line #{@line}: syntax error at '#{value}'"
566
129
  else
567
- msg = "line #{@line}: syntax error at '#{token}'"
130
+ msg = "line #{@line}: syntax error at '#{token}'"
131
+ end
132
+ unless @src.size > 0
133
+ msg = "line #{@line}: Unexpected end of file"
568
134
  end
569
- msg = "line #{@line}: Unexpected end of file" unless @src.size > 0
570
135
  if token == '$end'.intern
571
- puts "okay, this is silly"
136
+ puts "okay, this is silly"
572
137
  else
573
- raise ::Nagios::Parser::SyntaxError, msg
138
+ raise ::Nagios::Parser::SyntaxError, msg
574
139
  end
575
140
  end
576
- ..end grammar.ry modeval..idcb2ea30b34
141
+ ...end grammar.ry/module_eval...
142
+ ##### State transition tables begin ###
143
+
144
+ racc_action_table = [
145
+ 8, 17, 7, 18, 7, 14, 12, 13, 11, 4,
146
+ 6, 4, 6, 17, 10, 20, 22, 24, 25 ]
147
+
148
+ racc_action_check = [
149
+ 1, 15, 1, 15, 0, 13, 8, 11, 7, 1,
150
+ 1, 0, 0, 14, 6, 17, 20, 21, 23 ]
151
+
152
+ racc_action_pointer = [
153
+ 2, 0, nil, nil, nil, nil, 5, 5, 6, nil,
154
+ nil, 1, nil, -4, 8, -4, nil, 7, nil, nil,
155
+ 5, 8, nil, 9, nil, nil ]
156
+
157
+ racc_action_default = [
158
+ -15, -15, -1, -3, -4, -5, -15, -15, -15, -2,
159
+ -6, -15, 26, -15, -15, -15, -8, -15, -7, -9,
160
+ -13, -15, -14, -10, -11, -12 ]
161
+
162
+ racc_goto_table = [
163
+ 16, 19, 2, 9, 1, 15, 21, 23 ]
577
164
 
578
- ##### racc 1.4.5 generates ###
165
+ racc_goto_check = [
166
+ 6, 6, 2, 2, 1, 5, 7, 8 ]
167
+
168
+ racc_goto_pointer = [
169
+ nil, 4, 2, nil, nil, -9, -14, -14, -14 ]
170
+
171
+ racc_goto_default = [
172
+ nil, nil, nil, 3, 5, nil, nil, nil, nil ]
579
173
 
580
174
  racc_reduce_table = [
581
175
  0, 0, :racc_error,
@@ -598,35 +192,9 @@ racc_reduce_n = 15
598
192
 
599
193
  racc_shift_n = 26
600
194
 
601
- racc_action_table = [
602
- 9, 15, 1, 20, 1, 14, 12, 13, 11, 6,
603
- 7, 6, 7, 15, 18, 8, 21, 23, 25 ]
604
-
605
- racc_action_check = [
606
- 2, 16, 2, 16, 0, 12, 8, 9, 7, 2,
607
- 2, 0, 0, 14, 15, 1, 18, 22, 24 ]
608
-
609
- racc_action_pointer = [
610
- 2, 12, 0, nil, nil, nil, nil, -1, 0, 7,
611
- nil, nil, -4, nil, 8, 6, -4, nil, 5, nil,
612
- nil, nil, 8, nil, 9, nil ]
613
-
614
- racc_action_default = [
615
- -15, -15, -15, -1, -3, -5, -4, -15, -15, -15,
616
- -2, -6, -15, 26, -15, -15, -15, -8, -13, -9,
617
- -7, -14, -15, -11, -10, -12 ]
618
-
619
- racc_goto_table = [ 17, 3, 19, 10, 2, 16, 22, 24 ]
620
-
621
- racc_goto_check = [ 6, 2, 6, 2, 1, 5, 7, 8 ]
622
-
623
- racc_goto_pointer = [ nil, 4, 1, nil, nil, -9, -14, -12, -15 ]
624
-
625
- racc_goto_default = [ nil, nil, nil, 4, 5, nil, nil, nil, nil ]
626
-
627
195
  racc_token_table = {
628
196
  false => 0,
629
- Object.new => 1,
197
+ :error => 1,
630
198
  :DEFINE => 2,
631
199
  :NAME => 3,
632
200
  :STRING => 4,
@@ -638,10 +206,10 @@ racc_token_table = {
638
206
  :COMMENT => 10,
639
207
  :INLINECOMMENT => 11 }
640
208
 
641
- racc_use_result_var = true
642
-
643
209
  racc_nt_base = 12
644
210
 
211
+ racc_use_result_var = true
212
+
645
213
  Racc_arg = [
646
214
  racc_action_table,
647
215
  racc_action_check,
@@ -659,103 +227,103 @@ Racc_arg = [
659
227
  racc_use_result_var ]
660
228
 
661
229
  Racc_token_to_s_table = [
662
- '$end',
663
- 'error',
664
- 'DEFINE',
665
- 'NAME',
666
- 'STRING',
667
- 'PARAM',
668
- 'LCURLY',
669
- 'RCURLY',
670
- 'VALUE',
671
- 'RETURN',
672
- 'COMMENT',
673
- 'INLINECOMMENT',
674
- '$start',
675
- 'decls',
676
- 'decl',
677
- 'object',
678
- 'comment',
679
- 'vars',
680
- 'var',
681
- 'icomment',
682
- 'returns']
230
+ "$end",
231
+ "error",
232
+ "DEFINE",
233
+ "NAME",
234
+ "STRING",
235
+ "PARAM",
236
+ "LCURLY",
237
+ "RCURLY",
238
+ "VALUE",
239
+ "RETURN",
240
+ "COMMENT",
241
+ "INLINECOMMENT",
242
+ "$start",
243
+ "decls",
244
+ "decl",
245
+ "object",
246
+ "comment",
247
+ "vars",
248
+ "var",
249
+ "icomment",
250
+ "returns" ]
683
251
 
684
252
  Racc_debug_parser = false
685
253
 
686
- ##### racc system variables end #####
254
+ ##### State transition tables end #####
687
255
 
688
256
  # reduce 0 omitted
689
257
 
690
- module_eval <<'.,.,', 'grammar.ry', 6
691
- def _reduce_1( val, _values, result )
692
- return val[0] if val[0]
693
- result
694
- end
258
+ module_eval(<<'.,.,', 'grammar.ry', 6)
259
+ def _reduce_1(val, _values, result)
260
+ return val[0] if val[0]
261
+ result
262
+ end
695
263
  .,.,
696
264
 
697
- module_eval <<'.,.,', 'grammar.ry', 18
698
- def _reduce_2( val, _values, result )
265
+ module_eval(<<'.,.,', 'grammar.ry', 8)
266
+ def _reduce_2(val, _values, result)
699
267
  if val[1].nil?
700
268
  result = val[0]
701
- else
702
- if val[0].nil?
703
- result = val[1]
704
- else
705
- result = [ val[0], val[1] ].flatten
706
- end
707
- end
708
- result
269
+ else
270
+ if val[0].nil?
271
+ result = val[1]
272
+ else
273
+ result = [ val[0], val[1] ].flatten
274
+ end
275
+ end
276
+ result
709
277
  end
710
278
  .,.,
711
279
 
712
- module_eval <<'.,.,', 'grammar.ry', 20
713
- def _reduce_3( val, _values, result )
714
- result = [val[0]]
715
- result
716
- end
280
+ module_eval(<<'.,.,', 'grammar.ry', 20)
281
+ def _reduce_3(val, _values, result)
282
+ result = [val[0]]
283
+ result
284
+ end
717
285
  .,.,
718
286
 
719
- module_eval <<'.,.,', 'grammar.ry', 21
720
- def _reduce_4( val, _values, result )
721
- result = nil
722
- result
723
- end
287
+ module_eval(<<'.,.,', 'grammar.ry', 21)
288
+ def _reduce_4(val, _values, result)
289
+ result = nil
290
+ result
291
+ end
724
292
  .,.,
725
293
 
726
294
  # reduce 5 omitted
727
295
 
728
- module_eval <<'.,.,', 'grammar.ry', 25
729
- def _reduce_6( val, _values, result )
730
- result = nil
731
- result
732
- end
296
+ module_eval(<<'.,.,', 'grammar.ry', 25)
297
+ def _reduce_6(val, _values, result)
298
+ result = nil
299
+ result
300
+ end
733
301
  .,.,
734
302
 
735
- module_eval <<'.,.,', 'grammar.ry', 31
736
- def _reduce_7( val, _values, result )
303
+ module_eval(<<'.,.,', 'grammar.ry', 29)
304
+ def _reduce_7(val, _values, result)
737
305
  result = Nagios::Base.create(val[1],val[4])
738
- result
306
+ result
739
307
  end
740
308
  .,.,
741
309
 
742
310
  # reduce 8 omitted
743
311
 
744
- module_eval <<'.,.,', 'grammar.ry', 40
745
- def _reduce_9( val, _values, result )
312
+ module_eval(<<'.,.,', 'grammar.ry', 35)
313
+ def _reduce_9(val, _values, result)
746
314
  val[1].each {|p,v|
747
315
  val[0][p] = v
748
- }
749
- result = val[0]
750
- result
316
+ }
317
+ result = val[0]
318
+ result
751
319
  end
752
320
  .,.,
753
321
 
754
- module_eval <<'.,.,', 'grammar.ry', 42
755
- def _reduce_10( val, _values, result )
756
- result = {val[0] => val[1]}
757
- result
758
- end
322
+ module_eval(<<'.,.,', 'grammar.ry', 42)
323
+ def _reduce_10(val, _values, result)
324
+ result = {val[0] => val[1]}
325
+ result
326
+ end
759
327
  .,.,
760
328
 
761
329
  # reduce 11 omitted
@@ -766,10 +334,9 @@ end
766
334
 
767
335
  # reduce 14 omitted
768
336
 
769
- def _reduce_none( val, _values, result )
770
- result
337
+ def _reduce_none(val, _values, result)
338
+ val[0]
771
339
  end
772
340
 
773
- end
774
-
775
- end
341
+ end # class Parser
342
+ end # module Nagios