cloud-toaster 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (515) hide show
  1. checksums.yaml +15 -0
  2. data/LICENSE +202 -0
  3. data/README.md +54 -0
  4. data/Rakefile +51 -0
  5. data/VERSION +1 -0
  6. data/bin/strace-4.8_patched/strace-i686 +0 -0
  7. data/bin/strace-4.8_patched/strace-x86_64 +0 -0
  8. data/bin/toaster +74 -0
  9. data/chef/cookbooks/chef-solo-search/CHANGELOG +16 -0
  10. data/chef/cookbooks/chef-solo-search/Gemfile +8 -0
  11. data/chef/cookbooks/chef-solo-search/LICENSE +202 -0
  12. data/chef/cookbooks/chef-solo-search/NOTICE +18 -0
  13. data/chef/cookbooks/chef-solo-search/README.md +143 -0
  14. data/chef/cookbooks/chef-solo-search/Rakefile +10 -0
  15. data/chef/cookbooks/chef-solo-search/libraries/search/overrides.rb +100 -0
  16. data/chef/cookbooks/chef-solo-search/libraries/search/parser.rb +222 -0
  17. data/chef/cookbooks/chef-solo-search/libraries/search.rb +75 -0
  18. data/chef/cookbooks/chef-solo-search/libraries/vendor/chef/solr_query/lucene.treetop +150 -0
  19. data/chef/cookbooks/chef-solo-search/libraries/vendor/chef/solr_query/lucene_nodes.rb +285 -0
  20. data/chef/cookbooks/chef-solo-search/libraries/vendor/chef/solr_query/query_transform.rb +65 -0
  21. data/chef/cookbooks/chef-solo-search/metadata.rb +11 -0
  22. data/chef/cookbooks/chef-solo-search/recipes/default.rb +3 -0
  23. data/chef/cookbooks/chef-solo-search/tests/data/data_bags/node/alpha.json +10 -0
  24. data/chef/cookbooks/chef-solo-search/tests/data/data_bags/node/beta.json +10 -0
  25. data/chef/cookbooks/chef-solo-search/tests/data/data_bags/node/without_json_class.json +7 -0
  26. data/chef/cookbooks/chef-solo-search/tests/data/data_bags/users/jerry.json +8 -0
  27. data/chef/cookbooks/chef-solo-search/tests/data/data_bags/users/lea.json +10 -0
  28. data/chef/cookbooks/chef-solo-search/tests/data/data_bags/users/mike.json +13 -0
  29. data/chef/cookbooks/chef-solo-search/tests/data/data_bags/users/tom.json +10 -0
  30. data/chef/cookbooks/chef-solo-search/tests/gemfiles/Gemfile.10 +4 -0
  31. data/chef/cookbooks/chef-solo-search/tests/gemfiles/Gemfile.11 +5 -0
  32. data/chef/cookbooks/chef-solo-search/tests/test_data_bags.rb +45 -0
  33. data/chef/cookbooks/chef-solo-search/tests/test_search.rb +244 -0
  34. data/chef/cookbooks/lxc/attributes/create_lxc.rb +8 -0
  35. data/chef/cookbooks/lxc/attributes/general.rb +15 -0
  36. data/chef/cookbooks/lxc/attributes/init_bare_os.rb +15 -0
  37. data/chef/cookbooks/lxc/attributes/init_proto.rb +18 -0
  38. data/chef/cookbooks/lxc/attributes/install_ruby.rb +51 -0
  39. data/chef/cookbooks/lxc/attributes/mount_volume.rb +11 -0
  40. data/chef/cookbooks/lxc/attributes/setup_host.rb +9 -0
  41. data/chef/cookbooks/lxc/attributes/setup_proxy.rb +3 -0
  42. data/chef/cookbooks/lxc/attributes/start_lxc.rb +11 -0
  43. data/chef/cookbooks/lxc/attributes/stop_lxc.rb +3 -0
  44. data/chef/cookbooks/lxc/files/install.chef.sh +78 -0
  45. data/chef/cookbooks/lxc/metadata.json +6 -0
  46. data/chef/cookbooks/lxc/recipes/create_lxc.rb +106 -0
  47. data/chef/cookbooks/lxc/recipes/init_bare_os.rb +82 -0
  48. data/chef/cookbooks/lxc/recipes/init_proto.rb +417 -0
  49. data/chef/cookbooks/lxc/recipes/install_docker.rb +61 -0
  50. data/chef/cookbooks/lxc/recipes/install_ruby.rb +28 -0
  51. data/chef/cookbooks/lxc/recipes/mount_volume.rb +63 -0
  52. data/chef/cookbooks/lxc/recipes/setup_database.rb +22 -0
  53. data/chef/cookbooks/lxc/recipes/setup_host.rb +179 -0
  54. data/chef/cookbooks/lxc/recipes/setup_proxy.rb +157 -0
  55. data/chef/cookbooks/lxc/recipes/start_lxc.rb +180 -0
  56. data/chef/cookbooks/lxc/recipes/stop_lxc.rb +86 -0
  57. data/chef/cookbooks/mysql/CHANGELOG.md +391 -0
  58. data/chef/cookbooks/mysql/README.md +211 -0
  59. data/chef/cookbooks/mysql/attributes/default.rb +22 -0
  60. data/chef/cookbooks/mysql/libraries/helpers.rb +277 -0
  61. data/chef/cookbooks/mysql/libraries/matchers.rb +17 -0
  62. data/chef/cookbooks/mysql/libraries/provider_mysql_client.rb +10 -0
  63. data/chef/cookbooks/mysql/libraries/provider_mysql_client_debian.rb +37 -0
  64. data/chef/cookbooks/mysql/libraries/provider_mysql_client_fedora.rb +38 -0
  65. data/chef/cookbooks/mysql/libraries/provider_mysql_client_freebsd.rb +33 -0
  66. data/chef/cookbooks/mysql/libraries/provider_mysql_client_omnios.rb +41 -0
  67. data/chef/cookbooks/mysql/libraries/provider_mysql_client_rhel.rb +42 -0
  68. data/chef/cookbooks/mysql/libraries/provider_mysql_client_smartos.rb +33 -0
  69. data/chef/cookbooks/mysql/libraries/provider_mysql_client_suse.rb +37 -0
  70. data/chef/cookbooks/mysql/libraries/provider_mysql_client_ubuntu.rb +37 -0
  71. data/chef/cookbooks/mysql/libraries/provider_mysql_service.rb +10 -0
  72. data/chef/cookbooks/mysql/libraries/provider_mysql_service_debian.rb +193 -0
  73. data/chef/cookbooks/mysql/libraries/provider_mysql_service_fedora.rb +157 -0
  74. data/chef/cookbooks/mysql/libraries/provider_mysql_service_freebsd.rb +151 -0
  75. data/chef/cookbooks/mysql/libraries/provider_mysql_service_omnios.rb +232 -0
  76. data/chef/cookbooks/mysql/libraries/provider_mysql_service_rhel.rb +318 -0
  77. data/chef/cookbooks/mysql/libraries/provider_mysql_service_smartos.rb +216 -0
  78. data/chef/cookbooks/mysql/libraries/provider_mysql_service_suse.rb +170 -0
  79. data/chef/cookbooks/mysql/libraries/provider_mysql_service_ubuntu.rb +218 -0
  80. data/chef/cookbooks/mysql/libraries/resource_mysql_client.rb +11 -0
  81. data/chef/cookbooks/mysql/libraries/resource_mysql_service.rb +194 -0
  82. data/chef/cookbooks/mysql/metadata.json +40 -0
  83. data/chef/cookbooks/mysql/metadata.rb +20 -0
  84. data/chef/cookbooks/mysql/recipes/client.rb +22 -0
  85. data/chef/cookbooks/mysql/recipes/server.rb +33 -0
  86. data/chef/cookbooks/mysql/recipes/server_deprecated.rb +23 -0
  87. data/chef/cookbooks/mysql/templates/default/5.0/my.cnf.erb +38 -0
  88. data/chef/cookbooks/mysql/templates/default/5.1/my.cnf.erb +38 -0
  89. data/chef/cookbooks/mysql/templates/default/5.5/my.cnf.erb +38 -0
  90. data/chef/cookbooks/mysql/templates/default/5.6/my.cnf.erb +39 -0
  91. data/chef/cookbooks/mysql/templates/default/apparmor/usr.sbin.mysqld.erb +40 -0
  92. data/chef/cookbooks/mysql/templates/default/debian/debian.cnf.erb +12 -0
  93. data/chef/cookbooks/mysql/templates/default/debian/mysql-server.seed.erb +10 -0
  94. data/chef/cookbooks/mysql/templates/default/deprecated/my.cnf.erb +374 -0
  95. data/chef/cookbooks/mysql/templates/default/grants/grants.sql.erb +27 -0
  96. data/chef/cookbooks/mysql/templates/default/omnios/mysql.xml.erb +26 -0
  97. data/chef/cookbooks/mysql/templates/default/omnios/svc.method.mysqld.erb +29 -0
  98. data/chef/cookbooks/mysql/templates/default/smartos/mysql.xml.erb +32 -0
  99. data/chef/cookbooks/mysql/templates/default/smartos/svc.method.mysqld.erb +29 -0
  100. data/chef/cookbooks/openssl/README.md +37 -0
  101. data/chef/cookbooks/openssl/libraries/secure_password.rb +37 -0
  102. data/chef/cookbooks/openssl/metadata.json +30 -0
  103. data/chef/cookbooks/openssl/metadata.rb +8 -0
  104. data/chef/cookbooks/openssl/recipes/default.rb +19 -0
  105. data/chef/cookbooks/ssh/attributes/default.rb +8 -0
  106. data/chef/cookbooks/ssh/recipes/authorize_key.rb +20 -0
  107. data/chef/cookbooks/toaster/attributes/testing.rb +37 -0
  108. data/chef/cookbooks/toaster/libraries/default.rb +61 -0
  109. data/chef/cookbooks/toaster/recipes/post__cakephp__default.rb +27 -0
  110. data/chef/cookbooks/toaster/recipes/post__cube__default.rb +26 -0
  111. data/chef/cookbooks/toaster/recipes/post__drupal__default.rb +16 -0
  112. data/chef/cookbooks/toaster/recipes/post__icinga__default.rb +9 -0
  113. data/chef/cookbooks/toaster/recipes/post__node__default.rb +16 -0
  114. data/chef/cookbooks/toaster/recipes/post__virtualbox__default.rb +12 -0
  115. data/chef/cookbooks/toaster/recipes/post__wordpress__default.rb +12 -0
  116. data/chef/cookbooks/toaster/recipes/pre__aegir__default.rb +12 -0
  117. data/chef/cookbooks/toaster/recipes/pre__app__default.rb +3 -0
  118. data/chef/cookbooks/toaster/recipes/pre__cakephp__default.rb +24 -0
  119. data/chef/cookbooks/toaster/recipes/pre__cube__default.rb +9 -0
  120. data/chef/cookbooks/toaster/recipes/pre__disco__default.rb +21 -0
  121. data/chef/cookbooks/toaster/recipes/pre__drbd__default.rb +7 -0
  122. data/chef/cookbooks/toaster/recipes/pre__eaccelerator__default.rb +2 -0
  123. data/chef/cookbooks/toaster/recipes/pre__elasticsearch-head__default.rb +11 -0
  124. data/chef/cookbooks/toaster/recipes/pre__elasticsearch__default.rb +6 -0
  125. data/chef/cookbooks/toaster/recipes/pre__gitosis__default.rb +17 -0
  126. data/chef/cookbooks/toaster/recipes/pre__kafka__default.rb +3 -0
  127. data/chef/cookbooks/toaster/recipes/pre__munin__server.rb +6 -0
  128. data/chef/cookbooks/toaster/recipes/pre__mysql__server.rb +4 -0
  129. data/chef/cookbooks/toaster/recipes/pre__nagios__default.rb +3 -0
  130. data/chef/cookbooks/toaster/recipes/pre__netkernel__default.rb +24 -0
  131. data/chef/cookbooks/toaster/recipes/pre__php__default.rb +2 -0
  132. data/chef/cookbooks/toaster/recipes/pre__postgresql__server.rb +3 -0
  133. data/chef/cookbooks/toaster/recipes/pre__pxe_dust__default.rb +9 -0
  134. data/chef/cookbooks/toaster/recipes/pre__pxe_install_server__default.rb +6 -0
  135. data/chef/cookbooks/toaster/recipes/pre__riak__default.rb +40 -0
  136. data/chef/cookbooks/toaster/recipes/pre__sensu__default.rb +9 -0
  137. data/chef/cookbooks/toaster/recipes/pre__sol__default.rb +2 -0
  138. data/chef/cookbooks/toaster/recipes/pre__solr__default.rb +6 -0
  139. data/chef/cookbooks/toaster/recipes/pre__sonar__default.rb +2 -0
  140. data/chef/cookbooks/toaster/recipes/pre__storm__default.rb +3 -0
  141. data/chef/cookbooks/toaster/recipes/pre__vmware__tools.rb +4 -0
  142. data/chef/cookbooks/toaster/recipes/pre__wordpress__default.rb +17 -0
  143. data/chef/cookbooks/toaster/recipes/pre__xen__default.rb +7 -0
  144. data/chef/cookbooks/toaster/recipes/pre__znc__default.rb +7 -0
  145. data/chef/cookbooks/toaster/recipes/testing.rb +241 -0
  146. data/chef/cookbooks/toaster/recipes/testing_post.rb +36 -0
  147. data/chef/cookbooks/yum/CHANGELOG.md +212 -0
  148. data/chef/cookbooks/yum/README.md +268 -0
  149. data/chef/cookbooks/yum/attributes/main.rb +97 -0
  150. data/chef/cookbooks/yum/libraries/matchers.rb +27 -0
  151. data/chef/cookbooks/yum/metadata.json +34 -0
  152. data/chef/cookbooks/yum/metadata.rb +13 -0
  153. data/chef/cookbooks/yum/providers/globalconfig.rb +37 -0
  154. data/chef/cookbooks/yum/providers/repository.rb +85 -0
  155. data/chef/cookbooks/yum/recipes/default.rb +34 -0
  156. data/chef/cookbooks/yum/resources/globalconfig.rb +105 -0
  157. data/chef/cookbooks/yum/resources/repository.rb +63 -0
  158. data/chef/cookbooks/yum/templates/default/main.erb +251 -0
  159. data/chef/cookbooks/yum/templates/default/repo.erb +109 -0
  160. data/chef/cookbooks/yum-mysql-community/CHANGELOG.md +67 -0
  161. data/chef/cookbooks/yum-mysql-community/README.md +137 -0
  162. data/chef/cookbooks/yum-mysql-community/attributes/mysql-connectors-community.rb +31 -0
  163. data/chef/cookbooks/yum-mysql-community/attributes/mysql55-community.rb +29 -0
  164. data/chef/cookbooks/yum-mysql-community/attributes/mysql56-community.rb +31 -0
  165. data/chef/cookbooks/yum-mysql-community/files/default/mysql_pubkey.asc +33 -0
  166. data/chef/cookbooks/yum-mysql-community/metadata.json +30 -0
  167. data/chef/cookbooks/yum-mysql-community/metadata.rb +8 -0
  168. data/chef/cookbooks/yum-mysql-community/recipes/connectors.rb +48 -0
  169. data/chef/cookbooks/yum-mysql-community/recipes/mysql55.rb +48 -0
  170. data/chef/cookbooks/yum-mysql-community/recipes/mysql56.rb +48 -0
  171. data/config.json +34 -0
  172. data/lib/toaster/api.rb +447 -0
  173. data/lib/toaster/chef/chef_listener.rb +514 -0
  174. data/lib/toaster/chef/chef_node_inspector.rb +165 -0
  175. data/lib/toaster/chef/chef_util.rb +865 -0
  176. data/lib/toaster/chef/failsafe_resource_parser.rb +140 -0
  177. data/lib/toaster/chef/resource_inspector.rb +536 -0
  178. data/lib/toaster/db/cache.rb +98 -0
  179. data/lib/toaster/db/cached_db.rb +53 -0
  180. data/lib/toaster/db/cgi_session_cache.rb +209 -0
  181. data/lib/toaster/db/db.rb +98 -0
  182. data/lib/toaster/db/mysql.rb +18 -0
  183. data/lib/toaster/db/ram_cache.rb +203 -0
  184. data/lib/toaster/markup/jdom-1.1.jar +0 -0
  185. data/lib/toaster/markup/jdom-b7.jar +0 -0
  186. data/lib/toaster/markup/markup_util.rb +437 -0
  187. data/lib/toaster/markup/vmtools-utils-0.5.jar +0 -0
  188. data/lib/toaster/markup/xmldiff.sh +5 -0
  189. data/lib/toaster/model/additional_property.rb +11 -0
  190. data/lib/toaster/model/automation.rb +218 -0
  191. data/lib/toaster/model/automation_attribute.rb +13 -0
  192. data/lib/toaster/model/automation_run.rb +104 -0
  193. data/lib/toaster/model/ignore_property.rb +11 -0
  194. data/lib/toaster/model/key_value_pair.rb +59 -0
  195. data/lib/toaster/model/run_attribute.rb +17 -0
  196. data/lib/toaster/model/state.rb +17 -0
  197. data/lib/toaster/model/state_change.rb +79 -0
  198. data/lib/toaster/model/task.rb +292 -0
  199. data/lib/toaster/model/task_execution.rb +76 -0
  200. data/lib/toaster/model/task_parameter.rb +66 -0
  201. data/lib/toaster/model/user.rb +32 -0
  202. data/lib/toaster/ohai/_disabled_/network_ports.rb +81 -0
  203. data/lib/toaster/ohai/apache/apache.rb +48 -0
  204. data/lib/toaster/ohai/cron/cron.rb +32 -0
  205. data/lib/toaster/ohai/files/_meta.rb +30 -0
  206. data/lib/toaster/ohai/files/files.rb +20 -0
  207. data/lib/toaster/ohai/gems/gems.rb +19 -0
  208. data/lib/toaster/ohai/groups/groups.rb +20 -0
  209. data/lib/toaster/ohai/iptables/iptables.rb +48 -0
  210. data/lib/toaster/ohai/mounts/mounts.rb +26 -0
  211. data/lib/toaster/ohai/mysql/mysql.rb +31 -0
  212. data/lib/toaster/ohai/packages/_meta.rb +86 -0
  213. data/lib/toaster/ohai/packages/packages.rb +33 -0
  214. data/lib/toaster/ohai/ports/ports.rb +21 -0
  215. data/lib/toaster/ohai/routes/routes.rb +25 -0
  216. data/lib/toaster/ohai/services/services.rb +42 -0
  217. data/lib/toaster/ohai/users/users.rb +17 -0
  218. data/lib/toaster/state/convergence.rb +197 -0
  219. data/lib/toaster/state/idempotence.rb +192 -0
  220. data/lib/toaster/state/ptrace_util.rb +48 -0
  221. data/lib/toaster/state/state_node.rb +105 -0
  222. data/lib/toaster/state/state_transition.rb +38 -0
  223. data/lib/toaster/state/state_transition_graph.rb +701 -0
  224. data/lib/toaster/state/syscall_tracer.rb +317 -0
  225. data/lib/toaster/state/system_state.rb +349 -0
  226. data/lib/toaster/state/transition_edge.rb +65 -0
  227. data/lib/toaster/test/test_attribute.rb +19 -0
  228. data/lib/toaster/test/test_case.rb +175 -0
  229. data/lib/toaster/test/test_coverage.rb +147 -0
  230. data/lib/toaster/test/test_coverage_goal.rb +108 -0
  231. data/lib/toaster/test/test_generator.rb +246 -0
  232. data/lib/toaster/test/test_orchestrator.rb +165 -0
  233. data/lib/toaster/test/test_result.rb +73 -0
  234. data/lib/toaster/test/test_runner.rb +394 -0
  235. data/lib/toaster/test/test_suite.rb +151 -0
  236. data/lib/toaster/test_manager.rb +281 -0
  237. data/lib/toaster/toaster_app_service.rb +141 -0
  238. data/lib/toaster/util/blocking_map.rb +80 -0
  239. data/lib/toaster/util/combinatorial.rb +58 -0
  240. data/lib/toaster/util/config.rb +103 -0
  241. data/lib/toaster/util/docker.rb +71 -0
  242. data/lib/toaster/util/logging.rb +19 -0
  243. data/lib/toaster/util/lxc.rb +383 -0
  244. data/lib/toaster/util/mem_dump.rb +38 -0
  245. data/lib/toaster/util/proxy.rb +23 -0
  246. data/lib/toaster/util/timestamp.rb +131 -0
  247. data/lib/toaster/util/util.rb +437 -0
  248. data/lib/toaster/web_ui.rb +7 -0
  249. data/webapp/Gemfile +46 -0
  250. data/webapp/Gemfile.lock +237 -0
  251. data/webapp/Rakefile +6 -0
  252. data/webapp/app/assets/fonts/font.woff +0 -0
  253. data/webapp/app/assets/images/final_state.gif +0 -0
  254. data/webapp/app/assets/images/initial_state.gif +0 -0
  255. data/webapp/app/assets/images/loading.gif +0 -0
  256. data/webapp/app/assets/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  257. data/webapp/app/assets/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  258. data/webapp/app/assets/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  259. data/webapp/app/assets/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  260. data/webapp/app/assets/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  261. data/webapp/app/assets/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  262. data/webapp/app/assets/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  263. data/webapp/app/assets/images/ui-icons_222222_256x240.png +0 -0
  264. data/webapp/app/assets/javascripts/analysis.js.coffee +3 -0
  265. data/webapp/app/assets/javascripts/application.js +16 -0
  266. data/webapp/app/assets/javascripts/execs.js.coffee +3 -0
  267. data/webapp/app/assets/javascripts/graph.js +441 -0
  268. data/webapp/app/assets/javascripts/jquery-1.7.2.js +9404 -0
  269. data/webapp/app/assets/javascripts/jquery-ui-1.8.22.js +11529 -0
  270. data/webapp/app/assets/javascripts/jquery.cookie.js +96 -0
  271. data/webapp/app/assets/javascripts/jquery.hotkeys.js +99 -0
  272. data/webapp/app/assets/javascripts/jquery.jstree.js +4551 -0
  273. data/webapp/app/assets/javascripts/jsPlumb/jquery.jsPlumb-1.3.14-all-min.js +1 -0
  274. data/webapp/app/assets/javascripts/jstree.util.js +53 -0
  275. data/webapp/app/assets/javascripts/scripts.js.coffee +3 -0
  276. data/webapp/app/assets/javascripts/settings.js.coffee +3 -0
  277. data/webapp/app/assets/javascripts/test.js.coffee +3 -0
  278. data/webapp/app/assets/javascripts/util.js.coffee +3 -0
  279. data/webapp/app/assets/stylesheets/analysis.css.scss +3 -0
  280. data/webapp/app/assets/stylesheets/application.css +49 -0
  281. data/webapp/app/assets/stylesheets/execs.css.scss +3 -0
  282. data/webapp/app/assets/stylesheets/graph.css +159 -0
  283. data/webapp/app/assets/stylesheets/jquery-ui-1.8.6.custom.css +572 -0
  284. data/webapp/app/assets/stylesheets/layout.css +151 -0
  285. data/webapp/app/assets/stylesheets/menu.css +186 -0
  286. data/webapp/app/assets/stylesheets/reset.css +41 -0
  287. data/webapp/app/assets/stylesheets/scripts.css.scss +3 -0
  288. data/webapp/app/assets/stylesheets/settings.css.scss +3 -0
  289. data/webapp/app/assets/stylesheets/test.css.scss +3 -0
  290. data/webapp/app/assets/stylesheets/util.css.scss +3 -0
  291. data/webapp/app/assets/stylesheets/websymbols/websymbols-regular-webfont.eot +0 -0
  292. data/webapp/app/assets/stylesheets/websymbols/websymbols-regular-webfont.svg +1 -0
  293. data/webapp/app/assets/stylesheets/websymbols/websymbols-regular-webfont.ttf +0 -0
  294. data/webapp/app/assets/stylesheets/websymbols/websymbols-regular-webfont.woff +0 -0
  295. data/webapp/app/controllers/analysis_controller.rb +7 -0
  296. data/webapp/app/controllers/application_controller.rb +14 -0
  297. data/webapp/app/controllers/base_controller.rb +91 -0
  298. data/webapp/app/controllers/execs_controller.rb +59 -0
  299. data/webapp/app/controllers/graph_controller.rb +17 -0
  300. data/webapp/app/controllers/scripts_controller.rb +166 -0
  301. data/webapp/app/controllers/settings_controller.rb +10 -0
  302. data/webapp/app/controllers/test_controller.rb +127 -0
  303. data/webapp/app/controllers/util_controller.rb +6 -0
  304. data/webapp/app/helpers/analysis_helper.rb +2 -0
  305. data/webapp/app/helpers/application_helper.rb +2 -0
  306. data/webapp/app/helpers/automations_helper.rb +2 -0
  307. data/webapp/app/helpers/execs_helper.rb +2 -0
  308. data/webapp/app/helpers/scripts_helper.rb +2 -0
  309. data/webapp/app/helpers/settings_helper.rb +2 -0
  310. data/webapp/app/helpers/test_helper.rb +2 -0
  311. data/webapp/app/helpers/util_helper.rb +2 -0
  312. data/webapp/app/views/analysis/convergence.html.erb +156 -0
  313. data/webapp/app/views/analysis/idempotence.html.erb +2 -0
  314. data/webapp/app/views/execs/automation_runs.html.erb +98 -0
  315. data/webapp/app/views/execs/task_executions.html.erb +154 -0
  316. data/webapp/app/views/graph/graph_frame.html +101 -0
  317. data/webapp/app/views/layouts/application.html.erb +114 -0
  318. data/webapp/app/views/scripts/edit.html.erb +58 -0
  319. data/webapp/app/views/scripts/graph.html.erb +75 -0
  320. data/webapp/app/views/scripts/import_chef.html.erb +104 -0
  321. data/webapp/app/views/scripts/scripts.html.erb +116 -0
  322. data/webapp/app/views/scripts/tasks.html.erb +139 -0
  323. data/webapp/app/views/settings/containers.html.erb +161 -0
  324. data/webapp/app/views/settings/index.html.erb +51 -0
  325. data/webapp/app/views/test/cases.html.erb +2 -0
  326. data/webapp/app/views/test/gen.html.erb +229 -0
  327. data/webapp/app/views/test/suites.html.erb +205 -0
  328. data/webapp/app/views/util/chef.html.erb +53 -0
  329. data/webapp/bin/bundle +3 -0
  330. data/webapp/bin/rails +4 -0
  331. data/webapp/bin/rake +4 -0
  332. data/webapp/config/application.rb +28 -0
  333. data/webapp/config/boot.rb +18 -0
  334. data/webapp/config/database.yml +42 -0
  335. data/webapp/config/environment.rb +5 -0
  336. data/webapp/config/environments/development.rb +35 -0
  337. data/webapp/config/environments/production.rb +80 -0
  338. data/webapp/config/environments/test.rb +36 -0
  339. data/webapp/config/initializers/backtrace_silencers.rb +7 -0
  340. data/webapp/config/initializers/devise.rb +256 -0
  341. data/webapp/config/initializers/filter_parameter_logging.rb +4 -0
  342. data/webapp/config/initializers/inflections.rb +16 -0
  343. data/webapp/config/initializers/mime_types.rb +5 -0
  344. data/webapp/config/initializers/patches.rb +13 -0
  345. data/webapp/config/initializers/secret_token.rb +12 -0
  346. data/webapp/config/initializers/session_store.rb +6 -0
  347. data/webapp/config/initializers/wrap_parameters.rb +16 -0
  348. data/webapp/config/locales/devise.en.yml +59 -0
  349. data/webapp/config/locales/en.yml +23 -0
  350. data/webapp/config/routes.rb +113 -0
  351. data/webapp/config.ru +4 -0
  352. data/webapp/db/development.sqlite3 +0 -0
  353. data/webapp/db/migrate/20140624002037_devise_create_users.rb +42 -0
  354. data/webapp/db/migrate/20140628002058_create_all_tables.rb +159 -0
  355. data/webapp/db/schema.rb +162 -0
  356. data/webapp/db/seeds.rb +7 -0
  357. data/webapp/log/development.log +167823 -0
  358. data/webapp/public/404.html +58 -0
  359. data/webapp/public/422.html +58 -0
  360. data/webapp/public/500.html +57 -0
  361. data/webapp/public/favicon.ico +0 -0
  362. data/webapp/public/robots.txt +5 -0
  363. data/webapp/test/controllers/analysis_controller_test.rb +14 -0
  364. data/webapp/test/controllers/automations_controller_test.rb +49 -0
  365. data/webapp/test/controllers/execs_controller_test.rb +9 -0
  366. data/webapp/test/controllers/executions_controller_test.rb +9 -0
  367. data/webapp/test/controllers/runs_controller_test.rb +7 -0
  368. data/webapp/test/controllers/scripts_controller_test.rb +9 -0
  369. data/webapp/test/controllers/settings_controller_test.rb +9 -0
  370. data/webapp/test/controllers/test_controller_test.rb +14 -0
  371. data/webapp/test/controllers/util_controller_test.rb +9 -0
  372. data/webapp/test/fixtures/users.yml +11 -0
  373. data/webapp/test/helpers/analysis_helper_test.rb +4 -0
  374. data/webapp/test/helpers/automations_helper_test.rb +4 -0
  375. data/webapp/test/helpers/execs_helper_test.rb +4 -0
  376. data/webapp/test/helpers/executions_helper_test.rb +4 -0
  377. data/webapp/test/helpers/runs_helper_test.rb +4 -0
  378. data/webapp/test/helpers/scripts_helper_test.rb +4 -0
  379. data/webapp/test/helpers/settings_helper_test.rb +4 -0
  380. data/webapp/test/helpers/test_helper_test.rb +4 -0
  381. data/webapp/test/helpers/util_helper_test.rb +4 -0
  382. data/webapp/test/models/user_test.rb +7 -0
  383. data/webapp/test/test_helper.rb +15 -0
  384. data/webapp/tmp/cache/assets/development/sass/1330a34c6b24ed44c0f194c03246f627289a985a/analysis.css.scssc +0 -0
  385. data/webapp/tmp/cache/assets/development/sass/1330a34c6b24ed44c0f194c03246f627289a985a/automations.css.scssc +0 -0
  386. data/webapp/tmp/cache/assets/development/sass/1330a34c6b24ed44c0f194c03246f627289a985a/execs.css.scssc +0 -0
  387. data/webapp/tmp/cache/assets/development/sass/1330a34c6b24ed44c0f194c03246f627289a985a/executions.css.scssc +0 -0
  388. data/webapp/tmp/cache/assets/development/sass/1330a34c6b24ed44c0f194c03246f627289a985a/scripts.css.scssc +0 -0
  389. data/webapp/tmp/cache/assets/development/sass/1330a34c6b24ed44c0f194c03246f627289a985a/settings.css.scssc +0 -0
  390. data/webapp/tmp/cache/assets/development/sass/1330a34c6b24ed44c0f194c03246f627289a985a/test.css.scssc +0 -0
  391. data/webapp/tmp/cache/assets/development/sass/1330a34c6b24ed44c0f194c03246f627289a985a/util.css.scssc +0 -0
  392. data/webapp/tmp/cache/assets/development/sprockets/06a1cdb3d5472dd126cffc18f548c342 +0 -0
  393. data/webapp/tmp/cache/assets/development/sprockets/0dc0562647e703ca0535da3b9fcad796 +0 -0
  394. data/webapp/tmp/cache/assets/development/sprockets/113f1c71cb0f2a786729477989122982 +0 -0
  395. data/webapp/tmp/cache/assets/development/sprockets/13fe41fee1fe35b49d145bcc06610705 +0 -0
  396. data/webapp/tmp/cache/assets/development/sprockets/151a1c6b128721d8923ba0c380a2af17 +0 -0
  397. data/webapp/tmp/cache/assets/development/sprockets/1722fb8a6daad566c8a6d5ef31969459 +0 -0
  398. data/webapp/tmp/cache/assets/development/sprockets/1a05555c46560c6b246aa0a996679bc6 +0 -0
  399. data/webapp/tmp/cache/assets/development/sprockets/1cb7fb6aa8bd1c2b7df8f7c52442e345 +0 -0
  400. data/webapp/tmp/cache/assets/development/sprockets/1d76f803b0a83adc5ea7e7c848657967 +0 -0
  401. data/webapp/tmp/cache/assets/development/sprockets/200152f95fc464d69c425ed8fdc2fbcc +0 -0
  402. data/webapp/tmp/cache/assets/development/sprockets/2049c8927ebd046c8a3291f81041d5f1 +0 -0
  403. data/webapp/tmp/cache/assets/development/sprockets/207907100aabd08a6767e39a95b364e3 +0 -0
  404. data/webapp/tmp/cache/assets/development/sprockets/249e2d4db815922fc72419c4a1407caf +0 -0
  405. data/webapp/tmp/cache/assets/development/sprockets/2f5173deea6c795b8fdde723bb4b63af +0 -0
  406. data/webapp/tmp/cache/assets/development/sprockets/3034e4c334b1ebed9433e33050555f18 +0 -0
  407. data/webapp/tmp/cache/assets/development/sprockets/316c88d859cc3666044e51b1dd89e872 +0 -0
  408. data/webapp/tmp/cache/assets/development/sprockets/347f43d816178c8ba11a28a771696924 +0 -0
  409. data/webapp/tmp/cache/assets/development/sprockets/357970feca3ac29060c1e3861e2c0953 +0 -0
  410. data/webapp/tmp/cache/assets/development/sprockets/36ab92a3b8d527ed1eff0944b5f1263d +0 -0
  411. data/webapp/tmp/cache/assets/development/sprockets/3893b852ff196f05ff6ca8e38bb2237f +0 -0
  412. data/webapp/tmp/cache/assets/development/sprockets/3c358bd5fa32d151c7aa44971dd9b96f +0 -0
  413. data/webapp/tmp/cache/assets/development/sprockets/3ce88fad85146e0bed233f5419c24d29 +0 -0
  414. data/webapp/tmp/cache/assets/development/sprockets/3dabcb7c89677292e1e019a9bac446e5 +0 -0
  415. data/webapp/tmp/cache/assets/development/sprockets/4116fac01e6d379ede37af725a592477 +0 -0
  416. data/webapp/tmp/cache/assets/development/sprockets/42628e032b8f0b16a5ba01a1fcc7b6d7 +0 -0
  417. data/webapp/tmp/cache/assets/development/sprockets/437b258a98e8fe2c87fa8e24b7ce9abf +0 -0
  418. data/webapp/tmp/cache/assets/development/sprockets/43e98ed206f05738ae305e7e1b09a840 +0 -0
  419. data/webapp/tmp/cache/assets/development/sprockets/468da8933ba442b88b2f4b0e40c2ac30 +0 -0
  420. data/webapp/tmp/cache/assets/development/sprockets/48ef3fa68e9084c7cfa84e525decc318 +0 -0
  421. data/webapp/tmp/cache/assets/development/sprockets/4b68dcc030691297629a7156361018dc +0 -0
  422. data/webapp/tmp/cache/assets/development/sprockets/50368b1bd77c9130d821cbad89ab83ac +0 -0
  423. data/webapp/tmp/cache/assets/development/sprockets/511a980807b8d16fc3fb839991041865 +0 -0
  424. data/webapp/tmp/cache/assets/development/sprockets/516a0973874a73d0d15feec9448f7466 +0 -0
  425. data/webapp/tmp/cache/assets/development/sprockets/569e21b0ca1a230c7880f8d7a8b1febf +0 -0
  426. data/webapp/tmp/cache/assets/development/sprockets/5b5543d2ed5bed100f1739fc12ebf2c5 +0 -0
  427. data/webapp/tmp/cache/assets/development/sprockets/5c10dbffb918651dc0498579ba9a6853 +0 -0
  428. data/webapp/tmp/cache/assets/development/sprockets/5c366b5370316b3e9c03d1a58cb5eb44 +0 -0
  429. data/webapp/tmp/cache/assets/development/sprockets/5fcb9466e0d5cb0e31b35957fe2d3901 +0 -0
  430. data/webapp/tmp/cache/assets/development/sprockets/61da396fb86c5ecd844a2d83ac759b4b +0 -0
  431. data/webapp/tmp/cache/assets/development/sprockets/624ba87170059068845a4651b3cd2c7c +0 -0
  432. data/webapp/tmp/cache/assets/development/sprockets/6391f61b6121feda70da6d0a22520fdd +0 -0
  433. data/webapp/tmp/cache/assets/development/sprockets/653a981829c12a52bd57b7918168a148 +0 -0
  434. data/webapp/tmp/cache/assets/development/sprockets/66479793d9e5683d9f7fa67522d1962d +0 -0
  435. data/webapp/tmp/cache/assets/development/sprockets/69c589bd224ee0df5ab02e4568e0ab39 +0 -0
  436. data/webapp/tmp/cache/assets/development/sprockets/6dd7c564897b7e66eecbb180baeef2c6 +0 -0
  437. data/webapp/tmp/cache/assets/development/sprockets/6e2b92a4e6966cb78e63207bc7888391 +0 -0
  438. data/webapp/tmp/cache/assets/development/sprockets/70adb410f59a0edc5aea8c2b2ef8a441 +0 -0
  439. data/webapp/tmp/cache/assets/development/sprockets/72cbfd5bf33945bcce154f7a4feaf04d +0 -0
  440. data/webapp/tmp/cache/assets/development/sprockets/740ee9d355ada8cf5e9beb620f2cd5cc +0 -0
  441. data/webapp/tmp/cache/assets/development/sprockets/74770a22b5d1b0b3bc3527da83706f96 +0 -0
  442. data/webapp/tmp/cache/assets/development/sprockets/759bf97655af50852816720db7b59fcb +0 -0
  443. data/webapp/tmp/cache/assets/development/sprockets/76e9c19246c684413a02af695fa2b0bc +0 -0
  444. data/webapp/tmp/cache/assets/development/sprockets/7728beeace48ca12e336d2bce0158871 +0 -0
  445. data/webapp/tmp/cache/assets/development/sprockets/77f49730c7b689f75a2e174fbd3ace2a +0 -0
  446. data/webapp/tmp/cache/assets/development/sprockets/78021a57030fd36cf82699aad9910b26 +0 -0
  447. data/webapp/tmp/cache/assets/development/sprockets/796b349b06da691fe5f069f9e3947fcb +0 -0
  448. data/webapp/tmp/cache/assets/development/sprockets/79e7505c70697cc7d34d4a8351c3b840 +0 -0
  449. data/webapp/tmp/cache/assets/development/sprockets/7b2b7d9034fc7b77daf5da1436667e6f +0 -0
  450. data/webapp/tmp/cache/assets/development/sprockets/7c2ea2ca2cdd89b062bf23f44e8f599c +0 -0
  451. data/webapp/tmp/cache/assets/development/sprockets/7ea112af55e6df12cdff377052b71420 +0 -0
  452. data/webapp/tmp/cache/assets/development/sprockets/7f27632588dd316836b009a621c0176c +0 -0
  453. data/webapp/tmp/cache/assets/development/sprockets/7fcef9f644290dea8d0e4bf13f6bb8e9 +0 -0
  454. data/webapp/tmp/cache/assets/development/sprockets/81c6bf67419a29257ed79f442c24907d +0 -0
  455. data/webapp/tmp/cache/assets/development/sprockets/83656ce9260eb473c1654420e0180167 +0 -0
  456. data/webapp/tmp/cache/assets/development/sprockets/83e8bdddefc2dce069b56e6650135397 +0 -0
  457. data/webapp/tmp/cache/assets/development/sprockets/880c796f41e5d67ae68ed239acfc91e3 +0 -0
  458. data/webapp/tmp/cache/assets/development/sprockets/8c1c39dd537d2c9990fe9c70a5646b06 +0 -0
  459. data/webapp/tmp/cache/assets/development/sprockets/8d763042da5254015767385ce324b348 +0 -0
  460. data/webapp/tmp/cache/assets/development/sprockets/91e1ccbf65ff4d9b0f42b1159796bcf2 +0 -0
  461. data/webapp/tmp/cache/assets/development/sprockets/92cdfac7698b6bb68983cf317c1cedef +0 -0
  462. data/webapp/tmp/cache/assets/development/sprockets/94cab8cbc120e152ce4c444492a3fc1d +0 -0
  463. data/webapp/tmp/cache/assets/development/sprockets/96b918c3c041b6a089c8adc870fa3aaa +0 -0
  464. data/webapp/tmp/cache/assets/development/sprockets/97cbe306627b432ab3bfb52416690d1d +0 -0
  465. data/webapp/tmp/cache/assets/development/sprockets/98da83d396c0c00eb03937ecbc2e6bfa +0 -0
  466. data/webapp/tmp/cache/assets/development/sprockets/9db04db20ec9c4a0f84ed01caa5e6e2b +0 -0
  467. data/webapp/tmp/cache/assets/development/sprockets/9dc1c251f50c828fae95d6107619c53e +0 -0
  468. data/webapp/tmp/cache/assets/development/sprockets/9e91711ab34bbf89ad1cfb4351027d36 +0 -0
  469. data/webapp/tmp/cache/assets/development/sprockets/9f587881f98b328b656e6456178418b5 +0 -0
  470. data/webapp/tmp/cache/assets/development/sprockets/9fc981560caba00621bb95d0974ad076 +0 -0
  471. data/webapp/tmp/cache/assets/development/sprockets/9fd4385f8fda99f3ddd3f133a89231d1 +0 -0
  472. data/webapp/tmp/cache/assets/development/sprockets/a32ab71649e3db15eca95bcc3a7588da +0 -0
  473. data/webapp/tmp/cache/assets/development/sprockets/a497c976969bdbb1f69875358d39d3b5 +0 -0
  474. data/webapp/tmp/cache/assets/development/sprockets/b06058d455770c1d9db6b6670bc4bf4d +0 -0
  475. data/webapp/tmp/cache/assets/development/sprockets/b3da405f1e68470ad6146a1322f2438c +0 -0
  476. data/webapp/tmp/cache/assets/development/sprockets/b4ba5853663f6721d15942ce08dd76bf +0 -0
  477. data/webapp/tmp/cache/assets/development/sprockets/b6f1534bcdbff92a16c85487f363235a +0 -0
  478. data/webapp/tmp/cache/assets/development/sprockets/b9c57b9750f8af3551b1a5d9e27f0a92 +0 -0
  479. data/webapp/tmp/cache/assets/development/sprockets/bb5be6a0ee889a15214e2442aee8c6e1 +0 -0
  480. data/webapp/tmp/cache/assets/development/sprockets/bc80a81b2d67b5ad40f3c7a2bb6e6f22 +0 -0
  481. data/webapp/tmp/cache/assets/development/sprockets/bfaba27d5ce71d292f453659b0755511 +0 -0
  482. data/webapp/tmp/cache/assets/development/sprockets/bfac6cd2984fbd5e0d762389e3c37164 +0 -0
  483. data/webapp/tmp/cache/assets/development/sprockets/c17bec9e3b5db6d8385c3d6eb362e628 +0 -0
  484. data/webapp/tmp/cache/assets/development/sprockets/c1a9eceddc0a1e41eb2992e9204f71e6 +0 -0
  485. data/webapp/tmp/cache/assets/development/sprockets/c50cd87be040044504b5c3fde1047e24 +0 -0
  486. data/webapp/tmp/cache/assets/development/sprockets/c5907cfd07b24ad19b8c80e8af618a57 +0 -0
  487. data/webapp/tmp/cache/assets/development/sprockets/c8da5594caf845a183dd1c6cd45c5433 +0 -0
  488. data/webapp/tmp/cache/assets/development/sprockets/cbc6968ed49fa14db439a64dd0a46abc +0 -0
  489. data/webapp/tmp/cache/assets/development/sprockets/cedf710ee090647b81c08675583eca62 +0 -0
  490. data/webapp/tmp/cache/assets/development/sprockets/cf1e3cebfad43293c3c470a5e437ebc9 +0 -0
  491. data/webapp/tmp/cache/assets/development/sprockets/cffd775d018f68ce5dba1ee0d951a994 +0 -0
  492. data/webapp/tmp/cache/assets/development/sprockets/d5a14f86bb4b422fdd8eb4722d966c9a +0 -0
  493. data/webapp/tmp/cache/assets/development/sprockets/d66b9cdd3230f9e5354e495e17097c49 +0 -0
  494. data/webapp/tmp/cache/assets/development/sprockets/d771ace226fc8215a3572e0aa35bb0d6 +0 -0
  495. data/webapp/tmp/cache/assets/development/sprockets/dfa0ed87d851222fe58ada385e3f037d +0 -0
  496. data/webapp/tmp/cache/assets/development/sprockets/e1aa402390382db4d97b27cb094485fa +0 -0
  497. data/webapp/tmp/cache/assets/development/sprockets/e4f1db35ef9d9fbbf53252a44e381eb8 +0 -0
  498. data/webapp/tmp/cache/assets/development/sprockets/e57eb6c1ad51fd8c13afc0e719a259b5 +0 -0
  499. data/webapp/tmp/cache/assets/development/sprockets/e7c37b542e914e392ec326190cea1aa2 +0 -0
  500. data/webapp/tmp/cache/assets/development/sprockets/e923d7e19c216d4a924831f3896e007a +0 -0
  501. data/webapp/tmp/cache/assets/development/sprockets/e96a414a621483bbc89e73f11be5e7b4 +0 -0
  502. data/webapp/tmp/cache/assets/development/sprockets/eafcfc3d2561c18743c1b32f0f710c68 +0 -0
  503. data/webapp/tmp/cache/assets/development/sprockets/ecdd630f5466d45a2afa7515aaa5fc3b +0 -0
  504. data/webapp/tmp/cache/assets/development/sprockets/ee60a0a35d60cff425373970547694bd +0 -0
  505. data/webapp/tmp/cache/assets/development/sprockets/eee2c36b75709b0c3797c2a151fdd5d3 +0 -0
  506. data/webapp/tmp/cache/assets/development/sprockets/f104b66c0f89b453d0c8c73980fbab18 +0 -0
  507. data/webapp/tmp/cache/assets/development/sprockets/f26d1bc86590415685e9836ad75d1774 +0 -0
  508. data/webapp/tmp/cache/assets/development/sprockets/f4081e868eb565527099dba2c9d8c4de +0 -0
  509. data/webapp/tmp/cache/assets/development/sprockets/f7cbd26ba1d28d48de824f0e94586655 +0 -0
  510. data/webapp/tmp/cache/assets/development/sprockets/f813030b97e30415ad276bbd1f7e1fb4 +0 -0
  511. data/webapp/tmp/cache/assets/development/sprockets/f8e3e28bc9640c25da58aea46c3ac4b3 +0 -0
  512. data/webapp/tmp/cache/assets/development/sprockets/f9169d0a8b70eaf95de52b3c6ad51105 +0 -0
  513. data/webapp/tmp/cache/assets/development/sprockets/f939450f7a481e3fbeb158b81b39c624 +0 -0
  514. data/webapp/tmp/cache/assets/development/sprockets/fce73296b8298ac4c74b3e95cde4dfdb +0 -0
  515. metadata +941 -0
@@ -0,0 +1,140 @@
1
+ #
2
+ # Author: Waldemar Hummer (hummer@dsg.tuwien.ac.at)
3
+ #
4
+
5
+ require 'toaster/chef/chef_node_inspector'
6
+
7
+ # $old_node and $new_node must be set before calling this script!
8
+
9
+ class ::Chef
10
+ class Node
11
+ def attributes_proxy=(attrs)
12
+ @attributes_proxy = attrs
13
+ end
14
+ def method_missing(sym, *args, &block)
15
+ @attributes_proxy.send(sym, *args, &block)
16
+ end
17
+ end
18
+
19
+ class Resource
20
+ def method_missing(method_symbol, *args, &block)
21
+ # code copied from chef/resource.rb
22
+ if enclosing_provider && enclosing_provider.respond_to?(method_symbol)
23
+ enclosing_provider.send(method_symbol, *args, &block)
24
+ else
25
+ $new_node.send(method_symbol, *args, &block)
26
+ end
27
+ end
28
+ def resources(*args)
29
+ begin
30
+ super
31
+ rescue Object
32
+ nil
33
+ end
34
+ end
35
+ def notifies(action, resource_spec, timing=:delayed)
36
+ begin
37
+ super
38
+ rescue Object
39
+ nil
40
+ end
41
+ end
42
+ end
43
+
44
+ module Mixin
45
+ module ParamsValidate
46
+ def validate(opts, map)
47
+ begin
48
+ super
49
+ rescue Object
50
+ nil
51
+ end
52
+ end
53
+ end
54
+ end
55
+
56
+ module DSL
57
+ module Recipe
58
+ #alias_method :old_method_missing, :method_missing
59
+ $old_mm = ::Chef::DSL::Recipe.instance_method(:method_missing)
60
+ def attributes_proxy=(attrs)
61
+ @attributes_proxy = attrs
62
+ end
63
+ def respond_to?(sym, included_privates = false)
64
+ true
65
+ end
66
+ def respond_to_missing?(sym, included_privates = false)
67
+ true
68
+ end
69
+ def instance_eval(string, filename=nil, lineno=nil, &block)
70
+ begin
71
+ super
72
+ rescue Object => ex
73
+ puts "WARN: cannot run instance_eval on recipe: #{ex}"
74
+ end
75
+ end
76
+ # def build_resource(type, name, created_at=nil, &resource_attrs_block)
77
+ # if !name
78
+ # name = "__unnamed__"
79
+ # end
80
+ # super(type, name, created_at, &resource_attrs_block)
81
+ # end
82
+ def method_missing(method_symbol, *args, &block)
83
+ #puts "method_missing:"
84
+ puts method_symbol
85
+ begin
86
+
87
+ # code copied from chef/dsl/recipe.rb
88
+
89
+ # If we have a definition that matches, we want to use that instead. This should
90
+ # let you do some really crazy over-riding of "native" types, if you really want
91
+ # to.
92
+ if has_resource_definition?(method_symbol)
93
+ evaluate_resource_definition(method_symbol, *args, &block)
94
+ elsif have_resource_class_for?(method_symbol)
95
+ # Otherwise, we're rocking the regular resource call route.
96
+ declare_resource(method_symbol, args[0] && !args[0].empty? ? args[0] : "__some_name__", caller[0], &block)
97
+ else
98
+ begin
99
+ super
100
+ rescue NoMethodError
101
+ raise NoMethodError, "No resource or method named `#{method_symbol}' for #{describe_self_for_error}"
102
+ rescue NameError
103
+ raise NameError, "No resource, method, or local variable named `#{method_symbol}' for #{describe_self_for_error}"
104
+ end
105
+ end
106
+
107
+ #old_method_missing(method_symbol, args, block)
108
+ #super
109
+ if caller.size > 250
110
+ puts $old_mm.object_id
111
+ puts "--"
112
+ puts ::Chef::DSL::Recipe.instance_method(:method_missing).object_id
113
+ puts "-------"
114
+ return nil
115
+ end
116
+ # puts "--->"
117
+ # puts self
118
+ # $old_mm.bind(self).(method_symbol, *args, &block)
119
+ rescue Object => ex
120
+ # begin
121
+ #puts ex
122
+ #puts ex.backtrace.join(" \n")
123
+ proxy = @attributes_proxy ? @attributes_proxy : $new_node
124
+ #puts "proxy (in new line):"
125
+ #puts proxy
126
+ #puts method_symbol
127
+ proxy.send(method_symbol, *args, &block)
128
+ # rescue Object => ex1
129
+ # puts ex1
130
+ # puts ex1.backtrace.join(" \n")
131
+ # puts "----"
132
+ # puts caller
133
+ # end
134
+ end
135
+ end
136
+ end
137
+ end
138
+ end
139
+
140
+
@@ -0,0 +1,536 @@
1
+
2
+
3
+ #
4
+ # Author: Waldemar Hummer (hummer@dsg.tuwien.ac.at)
5
+ #
6
+
7
+ require 'chef/log'
8
+ require 'chef/run_context'
9
+ require 'chef/client'
10
+ require 'chef/application/solo'
11
+ require 'toaster/chef/chef_util'
12
+ require 'toaster/markup/markup_util'
13
+ require "toaster/model/task_parameter"
14
+ require "toaster/model/task"
15
+
16
+ module Toaster
17
+ class ResourceInspector
18
+
19
+ STATECHANGE_PACKAGES = "packages"
20
+ STATECHANGE_PORTS = "ports"
21
+ STATECHANGE_FILES = "files"
22
+ STATECHANGE_GEMS = "gems"
23
+ STATECHANGE_MOUNTS = "mounts"
24
+ STATECHANGE_USERS = "users"
25
+ STATECHANGE_GROUPS = "groups"
26
+ STATECHANGE_CRON = "cron"
27
+ STATECHANGE_SERVICES = "services"
28
+ STATECHANGE_ROUTES = "routes"
29
+ STATECHANGE_MYSQL = "mysql"
30
+ STATECHANGE_APACHE = "apache"
31
+ STATECHANGE_IPTABLES = "iptables"
32
+
33
+ @@initialized = false
34
+ #@@state_config_cache = {} # caching doesn't work here anymore
35
+
36
+ def self.get_accessed_parameters(task_or_sourcecode, cookbook_paths = [])
37
+ result = []
38
+ resource_src = task_or_sourcecode.respond_to?("sourcecode") ?
39
+ task_or_sourcecode.sourcecode : task_or_sourcecode.to_s
40
+ symbol = ":[a-zA-Z0-9_]+"
41
+ numeric_index = "[0-9]+"
42
+ quoted_string1 = '"[^\\]]+"'
43
+ quoted_string2 = "'[^\\]]+'"
44
+ resource_src.scan(/node((\[((#{symbol})|(#{numeric_index})|(#{quoted_string1})|(#{quoted_string2}))\][ \t]*)+)/).each do |param|
45
+ param = param[0].strip
46
+ param = MarkupUtil.convert_array_to_dot_notation(param)
47
+ if task_or_sourcecode.kind_of?(Task)
48
+ param = TaskParameter.new(task_or_sourcecode, param)
49
+ else
50
+ param = TaskParameter.new(nil, param)
51
+ end
52
+ exists = result.find { |p| (p.kind_of?(TaskParameter) ? p.key : p) ==
53
+ (param.kind_of?(TaskParameter) ? param.key : param) }
54
+ #puts "exists: #{param} - #{exists}"
55
+ if !exists
56
+ result << param
57
+ end
58
+ end
59
+ return result
60
+ end
61
+
62
+ #
63
+ # Returns a hash which maps identifier=>configurations, indicating which types
64
+ # of state changes this task, upon execution, is *potentially* going to
65
+ # perform. For instance, if the task starts/stops a system service,
66
+ # the identifier "ports" will be in the hash keys. If the task modifies
67
+ # some files, the key will contain the identifier "files", and possibly a list of
68
+ # potential files that may be edited.
69
+ # This helps us to develop tailor-made state capturing tools (e.g., implemented
70
+ # as ohai plugins) for different types of tasks.
71
+ #
72
+ def self.get_config_for_potential_state_changes(task_or_sourcecode,
73
+ cookbook_paths = [], state_change_config = {})
74
+ data = parse_data(task_or_sourcecode, cookbook_paths, state_change_config)
75
+ return data[0]
76
+ end
77
+
78
+ def self.guess_potential_state_changes(task_or_sourcecode, cookbook_paths = [], state_change_config = {})
79
+ data = parse_data(task_or_sourcecode, cookbook_paths, state_change_config)
80
+ return data[1]
81
+ end
82
+
83
+ def self.get_resource_from_source(resource_src, attribute_src, cookbook_paths = [])
84
+ resource = nil
85
+
86
+ # we are performing multiple parsing attempts. if parsing goes well,
87
+ # the resource is returned. however, if a parsing error occurs, we
88
+ # investigate the error message, and for missing variables we add a default
89
+ # initializer to the beginning of the source code. Then, we re-attempt
90
+ # to parse the code.
91
+ # The maximum number of such attempts is defined here.
92
+ max_attempts = 20
93
+
94
+ chef_client_json = {
95
+ "platform" => "ubuntu",
96
+ "platform_version" => "12.04",
97
+ "kernel" => { "machine" => "x86_64" },
98
+ "log_level" => :fatal,
99
+ "ipaddress" => ""
100
+ }
101
+
102
+ # define some inits in script source:
103
+ preamble = "
104
+ require 'toaster/chef/chef_node_inspector'
105
+ $old_node = node
106
+ $new_node = Toaster::DefaultProcessorRecursive.new(
107
+ #{chef_client_json.inspect})
108
+
109
+ require 'toaster/chef/failsafe_resource_parser'
110
+
111
+ $old_node.attributes_proxy = $new_node
112
+ node = $new_node
113
+ template = $new_node
114
+ self.attributes_proxy = $new_node
115
+ "
116
+
117
+ attribute_src =
118
+ "#{preamble} #{attribute_src}"
119
+ # resource_src =
120
+ # "#{preamble} #{resource_src}"
121
+
122
+ #puts "getting resource source: #{resource_src}\n---"
123
+
124
+ max_attempts.downto(1) do |attempt|
125
+
126
+ Tempfile.open("chef.resource.rb") do |file|
127
+ file.write(resource_src)
128
+ file.flush
129
+
130
+ Tempfile.open("chef.attributes.rb") do |file1|
131
+ file1.write(attribute_src)
132
+ file1.flush
133
+
134
+ orig_log_level = ChefUtil.get_chef_log_level()
135
+
136
+ begin
137
+
138
+ ChefUtil.set_chef_log_level(:fatal)
139
+
140
+ if !@@initialized
141
+ chef_cfg = Chef::Config
142
+ chef_cfg[:solo] = true
143
+ chef_cfg[:node_name] = "foobar"
144
+ path_new = []
145
+ chef_cfg[:cookbook_path].each do |p|
146
+ path_new << p if File.directory?(p)
147
+ end
148
+ chef_cfg[:cookbook_path] = path_new
149
+ chef_cfg[:cookbook_path] << File.expand_path(File.join(File.dirname(__FILE__), 'cookbooks'))
150
+ chef_cfg[:cookbook_path].concat(cookbook_paths)
151
+ chef_cfg[:log_level] = :fatal
152
+ chef_cfg[:verbose_logging] = false
153
+ Chef::Application::Solo.new # this initializes some important state variables
154
+
155
+ @@chef_client = Chef::Client.new(
156
+ chef_client_json
157
+ )
158
+ begin
159
+ @@node = @@chef_client.build_node
160
+ rescue
161
+ # required to avoid exception in Chef 11.12.8
162
+ @@node = @@chef_client.policy_builder.load_node
163
+ end
164
+ @@cookbook_collection = Chef::CookbookCollection.new(
165
+ Chef::CookbookLoader.new(chef_cfg[:cookbook_path]))
166
+
167
+ @@initialized = true
168
+ end
169
+
170
+ if attribute_src && attribute_src.to_s.strip != ""
171
+ @@node.from_file(file1.path)
172
+ end
173
+
174
+ run_context = nil
175
+ begin
176
+ run_context = Chef::RunContext.new(@@node, @@cookbook_collection)
177
+ rescue
178
+ # required to avoid exception in Chef 11.12.8
179
+ run_context = Chef::RunContext.new(@@node, @@cookbook_collection, nil)
180
+ end
181
+ recipe = Chef::Recipe.new("apache2", "default", run_context)
182
+ recipe.from_file(file.path)
183
+
184
+ #puts "getting resource from recipe #{recipe}"
185
+ resource = recipe.run_context.resource_collection.all_resources[0]
186
+ #puts "returning resource: #{resource}"
187
+ #puts "--> #{recipe.run_context.resource_collection.all_resources}"
188
+
189
+ return resource
190
+ rescue Object => ex
191
+ msg = ex.to_s
192
+ puts msg if attempt <= 1
193
+ puts ex.backtrace if attempt <= 1
194
+ #puts "----"
195
+ #puts resource_src
196
+ #puts "----"
197
+ # puts msg
198
+ # puts ex.backtrace
199
+
200
+ if msg.match(/Cannot find a resource for/)
201
+ pkg_name = msg.gsub(/.*for ([a-z0-9A-Z_]+) on.*/, '\1').to_s
202
+ resource_src = "#{pkg_name} = \"initializer_for_unknown_variable_#{pkg_name}\" \n #{resource_src}"
203
+ elsif msg.match(/undefined (local variable or )?method/)
204
+ var_name = msg.gsub(/.*method `([a-z0-9A-Z_]+).* for.*/, '\1').to_s
205
+ resource_src = "#{var_name} = \"initializer_for_unknown_variable_#{var_name}\" \n #{resource_src}"
206
+ elsif msg.match(/No resource or method named `([a-z0-9A-Z_]+)' for/)
207
+ res_name = msg.gsub(/.*No resource or method named `([a-z0-9A-Z_]+)' for.*/, '\1').to_s
208
+ tmp_class_name = "MyResource#{Util.generate_short_uid()}"
209
+ resource_src =
210
+ "class #{tmp_class_name} < Chef::Resource
211
+ def initialize(name = nil, run_context = nil)
212
+ super
213
+ @resource_name = :#{res_name}
214
+ @enclosing_provider_fixed = DefaultProcessorRecursive.new
215
+ @enclosing_provider_fixed.swallow_calls_hash = {}
216
+ end
217
+ def enclosing_provider
218
+ @enclosing_provider_fixed
219
+ end
220
+ def action(arg=nil)
221
+ self.allowed_actions << arg
222
+ super
223
+ end
224
+ end
225
+ #{tmp_class_name}.provides(:#{res_name})
226
+ #{resource_src}"
227
+ elsif msg.match( /resource matching/)
228
+ regex = /.*resource matching (.*)\[(.*)\].*/
229
+ res_type = msg.gsub(regex, '\1').to_s
230
+ res_name = msg.gsub(regex, '\2').to_s
231
+ resource_src = "#{res_type} \"#{res_name}\" do \n end \n\n #{resource_src}"
232
+ else
233
+ puts "ERROR: Could not get Chef resource object from source code: #{msg}"
234
+ puts ex.backtrace.join("\n")
235
+ puts File.read(file.path)
236
+ puts "---------"
237
+ puts File.read(file1.path)
238
+ puts "---------"
239
+ return nil
240
+ end
241
+ ensure
242
+ ChefUtil.set_chef_log_level(orig_log_level)
243
+ end
244
+ end
245
+ end
246
+ end
247
+ return resource
248
+ end
249
+
250
+ private
251
+
252
+ def self.parse_data(task_or_sourcecode, cookbook_paths = [], state_change_config = {})
253
+
254
+ resource_src = task_or_sourcecode.respond_to?("sourcecode") ?
255
+ task_or_sourcecode.sourcecode : task_or_sourcecode.to_s
256
+ resource_obj = task_or_sourcecode.respond_to?("resource_obj") ?
257
+ task_or_sourcecode.resource_obj : nil
258
+ attribute_src = nil
259
+
260
+ # unfortunately, we cannot do caching anymore. Otherwise, we would lose
261
+ # potential new configurations in the state_change_config parameter..!
262
+ #return @@state_config_cache[resource_src] if @@state_config_cache[resource_src]
263
+
264
+ #puts "task_or_sourcecode.respond_to... #{task_or_sourcecode.respond_to?("sourcefile")} #{task_or_sourcecode}"
265
+ if task_or_sourcecode.respond_to?("sourcefile")
266
+ recipe_file = ChefUtil.get_absolute_file_path(cookbook_paths, task_or_sourcecode.sourcefile)
267
+ #puts "INFO: Chef recipe file: #{recipe_file}"
268
+ if recipe_file
269
+ attribute_file = ChefUtil.get_attribute_file(recipe_file)
270
+ #puts "INFO: Chef attribute file: #{attribute_file}"
271
+ if attribute_file && File.exist?(attribute_file)
272
+ if File.directory?(attribute_file)
273
+ puts "WARN: Chef attributes file is actually a directory: #{attribute_file}"
274
+ else
275
+ attribute_src = File.read(attribute_file)
276
+ end
277
+ end
278
+ end
279
+ end
280
+
281
+ resource = resource_obj ? resource_obj :
282
+ get_resource_from_source(resource_src, attribute_src, cookbook_paths)
283
+
284
+ if !resource
285
+ error = "ERROR: unable to convert source code to resource."
286
+ puts error
287
+ puts resource_src
288
+ puts "---"
289
+ puts attribute_src
290
+ puts "----"
291
+ raise error
292
+ end
293
+
294
+ config = state_change_config ? state_change_config : {}
295
+ expected_state_changes = []
296
+
297
+ chef_resource_class = Chef::Resource
298
+
299
+ if resource.kind_of?(chef_resource_class::Script) ||
300
+ resource.kind_of?(chef_resource_class::Execute) ||
301
+ resource.kind_of?(chef_resource_class::Bash)
302
+
303
+ code = resource.respond_to?("code") ? resource.code : resource.command
304
+ code = "#{code}\n------\n'#{resource.to_text}'" if resource.respond_to?("to_text")
305
+
306
+ # characters that may occur before/after certain commands
307
+ # that we search for within the script code
308
+ b = "[^a-zA-Z0-9_\\-]"
309
+ a = "[^a-zA-Z0-9_\\-]"
310
+
311
+ # try to guess some semantics of the script by
312
+ # performing simple string pattern checks
313
+ if code.match(/(^|#{b}+)mount\s+.*/)
314
+ config[STATECHANGE_MOUNTS] = {} if !config[STATECHANGE_MOUNTS]
315
+ expected_state_changes << StateChange.new(
316
+ :property => STATECHANGE_MOUNTS,
317
+ :action => StateChange::ACTION_INSERT,
318
+ :value => StateChange::VALUE_UNKNOWN)
319
+ end
320
+ if code.match(/(^|#{b}+)umount\s+.*/)
321
+ config[STATECHANGE_MOUNTS] = {} if !config[STATECHANGE_MOUNTS]
322
+ expected_state_changes << StateChange.new(
323
+ :property => STATECHANGE_MOUNTS,
324
+ :action => StateChange::ACTION_DELETE,
325
+ :value => StateChange::VALUE_UNKNOWN)
326
+ end
327
+ if code.match(/(^|#{b}+)gem((\s+)|((\s+).*(\s+)))install.*/)
328
+ config[STATECHANGE_GEMS] = {} if !config[STATECHANGE_GEMS]
329
+ expected_state_changes << StateChange.new(
330
+ :property => STATECHANGE_GEMS,
331
+ :action => StateChange::ACTION_INSERT,
332
+ :value => StateChange::VALUE_UNKNOWN)
333
+ end
334
+ if code.match(/(^|#{b}+)gem((\s+)|((\s+).*(\s+)))uninstall.*/)
335
+ config[STATECHANGE_GEMS] = {} if !config[STATECHANGE_GEMS]
336
+ expected_state_changes << StateChange.new(
337
+ :property => STATECHANGE_GEMS,
338
+ :action => StateChange::ACTION_DELETE,
339
+ :value => StateChange::VALUE_UNKNOWN)
340
+ end
341
+ if code.match(/(^|#{b}+)yum\s+.*/) ||
342
+ code.match(/(^|#{b}+)apt-get\s+.*/) ||
343
+ code.match(/(^|#{b}+)dpkg\s+.*/)
344
+ config[STATECHANGE_PACKAGES] = {} if !config[STATECHANGE_PACKAGES]
345
+ end
346
+ if code.match(/(^|#{b}+)route\s+.*/)
347
+ config[STATECHANGE_ROUTES] = {} if !config[STATECHANGE_ROUTES]
348
+ end
349
+ if code.match(/(^|#{b}+)netcat($|#{a}+)/)
350
+ config[STATECHANGE_PORTS] = {} if !config[STATECHANGE_PORTS]
351
+ end
352
+ if code.match(/(^|#{b}+)(\/usr\/bin\/)*mysql\s+.*/) ||
353
+ code.match(/(^|#{b}+)(\/usr\/bin\/)*mysqladmin\s+.*/) ||
354
+ code.match(/(^|#{b}+)Mysql.new.*/)
355
+ config[STATECHANGE_MYSQL] = {} if !config[STATECHANGE_MYSQL]
356
+ end
357
+ if code.match(/(^|#{b}+)a2enmod\s+.*/) ||
358
+ code.match(/(^|#{b}+)a2dismod\s+.*/) ||
359
+ code.match(/(^|#{b}+)a2ensite\s+.*/) ||
360
+ code.match(/(^|#{b}+)a2dissite\s+.*/)
361
+ config[STATECHANGE_APACHE] = {} if !config[STATECHANGE_APACHE]
362
+ end
363
+ if code.match(/(^|#{b}+)rebuild-iptables.*/) ||
364
+ code.match(/(^|#{b}+)iptables\s+.*/)||
365
+ code.match(/(^|#{b}+)iptables-restore.*/)
366
+ config[STATECHANGE_IPTABLES] = {} if !config[STATECHANGE_IPTABLES]
367
+ end
368
+
369
+ files = []
370
+ # put all file-related checks below this line ...
371
+ code.scan(/(^|[\s"']+)([\/a-zA-Z0-9\._\-]+)($|[\s"']+)/) {
372
+ |start,fname,str_end,full_string|
373
+ if fname
374
+ files << fname.gsub(/["']+/,"").strip
375
+ end
376
+ }
377
+ code.scan(/(^|#{b}+)((rm)|(mkdir)|(touch))\s+(\-[a-z]+\s+)*['"]*(.*)['"]*/) {
378
+ |start,cmds,cmd1,cmd2,cmd3,args,fname,full_string|
379
+ if fname
380
+ files << fname.gsub(/["']+/,"").strip
381
+ end
382
+ }
383
+ if code.match(/(^|#{b}+)((creates)|(cwd))\s+(\-[a-z]+\s+)*['"]*(.*)['"]*/)
384
+ code.scan(/(^|#{b}+)((creates)|(cwd))\s+(\-[a-z]+\s+)*['"]*(.*)['"]*/) {
385
+ |start,cmds,cmd1,cmd2,args,fname,full_string|
386
+ if fname
387
+ files << fname.gsub(/["']+/,"").strip
388
+ end
389
+ }
390
+ end
391
+ code.scan(/(^|#{b}+)((mv)|(cp)|(ln))\s+(\-[a-z]+\s+)*['"]*(.*)['"]*\s+['"]*(.*)['"]*/) {
392
+ |start,cmds,cmd1,cmd2,cmd3,args,fname1,fname2,full_string|
393
+ if fname1
394
+ files << fname1.gsub(/["']+/,"").strip
395
+ end
396
+ if fname2
397
+ files << fname2.gsub(/["']+/,"").strip
398
+ end
399
+ }
400
+ code.scan(/\.exist[s]?\?[\s\(]+([^\)]+)[\s\)$]/) {
401
+ |fname,full_string| files << fname.gsub(/["']+/,"")
402
+ }
403
+ if !files.empty?
404
+ #puts "DEBUG: Potential list of files extracted from file commands (e.g., rm,mkdir,touch,...): #{files.inspect}"
405
+ #puts "DEBUG: Source code is: #{code}"
406
+ #puts "DEBUG: -----------"
407
+ config[STATECHANGE_FILES] = {} if !config[STATECHANGE_FILES]
408
+ config[STATECHANGE_FILES]["paths"] = [] if !config[STATECHANGE_FILES]["paths"]
409
+ files.each do |f|
410
+ config[STATECHANGE_FILES]["paths"] << f
411
+ end
412
+ # remove duplicates
413
+ config[STATECHANGE_FILES]["paths"].uniq!
414
+ end
415
+ end
416
+
417
+ if resource.kind_of?(chef_resource_class::Package) &&
418
+ !resource.kind_of?(chef_resource_class::GemPackage)
419
+ config[STATECHANGE_PACKAGES] = {} if !config[STATECHANGE_PACKAGES]
420
+ action = [:install].include?(resource.action) ? StateChange::ACTION_INSERT :
421
+ [:upgrade, :reconfig].include?(resource.action) ? StateChange::ACTION_MODIFY :
422
+ [:remove, :purge].include?(resource.action) ? StateChange::ACTION_DELETE :
423
+ StateChange::ACTION_UNKNOWN
424
+ expected_state_changes << StateChange.new(
425
+ :property => STATECHANGE_PACKAGES,
426
+ :action => action,
427
+ :value => resource.package_name)
428
+ end
429
+
430
+ if resource.kind_of?(chef_resource_class::YumPackage)
431
+ # already covered by Chef::Resource::Package
432
+ end
433
+
434
+ if resource.kind_of?(chef_resource_class::GemPackage)
435
+ config[STATECHANGE_GEMS] = {} if !config[STATECHANGE_GEMS]
436
+ action = [:install].include?(resource.action) ? StateChange::ACTION_INSERT :
437
+ [:upgrade, :reconfig].include?(resource.action) ? StateChange::ACTION_MODIFY :
438
+ [:remove, :purge].include?(resource.action) ? StateChange::ACTION_DELETE :
439
+ StateChange::ACTION_UNKNOWN
440
+ expected_state_changes << StateChange.new(
441
+ :property => STATECHANGE_GEMS,
442
+ :action => action,
443
+ :value => resource.package_name)
444
+ end
445
+
446
+ if resource.kind_of?(chef_resource_class::File) ||
447
+ resource.kind_of?(chef_resource_class::Directory)
448
+ config[STATECHANGE_FILES] = {} if !config[STATECHANGE_FILES]
449
+ config[STATECHANGE_FILES]["paths"] = [] if !config[STATECHANGE_FILES]["paths"]
450
+ config[STATECHANGE_FILES]["paths"] << resource.path
451
+ action = [:create, :touch, :create_if_missing].include?(resource.action) ? StateChange::ACTION_INSERT :
452
+ [:delete].include?(resource.action) ? StateChange::ACTION_DELETE :
453
+ StateChange::ACTION_UNKNOWN
454
+ expected_state_changes << StateChange.new(
455
+ :property => STATECHANGE_FILES,
456
+ :action => action,
457
+ :value => resource.path)
458
+ end
459
+
460
+ if resource.kind_of?(chef_resource_class::RemoteFile)
461
+ # already covered by Chef::Resource::File
462
+ end
463
+
464
+ if resource.kind_of?(chef_resource_class::Link)
465
+ config[STATECHANGE_FILES] = {} if !config[STATECHANGE_FILES]
466
+ config[STATECHANGE_FILES]["paths"] = [] if !config[STATECHANGE_FILES]["paths"]
467
+ config[STATECHANGE_FILES]["paths"] << resource.target_file
468
+ action = [:create].include?(resource.action) ? StateChange::ACTION_INSERT :
469
+ [:delete].include?(resource.action) ? StateChange::ACTION_DELETE :
470
+ StateChange::ACTION_UNKNOWN
471
+ expected_state_changes << StateChange.new(
472
+ :property => STATECHANGE_FILES,
473
+ :action => action,
474
+ :value => resource.target_file)
475
+ end
476
+
477
+ if resource.kind_of?(chef_resource_class::User)
478
+ config[STATECHANGE_USERS] = {} if !config[STATECHANGE_USERS]
479
+ end
480
+
481
+ if resource.kind_of?(chef_resource_class::Group)
482
+ config[STATECHANGE_GROUPS] = {} if !config[STATECHANGE_GROUPS]
483
+ end
484
+
485
+ if resource.kind_of?(chef_resource_class::Cron)
486
+ config[STATECHANGE_CRON] = {} if !config[STATECHANGE_CRON]
487
+ end
488
+
489
+ if resource.kind_of?(chef_resource_class::Mount)
490
+ config[STATECHANGE_MOUNTS] = {} if !config[STATECHANGE_MOUNTS]
491
+ action = [:mount, :enable].include?(resource.action) ? StateChange::ACTION_INSERT :
492
+ [:umount, :disable].include?(resource.action) ? StateChange::ACTION_DELETE :
493
+ StateChange::ACTION_UNKNOWN
494
+ expected_state_changes << StateChange.new(
495
+ :property => STATECHANGE_MOUNTS,
496
+ :action => action,
497
+ :value => resource.mount_point)
498
+ end
499
+
500
+ if resource.kind_of?(chef_resource_class::Service)
501
+ config[STATECHANGE_SERVICES] = {} if !config[STATECHANGE_SERVICES]
502
+ config[STATECHANGE_PORTS] = {} if !config[STATECHANGE_PORTS]
503
+ action = [:enable, :start, :restart, :reload].include?(resource.action) ? StateChange::ACTION_INSERT :
504
+ [:disable, :stop].include?(resource.action) ? StateChange::ACTION_DELETE :
505
+ StateChange::ACTION_UNKNOWN
506
+ expected_state_changes << StateChange.new(
507
+ :property => STATECHANGE_SERVICES,
508
+ :action => action,
509
+ :value => resource.service_name)
510
+ end
511
+
512
+ if resource.kind_of?(chef_resource_class::Route)
513
+ config[STATECHANGE_ROUTES] = {} if !config[STATECHANGE_ROUTES]
514
+ action = [:add].include?(resource.action) ? StateChange::ACTION_INSERT :
515
+ [:delete].include?(resource.action) ? StateChange::ACTION_DELETE :
516
+ StateChange::ACTION_UNKNOWN
517
+ expected_state_changes << StateChange.new(
518
+ :property => STATECHANGE_ROUTES,
519
+ :action => action,
520
+ :value => resource.target)
521
+ end
522
+
523
+ if config.empty?
524
+ puts "WARN: Unable to determine potential state changes for automation task type '#{resource.class}'"
525
+ end
526
+
527
+ #puts "State change config: #{config.inspect}"
528
+
529
+ entry = [ config , expected_state_changes ]
530
+ #@@state_config_cache[resource_src] = entry #don't do caching..
531
+
532
+ return entry
533
+ end
534
+
535
+ end
536
+ end