Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

WIP rails3 migration

  • Loading branch information...
commit 017e1049b87d914af69a8eba8ce18720b1304357 1 parent 933ff56
Ohad Levy authored

Showing 463 changed files with 10,770 additions and 8,870 deletions. Show diff stats Hide diff stats

  1. +4 8 .gitignore
  2. +32 0 Gemfile
  3. +140 0 Gemfile.lock
  4. +3 8 Rakefile
  5. +11 8 app/controllers/application_controller.rb
  6. +0 2  app/controllers/auth_source_ldaps_controller.rb
  7. +1 1  app/controllers/bookmarks_controller.rb
  8. +1 1  app/controllers/config_templates_controller.rb
  9. +2 0  app/controllers/environments_controller.rb
  10. +0 3  app/controllers/fact_values_controller.rb
  11. +2 1  app/controllers/hostgroups_controller.rb
  12. +26 34 app/controllers/hosts_controller.rb
  13. +1 1  app/controllers/hypervisors/guests_controller.rb
  14. +0 1  app/controllers/lookup_values_controller.rb
  15. +1 1  app/controllers/media_controller.rb
  16. +3 1 app/controllers/operatingsystems_controller.rb
  17. +2 19 app/controllers/puppetclasses_controller.rb
  18. +0 3  app/controllers/reports_controller.rb
  19. +2 3 app/controllers/subnets_controller.rb
  20. +6 6 app/controllers/unattended_controller.rb
  21. +2 3 app/controllers/users_controller.rb
  22. +4 13 app/helpers/application_helper.rb
  23. +3 3 app/helpers/audits_helper.rb
  24. +6 0 app/helpers/dashboard_helper.rb
  25. +4 13 app/helpers/hosts_helper.rb
  26. +31 32 app/helpers/layout_helper.rb
  27. +1 1  app/helpers/lookup_keys_helper.rb
  28. +1 13 app/helpers/operatingsystems_helper.rb
  29. +1 1  app/helpers/puppetclasses_helper.rb
  30. +4 5 app/helpers/reports_helper.rb
  31. 0  vendor/gems/rack-1.1.0/RDOX → app/mailers/.gitkeep
  32. 0  app/models/.gitkeep
  33. +2 1  app/models/architecture.rb
  34. +6 5 app/models/auth_source_ldap.rb
  35. +1 1  app/models/authorization.rb
  36. +2 1  app/models/bookmark.rb
  37. +12 11 app/models/config_template.rb
  38. +2 2 app/models/domain.rb
  39. +1 1  app/models/domain_parameter.rb
  40. +2 1  app/models/environment.rb
  41. +6 6 app/models/fact_value.rb
  42. +1 1  app/models/group_parameter.rb
  43. +20 19 app/models/host.rb
  44. +1 1  app/models/host_class.rb
  45. +1 0  app/models/host_common.rb
  46. +1 1  app/models/host_parameter.rb
  47. +1 1  app/models/host_template_helpers.rb
  48. +3 6 app/models/hostgroup.rb
  49. +1 1  app/models/hypervisor.rb
  50. +1 1  app/models/lookup_key.rb
  51. +1 1  app/models/lookup_value.rb
  52. +2 1  app/models/medium.rb
  53. +1 1  app/models/model.rb
  54. +2 2 app/models/operatingsystem.rb
  55. +2 2 app/models/orchestration.rb
  56. +1 1  app/models/orchestration/tftp.rb
  57. +2 2 app/models/os_parameter.rb
  58. +8 6 app/models/parameter.rb
  59. +2 1  app/models/ptable.rb
  60. +5 5 app/models/puppetclass.rb
  61. +4 4 app/models/redhat.rb
  62. +13 14 app/models/report.rb
  63. +1 1  app/models/report_common.rb
  64. +7 7 app/models/role.rb
  65. +1 1  app/models/setting.rb
  66. +2 2 app/models/smart_proxies/puppet_ca.rb
  67. +4 4 app/models/smart_proxy.rb
  68. +1 1  app/models/subnet.rb
  69. +4 5 app/models/user.rb
  70. +11 7 app/models/user_fact.rb
  71. +6 6 app/models/usergroup.rb
  72. +1 1  app/views/architectures/_form.html.erb
  73. +0 13 app/views/audits/_search_line.html.erb
  74. +7 7 app/views/audits/index.html.erb
  75. +5 5 app/views/audits/show.html.erb
  76. +2 2 app/views/auth_source_ldaps/_form.html.erb
  77. +1 1  app/views/bookmarks/_form.html.erb
  78. +4 9 app/views/common/_domain.html.erb
  79. +3 9 app/views/common/_domain_subnet.html.erb
  80. +1 1  app/views/common/_edit_habtm.erb
  81. +4 11 app/views/common/_hypervisor.html.erb
  82. +1 1  app/views/common/_notice.erb
  83. +6 5 app/views/common/_puppetclasses_or_envs_changed.html.erb
  84. +2 2 app/views/common/_searchbar.erb
  85. +3 8 app/views/common/os_selection/_architecture.html.erb
  86. +1 1  app/views/common/os_selection/_image_details.html.erb
  87. +5 10 app/views/common/os_selection/_initial.html.erb
  88. +1 1  app/views/common/os_selection/_operatingsystem.html.erb
  89. +1 1  app/views/common_parameters/_form.html.erb
  90. +2 2 app/views/common_parameters/_parameters.erb
  91. +2 2 app/views/config_templates/_combinations.html.erb
  92. +1 1  app/views/config_templates/_form.html.erb
  93. +6 6 app/views/dashboard/index.html.erb
  94. +1 1  app/views/domains/_form.html.erb
  95. +1 1  app/views/environments/_form.html.erb
  96. +1 1  app/views/environments/index.html.erb
  97. 0  app/views/host_mailer/{_active_hosts.text.html.erb → _active_hosts.html.erb}
  98. 0  app/views/host_mailer/{_link_to_host.text.html.erb → _link_to_host.html.erb}
  99. 0  app/views/host_mailer/{_list.text.html.erb → _list.html.erb}
  100. 0  app/views/host_mailer/{_nonactive_hosts.text.html.erb → _nonactive_hosts.html.erb}
  101. 0  app/views/host_mailer/{error_state.text.html.erb → error_state.html.erb}
  102. 0  app/views/host_mailer/{summary.text.html.erb → summary.html.erb}
  103. +5 8 app/views/hostgroups/_form.html.erb
  104. +7 15 app/views/hosts/_form.html.erb
  105. +1 1  app/views/hosts/_sp_subnet.html.erb
  106. +1 1  app/views/hosts/multiple_build.html.erb
  107. +1 1  app/views/hosts/multiple_destroy.html.erb
  108. +1 1  app/views/hosts/multiple_disable.html.erb
  109. +1 1  app/views/hosts/multiple_enable.html.erb
  110. +1 1  app/views/hosts/multiple_parameters.html.erb
  111. +1 1  app/views/hosts/select_multiple_environment.html.erb
  112. +1 1  app/views/hypervisors/_form.html.erb
  113. +5 8 app/views/layouts/application.html.erb
  114. +4 4 app/views/lookup_keys/_fields.html.erb
  115. +1 1  app/views/lookup_keys/edit.html.erb
  116. +1 1  app/views/media/_form.html.erb
  117. +1 1  app/views/models/_form.html.erb
  118. +2 3 app/views/operatingsystems/_form.html.erb
  119. +2 2 app/views/operatingsystems/_template_defaults.html.erb
  120. +1 1  app/views/operatingsystems/_templates.html.erb
  121. +1 1  app/views/operatingsystems/index.html.erb
  122. +2 2 app/views/ptables/_form.html.erb
  123. +1 1  app/views/puppetclasses/_class_selection.html.erb
  124. +3 2 app/views/puppetclasses/_classes.html.erb
  125. +2 2 app/views/puppetclasses/_form.html.erb
  126. +2 2 app/views/puppetclasses/_selectedClasses.html.erb
  127. +2 2 app/views/puppetclasses/index.html.erb
  128. +2 2 app/views/reports/_metrics.rhtml
  129. +2 2 app/views/roles/_form.rhtml
  130. +1 1  app/views/roles/report.rhtml
  131. +1 1  app/views/smart_proxies/_form.html.erb
  132. +1 1  app/views/smart_proxies/autosign/_form.html.erb
  133. +1 1  app/views/smart_proxies/autosign/index.html.erb
  134. +1 1  app/views/smart_proxies/puppetca/index.html.erb
  135. +2 2 app/views/statistics/index.html.erb
  136. +1 1  app/views/subnets/_form.html.erb
  137. +2 2 app/views/subnets/import.html.erb
  138. +1 1  app/views/usergroups/_form.html.erb
  139. +5 5 app/views/users/_filters.html.erb
  140. +4 6 app/views/users/_form.html.erb
  141. +1 1  app/views/users/login.html.erb
  142. +4 0 config.ru
  143. +57 0 config/application.rb
  144. +4 108 config/boot.rb
  145. +1 1  config/database.yml
  146. +4 50 config/environment.rb
  147. +22 14 config/environments/development.rb
  148. +41 20 config/environments/production.rb
  149. +35 27 config/environments/test.rb
  150. +0 21 config/initializers/fix_already_loading_missing_dependencies.rb
  151. +6 6 config/initializers/foreman.rb
  152. +1 1  config/initializers/inflections.rb
  153. +0 19 config/initializers/new_rails_defaults.rb
  154. +2 2 config/initializers/puppet.rb
  155. +7 0 config/initializers/secret_token.rb
  156. +3 10 config/initializers/session_store.rb
  157. +13 22 config/initializers/will_paginate.rb
  158. +1 1  config/locales/en.yml
  159. +225 70 config/routes.rb
  160. +8 0 config/routes.rb.rails2
  161. +0 12 config/settings.yaml
  162. +0 2  db/migrate/20090715143858_create_architectures.rb
  163. +6 6 db/migrate/20100629093200_create_roles.rb
  164. +9 0 db/migrate/20111124095053_rename_changes_to_audited_changes.rb
  165. +10 0 db/migrate/20111124095054_add_remote_address_to_audits.rb
  166. +11 0 db/migrate/20111124095055_rename_parent_to_association.rb
  167. +9 0 db/seeds.rb
  168. +2 0  doc/README_FOR_APP
  169. +9 22 lib/core_extensions.rb
  170. +9 0 lib/foreman.rb
  171. 0  lib/{ → foreman}/access_permissions.rb
  172. +2 0  lib/foreman/controller.rb
  173. +1 1  lib/foreman/controller/environments.rb
  174. +2 2 lib/foreman/controller/host_details.rb
  175. +6 6 lib/foreman/default_data/loader.rb
  176. +1 1  lib/foreman/default_settings/loader.rb
  177. +3 2 lib/foreman/renderer.rb
  178. +2 0  lib/net.rb
  179. +1 1  lib/proxy_api.rb
  180. 0  lib/tasks/.gitkeep
  181. +1 1  lib/tasks/convert.rake
  182. +1 1  lib/tasks/model.rake
  183. +2 2 lib/timed_cached_store.rb
  184. 0  log/.gitkeep
  185. +15 19 public/404.html
  186. +15 19 public/422.html
  187. +14 18 public/500.html
  188. +18 0 public/javascripts/application.js
  189. +122 0 public/javascripts/host_edit.js
  190. +9,033 3 public/javascripts/jquery.js
  191. +367 0 public/javascripts/jquery_ujs.js
  192. 0  public/stylesheets/.gitkeep
  193. +1 5 public/stylesheets/style.css
  194. +0 4 script/about
  195. +0 3  script/console
  196. +0 3  script/dbconsole
  197. +0 3  script/destroy
  198. +0 3  script/generate
  199. +0 3  script/plugin
  200. +6 0 script/rails
  201. +0 3  script/runner
  202. +0 3  script/server
  203. 0  test/fixtures/.gitkeep
  204. +3 3 test/fixtures/audits.yml
  205. 0  test/functional/.gitkeep
  206. +1 1  test/functional/domains_controller_test.rb
  207. +3 3 test/functional/environments_controller_test.rb
  208. +3 3 test/functional/fact_values_controller_test.rb
  209. +1 1  test/functional/hostgroups_controller_test.rb
  210. +12 10 test/functional/hosts_controller_test.rb
  211. +1 1  test/functional/lookup_keys_controller_test.rb
  212. +2 2 test/functional/media_controller_test.rb
  213. +1 1  test/functional/models_controller_test.rb
  214. +1 1  test/functional/operatingsystems_controller_test.rb
  215. +5 5 test/functional/ptables_controller_test.rb
  216. +1 1  test/functional/puppetclasses_controller_test.rb
  217. +3 9 test/functional/reports_controller_test.rb
  218. +1 1  test/functional/smart_proxies_controller_test.rb
  219. +1 1  test/functional/subnets_controller_test.rb
  220. +1 1  test/functional/usergroups_controller_test.rb
  221. +2 2 test/functional/users_controller_test.rb
  222. 0  test/integration/.gitkeep
  223. +2 2 test/performance/browsing_test.rb
  224. +5 36 test/test_helper.rb
  225. 0  test/unit/.gitkeep
  226. +1 1  test/unit/architecture_test.rb
  227. +2 10 test/unit/auth_source_ldap_test.rb
  228. +10 10 test/unit/host_mailer_test.rb
  229. +5 4 test/unit/host_test.rb
  230. +1 1  test/unit/operatingsystem_test.rb
  231. +1 1  test/unit/orchestration/tftp_test.rb
  232. +1 1  test/unit/ptable_test.rb
  233. +1 1  test/unit/setting_test.rb
  234. +12 12 test/unit/usergroup_test.rb
  235. +0 314 vendor/gems/rack-1.1.0/.specification
  236. +0 18 vendor/gems/rack-1.1.0/COPYING
  237. +0 21 vendor/gems/rack-1.1.0/KNOWN-ISSUES
  238. +0 399 vendor/gems/rack-1.1.0/README
  239. +0 171 vendor/gems/rack-1.1.0/SPEC
  240. +0 4 vendor/gems/rack-1.1.0/bin/rackup
  241. +0 111 vendor/gems/rack-1.1.0/contrib/rack_logo.svg
  242. +0 4 vendor/gems/rack-1.1.0/example/lobster.ru
  243. +0 14 vendor/gems/rack-1.1.0/example/protectedlobster.rb
  244. +0 8 vendor/gems/rack-1.1.0/example/protectedlobster.ru
  245. +0 92 vendor/gems/rack-1.1.0/lib/rack.rb
  246. +0 22 vendor/gems/rack-1.1.0/lib/rack/adapter/camping.rb
  247. +0 37 vendor/gems/rack-1.1.0/lib/rack/auth/abstract/handler.rb
  248. +0 37 vendor/gems/rack-1.1.0/lib/rack/auth/abstract/request.rb
  249. +0 58 vendor/gems/rack-1.1.0/lib/rack/auth/basic.rb
  250. +0 124 vendor/gems/rack-1.1.0/lib/rack/auth/digest/md5.rb
  251. +0 51 vendor/gems/rack-1.1.0/lib/rack/auth/digest/nonce.rb
  252. +0 55 vendor/gems/rack-1.1.0/lib/rack/auth/digest/params.rb
  253. +0 40 vendor/gems/rack-1.1.0/lib/rack/auth/digest/request.rb
  254. +0 80 vendor/gems/rack-1.1.0/lib/rack/builder.rb
  255. +0 41 vendor/gems/rack-1.1.0/lib/rack/cascade.rb
  256. +0 49 vendor/gems/rack-1.1.0/lib/rack/chunked.rb
  257. +0 49 vendor/gems/rack-1.1.0/lib/rack/commonlogger.rb
  258. +0 47 vendor/gems/rack-1.1.0/lib/rack/conditionalget.rb
  259. +0 15 vendor/gems/rack-1.1.0/lib/rack/config.rb
  260. +0 29 vendor/gems/rack-1.1.0/lib/rack/content_length.rb
  261. +0 23 vendor/gems/rack-1.1.0/lib/rack/content_type.rb
  262. +0 96 vendor/gems/rack-1.1.0/lib/rack/deflater.rb
  263. +0 157 vendor/gems/rack-1.1.0/lib/rack/directory.rb
  264. +0 23 vendor/gems/rack-1.1.0/lib/rack/etag.rb
  265. +0 90 vendor/gems/rack-1.1.0/lib/rack/file.rb
  266. +0 88 vendor/gems/rack-1.1.0/lib/rack/handler.rb
  267. +0 61 vendor/gems/rack-1.1.0/lib/rack/handler/cgi.rb
  268. +0 8 vendor/gems/rack-1.1.0/lib/rack/handler/evented_mongrel.rb
  269. +0 89 vendor/gems/rack-1.1.0/lib/rack/handler/fastcgi.rb
  270. +0 63 vendor/gems/rack-1.1.0/lib/rack/handler/lsws.rb
  271. +0 90 vendor/gems/rack-1.1.0/lib/rack/handler/mongrel.rb
  272. +0 62 vendor/gems/rack-1.1.0/lib/rack/handler/scgi.rb
  273. +0 8 vendor/gems/rack-1.1.0/lib/rack/handler/swiftiplied_mongrel.rb
  274. +0 18 vendor/gems/rack-1.1.0/lib/rack/handler/thin.rb
  275. +0 69 vendor/gems/rack-1.1.0/lib/rack/handler/webrick.rb
  276. +0 19 vendor/gems/rack-1.1.0/lib/rack/head.rb
  277. +0 575 vendor/gems/rack-1.1.0/lib/rack/lint.rb
  278. +0 65 vendor/gems/rack-1.1.0/lib/rack/lobster.rb
  279. +0 16 vendor/gems/rack-1.1.0/lib/rack/lock.rb
  280. +0 20 vendor/gems/rack-1.1.0/lib/rack/logger.rb
  281. +0 27 vendor/gems/rack-1.1.0/lib/rack/methodoverride.rb
  282. +0 206 vendor/gems/rack-1.1.0/lib/rack/mime.rb
  283. +0 189 vendor/gems/rack-1.1.0/lib/rack/mock.rb
  284. +0 18 vendor/gems/rack-1.1.0/lib/rack/nulllogger.rb
  285. +0 57 vendor/gems/rack-1.1.0/lib/rack/recursive.rb
  286. +0 109 vendor/gems/rack-1.1.0/lib/rack/reloader.rb
  287. +0 271 vendor/gems/rack-1.1.0/lib/rack/request.rb
  288. +0 149 vendor/gems/rack-1.1.0/lib/rack/response.rb
  289. +0 100 vendor/gems/rack-1.1.0/lib/rack/rewindable_input.rb
  290. +0 27 vendor/gems/rack-1.1.0/lib/rack/runtime.rb
  291. +0 142 vendor/gems/rack-1.1.0/lib/rack/sendfile.rb
  292. +0 212 vendor/gems/rack-1.1.0/lib/rack/server.rb
  293. +0 140 vendor/gems/rack-1.1.0/lib/rack/session/abstract/id.rb
  294. +0 90 vendor/gems/rack-1.1.0/lib/rack/session/cookie.rb
  295. +0 119 vendor/gems/rack-1.1.0/lib/rack/session/memcache.rb
  296. +0 100 vendor/gems/rack-1.1.0/lib/rack/session/pool.rb
  297. +0 349 vendor/gems/rack-1.1.0/lib/rack/showexceptions.rb
  298. +0 106 vendor/gems/rack-1.1.0/lib/rack/showstatus.rb
  299. +0 38 vendor/gems/rack-1.1.0/lib/rack/static.rb
  300. +0 56 vendor/gems/rack-1.1.0/lib/rack/urlmap.rb
  301. +0 620 vendor/gems/rack-1.1.0/lib/rack/utils.rb
  302. +0 38 vendor/gems/rack-1.1.0/rack.gemspec
  303. +0 73 vendor/gems/rack-1.1.0/test/spec_rack_auth_basic.rb
  304. +0 226 vendor/gems/rack-1.1.0/test/spec_rack_auth_digest.rb
  305. +0 84 vendor/gems/rack-1.1.0/test/spec_rack_builder.rb
  306. +0 51 vendor/gems/rack-1.1.0/test/spec_rack_camping.rb
  307. +0 48 vendor/gems/rack-1.1.0/test/spec_rack_cascade.rb
  308. +0 89 vendor/gems/rack-1.1.0/test/spec_rack_cgi.rb
  309. +0 62 vendor/gems/rack-1.1.0/test/spec_rack_chunked.rb
  310. +0 61 vendor/gems/rack-1.1.0/test/spec_rack_commonlogger.rb
  311. +0 41 vendor/gems/rack-1.1.0/test/spec_rack_conditionalget.rb
  312. +0 24 vendor/gems/rack-1.1.0/test/spec_rack_config.rb
  313. +0 43 vendor/gems/rack-1.1.0/test/spec_rack_content_length.rb
  314. +0 30 vendor/gems/rack-1.1.0/test/spec_rack_content_type.rb
  315. +0 127 vendor/gems/rack-1.1.0/test/spec_rack_deflater.rb
  316. +0 61 vendor/gems/rack-1.1.0/test/spec_rack_directory.rb
Sorry, we could not display the entire diff because too many files (463) changed.
12 .gitignore
... ... @@ -1,14 +1,10 @@
1 1 *~
  2 +.bundle
2 3 db/*.sqlite3
  4 +log/*.log
  5 +tmp/
3 6 db/schema.rb
4   -log/*
5   -nbproject/*
6   -tmp/*
7 7 config/settings.yaml
8 8 config/email.yaml
9   -tftp
10   -public/images/active_scaffold
11   -public/javascripts/active_scaffold
12   -public/stylesheets/active_scaffold
13 9 *.sw?
14   -.idea/*
  10 +.idea
32 Gemfile
... ... @@ -0,0 +1,32 @@
  1 +source 'http://rubygems.org'
  2 +
  3 +gem 'rails', '3.0.10'
  4 +gem "jquery-rails"
  5 +gem 'json'
  6 +gem 'rest-client', :require => 'rest_client'
  7 +gem "acts_as_audited", "2.0.0"
  8 +gem "has_many_polymorphs", :git => "https://github.com/jystewart/has_many_polymorphs.git"
  9 +gem "will_paginate", "~> 3.0.2"
  10 +gem "ancestry", "~> 1.2.4"
  11 +
  12 +gem 'sqlite3', :require => 'sqlite3'
  13 +
  14 +gem 'scoped_search', '>= 2.3.4'
  15 +#group :provisioning do
  16 + gem "safemode", "1.0", :git => "https://github.com/svenfuchs/safemode.git"
  17 + gem "ruby2ruby"
  18 + gem "ruby_parser"
  19 + gem "virt", ">= 0.2.0"
  20 +#end
  21 +
  22 +group :authentication do
  23 + gem 'net-ldap'
  24 +end
  25 +
  26 +group :test, :development do
  27 + # To use debugger
  28 + gem 'ruby-debug'
  29 + gem 'mocha'
  30 + gem 'shoulda'
  31 + gem 'rr'
  32 +end
140 Gemfile.lock
... ... @@ -0,0 +1,140 @@
  1 +GIT
  2 + remote: https://github.com/jystewart/has_many_polymorphs.git
  3 + revision: 36f15d24ca4200f657a5203d9fc0253b58477705
  4 + specs:
  5 + has_many_polymorphs (3.0.0.beta1)
  6 + activerecord
  7 +
  8 +GIT
  9 + remote: https://github.com/svenfuchs/safemode.git
  10 + revision: 77d53c3c52718ec4634bc6e71ccd230188ba6c90
  11 + specs:
  12 + safemode (1.0)
  13 +
  14 +GEM
  15 + remote: http://rubygems.org/
  16 + specs:
  17 + abstract (1.0.0)
  18 + actionmailer (3.0.10)
  19 + actionpack (= 3.0.10)
  20 + mail (~> 2.2.19)
  21 + actionpack (3.0.10)
  22 + activemodel (= 3.0.10)
  23 + activesupport (= 3.0.10)
  24 + builder (~> 2.1.2)
  25 + erubis (~> 2.6.6)
  26 + i18n (~> 0.5.0)
  27 + rack (~> 1.2.1)
  28 + rack-mount (~> 0.6.14)
  29 + rack-test (~> 0.5.7)
  30 + tzinfo (~> 0.3.23)
  31 + activemodel (3.0.10)
  32 + activesupport (= 3.0.10)
  33 + builder (~> 2.1.2)
  34 + i18n (~> 0.5.0)
  35 + activerecord (3.0.10)
  36 + activemodel (= 3.0.10)
  37 + activesupport (= 3.0.10)
  38 + arel (~> 2.0.10)
  39 + tzinfo (~> 0.3.23)
  40 + activeresource (3.0.10)
  41 + activemodel (= 3.0.10)
  42 + activesupport (= 3.0.10)
  43 + activesupport (3.0.10)
  44 + acts_as_audited (2.0.0)
  45 + rails (>= 3.0.3)
  46 + ancestry (1.2.4)
  47 + activerecord (>= 2.2.2)
  48 + arel (2.0.10)
  49 + builder (2.1.2)
  50 + columnize (0.3.4)
  51 + erubis (2.6.6)
  52 + abstract (>= 1.0.0)
  53 + i18n (0.5.0)
  54 + jquery-rails (1.0.16)
  55 + railties (~> 3.0)
  56 + thor (~> 0.14)
  57 + json (1.6.1)
  58 + linecache (0.46)
  59 + rbx-require-relative (> 0.0.4)
  60 + mail (2.2.19)
  61 + activesupport (>= 2.3.6)
  62 + i18n (>= 0.4.0)
  63 + mime-types (~> 1.16)
  64 + treetop (~> 1.4.8)
  65 + mime-types (1.17.2)
  66 + mocha (0.9.12)
  67 + net-ldap (0.2.2)
  68 + polyglot (0.3.3)
  69 + rack (1.2.4)
  70 + rack-mount (0.6.14)
  71 + rack (>= 1.0.0)
  72 + rack-test (0.5.7)
  73 + rack (>= 1.0)
  74 + rails (3.0.10)
  75 + actionmailer (= 3.0.10)
  76 + actionpack (= 3.0.10)
  77 + activerecord (= 3.0.10)
  78 + activeresource (= 3.0.10)
  79 + activesupport (= 3.0.10)
  80 + bundler (~> 1.0)
  81 + railties (= 3.0.10)
  82 + railties (3.0.10)
  83 + actionpack (= 3.0.10)
  84 + activesupport (= 3.0.10)
  85 + rake (>= 0.8.7)
  86 + rdoc (~> 3.4)
  87 + thor (~> 0.14.4)
  88 + rake (0.9.2.2)
  89 + rbx-require-relative (0.0.5)
  90 + rdoc (3.11)
  91 + json (~> 1.4)
  92 + rest-client (1.6.7)
  93 + mime-types (>= 1.16)
  94 + rr (1.0.2)
  95 + ruby-debug (0.10.4)
  96 + columnize (>= 0.1)
  97 + ruby-debug-base (~> 0.10.4.0)
  98 + ruby-debug-base (0.10.4)
  99 + linecache (>= 0.3)
  100 + ruby2ruby (1.3.1)
  101 + ruby_parser (~> 2.0)
  102 + sexp_processor (~> 3.0)
  103 + ruby_parser (2.3.1)
  104 + sexp_processor (~> 3.0)
  105 + scoped_search (2.3.5)
  106 + activerecord (>= 2.1.0)
  107 + sexp_processor (3.0.7)
  108 + shoulda (2.11.3)
  109 + sqlite3 (1.3.4)
  110 + thor (0.14.6)
  111 + treetop (1.4.10)
  112 + polyglot
  113 + polyglot (>= 0.3.1)
  114 + tzinfo (0.3.31)
  115 + virt (0.2.0)
  116 + will_paginate (3.0.2)
  117 +
  118 +PLATFORMS
  119 + ruby
  120 +
  121 +DEPENDENCIES
  122 + acts_as_audited (= 2.0.0)
  123 + ancestry (~> 1.2.4)
  124 + has_many_polymorphs!
  125 + jquery-rails
  126 + json
  127 + mocha
  128 + net-ldap
  129 + rails (= 3.0.10)
  130 + rest-client
  131 + rr
  132 + ruby-debug
  133 + ruby2ruby
  134 + ruby_parser
  135 + safemode (= 1.0)!
  136 + scoped_search (>= 2.3.4)
  137 + shoulda
  138 + sqlite3
  139 + virt (>= 0.2.0)
  140 + will_paginate (~> 3.0.2)
11 Rakefile
... ... @@ -1,10 +1,5 @@
1   -# Add your own tasks in files placed in lib/tasks ending in .rake,
2   -# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3   -
4   -require(File.join(File.dirname(__FILE__), 'config', 'boot'))
5   -
  1 +require File.expand_path('../config/application', __FILE__)
6 2 require 'rake'
7   -require 'rake/testtask'
8   -require 'rake/rdoctask'
  3 +include Rake::DSL
9 4
10   -require 'tasks/rails'
  5 +Foreman::Application.load_tasks
19 app/controllers/application_controller.rb
... ... @@ -1,10 +1,9 @@
1   -# Filters added to this controller apply to all controllers in the application.
2   -# Likewise, all the methods added will be available for all controllers.
  1 +require 'foreman/controller/auto_complete_search'
3 2
4 3 class ApplicationController < ActionController::Base
5 4 protect_from_forgery # See ActionController::RequestForgeryProtection for details
6 5 rescue_from ScopedSearch::QueryNotSupported, :with => :invalid_search_query
7   - rescue_from Exception, :with => :generic_exception
  6 + #rescue_from Exception, :with => :generic_exception
8 7 rescue_from ActiveRecord::RecordNotFound, :with => :not_found
9 8
10 9 # standard layout to all controllers
@@ -60,10 +59,10 @@ def require_login
60 59 # JSON requests (REST API calls) use basic http authenitcation and should not use/store cookies
61 60 user = authenticate_or_request_with_http_basic { |u, p| User.try_to_login(u, p) }
62 61 User.current = user.is_a?(User) ? user : nil
63   - logger.warn("Failed authentcation from #{request.remote_ip} #{user}") if User.current.nil?
  62 + logger.warn("Failed authentication from #{request.remote_ip} #{user}") if User.current.nil?
64 63 return !User.current.nil?
65 64 end
66   - session[:original_uri] = request.request_uri # keep the old request uri that we can redirect later on
  65 + session[:original_uri] = request.fullpath # keep the old request uri that we can redirect later on
67 66 redirect_to login_users_path and return
68 67 else
69 68 # We assume we always have a user logged in, if authentication is disabled, the user is the build-in admin account.
@@ -76,7 +75,7 @@ def require_login
76 75 end
77 76 end
78 77
79   - # this method is returns the active user which gets used to puplate the audits table
  78 + # this method is returns the active user which gets used to populate the audits table
80 79 def current_user
81 80 User.current
82 81 end
@@ -129,6 +128,10 @@ def error error
129 128 flash[:error] = error
130 129 end
131 130
  131 + def warning warning
  132 + flash[:warning] = warning
  133 + end
  134 +
132 135 # this method is used with nested resources, where obj_id is passed into the parameters hash.
133 136 # it automatically updates the search text box with the relevant relationship
134 137 # e.g. /hosts/fqdn/reports # would add host = fqdn to the search bar
@@ -174,7 +177,7 @@ def no_puppetclass_documentation_handler(exception)
174 177 if exception.message =~ /No route matches "\/puppet\/rdoc\/([^\/]+)\/classes\/(.+?)\.html/
175 178 render :template => "puppetclasses/no_route", :locals => {:environment => $1, :name => $2.gsub("/","::")}, :layout => false
176 179 else
177   - local_request? ? rescue_action_locally(exception) : rescue_action_in_public(exception)
  180 + request.local? ? request.rescue_action_locally(exception) : rescue_action_in_public(exception)
178 181 end
179 182 end
180 183
@@ -203,7 +206,7 @@ def process_error hash = {}
203 206 else
204 207 hash[:redirect] ||= eval("#{controller_name}_url")
205 208 end
206   - hash[:error_msg] ||= hash[:object].errors.on_base.to_a
  209 + hash[:error_msg] ||= hash[:object].errors[:base]
207 210
208 211 hash[:json_code] ||= :unprocessable_entity
209 212 logger.info "Failed to save: #{hash[:object].errors.full_messages.join(", ")}"
2  app/controllers/auth_source_ldaps_controller.rb
... ... @@ -1,6 +1,4 @@
1 1 class AuthSourceLdapsController < ApplicationController
2   - filter_parameter_logging :account_password
3   -
4 2 def index
5 3 @auth_source_ldaps = AuthSourceLdap.all
6 4 respond_to do |format|
2  app/controllers/bookmarks_controller.rb
@@ -2,7 +2,7 @@ class BookmarksController < ApplicationController
2 2 before_filter :find_by_name, :only => %w{show edit update destroy}
3 3
4 4 def index
5   - @bookmarks = Bookmark.all.paginate(:page => params[:page])
  5 + @bookmarks = Bookmark.paginate(:page => params[:page])
6 6
7 7 respond_to do |format|
8 8 format.html
2  app/controllers/config_templates_controller.rb
@@ -114,7 +114,7 @@ def build_pxe_default
114 114 # generated for
115 115 def pxe_default_combos
116 116 combos = []
117   - ConfigTemplate.template_kind_name_eq("provision").each do |template|
  117 + ConfigTemplate.joins(:template_kind).where("template_kinds.name" => "provision").each do |template|
118 118 template.template_combinations.each do |combination|
119 119 hostgroup = combination.hostgroup
120 120 if hostgroup and hostgroup.operatingsystem and hostgroup.architecture and hostgroup.medium
2  app/controllers/environments_controller.rb
... ... @@ -1,3 +1,5 @@
  1 +require 'foreman/controller/environments'
  2 +
1 3 class EnvironmentsController < ApplicationController
2 4 include Foreman::Controller::Environments
3 5 include Foreman::Controller::AutoCompleteSearch
3  app/controllers/fact_values_controller.rb
@@ -8,9 +8,6 @@ class FactValuesController < ApplicationController
8 8 before_filter :set_admin_user, :only => :create
9 9 before_filter :setup_search_options, :only => :index
10 10
11   - # avoids storing the facts data in the log files
12   - filter_parameter_logging :facts
13   -
14 11 def index
15 12 begin
16 13 values = FactValue.no_timestamp_facts.search_for(params[:search],:order => params[:order])
3  app/controllers/hostgroups_controller.rb
... ... @@ -1,8 +1,9 @@
  1 +require 'foreman/controller/host_details'
  2 +
1 3 class HostgroupsController < ApplicationController
2 4 include Foreman::Controller::HostDetails
3 5 include Foreman::Controller::AutoCompleteSearch
4 6
5   - filter_parameter_logging :root_pass
6 7 before_filter :find_hostgroup, :only => [:show, :edit, :update, :destroy, :clone]
7 8
8 9 def index
60 app/controllers/hosts_controller.rb
... ... @@ -1,3 +1,5 @@
  1 +require 'foreman/controller/host_details'
  2 +
1 3 class HostsController < ApplicationController
2 4 include Foreman::Controller::HostDetails
3 5 include Foreman::Controller::AutoCompleteSearch
@@ -10,7 +12,6 @@ class HostsController < ApplicationController
10 12 before_filter :set_admin_user, :only => ANONYMOUS_ACTIONS
11 13
12 14 before_filter :find_hosts, :only => :query
13   - before_filter :ajax_methods, :only => [:hostgroup_or_environment_selected]
14 15 before_filter :find_multiple, :only => [:update_multiple_parameters, :multiple_build,
15 16 :select_multiple_hostgroup, :select_multiple_environment, :multiple_parameters, :multiple_destroy,
16 17 :multiple_enable, :multiple_disable, :submit_multiple_disable, :submit_multiple_enable, :update_multiple_hostgroup,
@@ -18,7 +19,6 @@ class HostsController < ApplicationController
18 19 before_filter :find_by_name, :only => %w[show edit update destroy puppetrun setBuild cancelBuild report
19 20 reports facts storeconfig_klasses clone pxe_config toggle_manage]
20 21
21   - filter_parameter_logging :root_pass
22 22 helper :hosts, :reports
23 23
24 24 def index (title = nil)
@@ -35,8 +35,6 @@ def index (title = nil)
35 35 @hosts = search.paginate :page => params[:page], :include => included_associations
36 36 # SQL optimizations queries
37 37 @last_reports = Report.maximum(:id, :group => :host_id, :conditions => {:host_id => @hosts})
38   - @fact_kernels = FactValue.all(:select => "host_id, fact_values.value", :joins => [:host, :fact_name],
39   - :conditions => {"fact_values.host_id" => @hosts, "fact_names.name" => 'kernel'})
40 38 # rendering index page for non index page requests (out of sync hosts etc)
41 39 render :index if title and @title = title
42 40 end
@@ -79,8 +77,7 @@ def clone
79 77 new.puppetclasses = @host.puppetclasses
80 78 # Clone any parameters as well
81 79 @host.host_parameters.each{|param| new.host_parameters << param.clone}
82   - flash[:error_customisation] = {:header_message => nil, :class => "flash notice", :id => nil,
83   - :message => "The following fields will need reviewing:" }
  80 + flash[:warning] = "The following fields will need reviewing"
84 81 new.valid?
85 82 @host = new
86 83 render :action => :new
@@ -121,11 +118,13 @@ def destroy
121 118 end
122 119
123 120 # form AJAX methods
124   -
125 121 def hostgroup_or_environment_selected
126   - @environment = Environment.find(params[:environment_id]) if params[:environment_id].to_i > 0
127   - @hostgroup = Hostgroup.find(params[:hostgroup_id]) if params[:hostgroup_id].to_i > 0
128   - if @environment or @hostgroup
  122 + return head(:method_not_allowed) unless request.xhr?
  123 +
  124 + @environment = Environment.find(params[:environment_id]) unless params[:environment_id].empty?
  125 + @hostgroup = Hostgroup.find(params[:hostgroup_id]) unless params[:hostgroup_id].empty?
  126 + @host = Host.find(params[:host_id]) if params[:host_id].to_i > 0
  127 + if @environment or @hostgroup
129 128 @host ||= Host.new
130 129 @host.hostgroup = @hostgroup if @hostgroup
131 130 @host.environment = @environment if @environment
@@ -262,7 +261,7 @@ def update_multiple_hostgroup
262 261 #update the hosts
263 262 @hosts.each do |host|
264 263 host.hostgroup=hg
265   - host.save(false)
  264 + host.save(:validate => false)
266 265 end
267 266
268 267 notice 'Updated hosts: Changed Hostgroup'
@@ -284,7 +283,7 @@ def update_multiple_environment
284 283 #update the hosts
285 284 @hosts.each do |host|
286 285 host.environment=ev
287   - host.save(false)
  286 + host.save(:validate => false)
288 287 end
289 288
290 289 notice 'Updated hosts: Changed Environment'
@@ -374,16 +373,15 @@ def process_hostgroup
374 373 @host.set_hostgroup_defaults
375 374
376 375 render :update do |page|
377   - page['host_environment_id'].value = @hostgroup.environment_id if @hostgroup.environment_id
  376 + page['*[id*=environment_id]'].val(@hostgroup.environment_id) if @hostgroup.environment_id
378 377 # process_hostgroup is only ever called for new host records therefore the assigned value can never be @hostgroup.puppetmaster_name
379 378 # This means that we should use the puppetproxy display type as new hosts should use this feature
380   - page['host_puppetproxy_id'].value = @hostgroup.puppetca? ? @hostgroup.puppetmaster.id : ""
381   - if @environment
382   - page.replace_html :puppet_klasses, :partial => 'puppetclasses/class_selection', :locals => {:obj => @host}
383   - end
  379 + page['*[id*=puppetproxy_id]'].val(@hostgroup.puppetca? ? @hostgroup.puppetmaster.id : "")
  380 +
  381 + page['#puppet_klasses'].html(render(:partial => 'puppetclasses/class_selection', :locals => {:obj => @host})) if @environment
384 382
385 383 if SETTINGS[:unattended]
386   - page['host_root_pass'].value = @hostgroup.root_pass
  384 + page['*[id*=root_pass]'].val(@hostgroup.root_pass)
387 385 if (@hypervisor = @hostgroup.hypervisor)
388 386 @hypervisor.connect
389 387 # we are in a view context
@@ -392,19 +390,18 @@ def process_hostgroup
392 390 end
393 391
394 392 if @architecture
395   - page.replace_html :architecture_select, :partial => 'common/os_selection/architecture', :locals => {:item => @host}
396   - page['host_architecture_id'].value = @architecture.id
397   - end
398   - if @operatingsystem
399   - page.replace_html :operatingsystem_select, :partial => 'common/os_selection/operatingsystem', :locals => {:item => @host}
  393 + page['#os_select'].html(render(:partial => 'common/os_selection/architecture', :locals => {:item => @host}))
  394 + page['#*[id*=architecture_id]'].val(@architecture.id)
400 395 end
  396 +
  397 + page['#media_select'].html(render(:partial => 'common/os_selection/operatingsystem', :locals => {:item => @host})) if @operatingsystem
  398 +
401 399 if @domain
402   - page['host_domain_id'].value = @domain.id
  400 + page['*[id*=domain_id]'].val(@domain.id)
403 401 if @subnet
404   - page.replace_html(:host_subnet, :partial => 'common/domain', :locals => {:item => @host})
405   - page['host_subnet_id'].val("0").change
406   - page['host_subnet_id'].val("#{@subnet.id}").change
407   - page.replace_html(:sp_subnet, :partial => 'hosts/sp_subnet', :locals => {:item => @host})
  402 + page['#subnet_select'].html(render(:partial => 'common/domain', :locals => {:item => @host}))
  403 + page['#host_subnet_id'].val(@subnet.id).change
  404 + page['#sp_subnet'].html(render(:partial => 'hosts/sp_subnet', :locals => {:item => @host}))
408 405 end
409 406 end
410 407 end
@@ -459,7 +456,7 @@ def find_hosts
459 456 end unless klass.nil?
460 457
461 458 group.each do |k|
462   - list = Host.hostgroup_name_eq(k).send(state).map(&:name)
  459 + list = Host.joins(:hostgroup).where("hostgroups.name" => k).send(state).map(&:name)
463 460 @hosts = counter == 0 ? list : @hosts & list
464 461 counter +=1
465 462 end unless group.nil?
@@ -467,11 +464,6 @@ def find_hosts
467 464 not_found if @hosts.empty?
468 465 end
469 466
470   - def ajax_methods
471   - return head(:method_not_allowed) unless request.xhr?
472   - @host = Host.find(params[:id]) unless params[:id].empty?
473   - end
474   -
475 467 def load_vars_for_ajax
476 468 return unless @host
477 469 @environment = @host.environment
2  app/controllers/hypervisors/guests_controller.rb
... ... @@ -1,4 +1,4 @@
1   -require_dependency 'hypervisor/guest'
  1 +require 'hypervisor/guest'
2 2
3 3 class Hypervisors::GuestsController < ApplicationController
4 4 before_filter :find_hypervisor
1  app/controllers/lookup_values_controller.rb
@@ -3,7 +3,6 @@ class LookupValuesController < ApplicationController
3 3 before_filter :reject_non_json_requests
4 4 before_filter :find_by_id, :except => [:index, :create]
5 5 before_filter :setup_search_options, :only => :index
6   - filter_parameter_logging :value # might contain sensative information
7 6
8 7 def index
9 8 begin
2  app/controllers/media_controller.rb
@@ -6,7 +6,7 @@ def index
6 6 values = Medium.search_for(params[:search], :order => params[:order])
7 7 respond_to do |format|
8 8 format.html { @media = values.paginate(:page => params[:page], :include => [:operatingsystems]) }
9   - format.json { render :json => values.as_json }
  9 + format.json { render :json => values }
10 10 end
11 11 end
12 12
4 app/controllers/operatingsystems_controller.rb
@@ -35,7 +35,9 @@ def create
35 35 def edit
36 36 # Generates default OS template entries
37 37 @operatingsystem.config_templates.map(&:template_kind_id).uniq.each do |kind|
38   - @operatingsystem.os_default_templates.build(:template_kind_id => kind) if @operatingsystem.os_default_templates.template_kind_id_eq(kind).blank?
  38 + if @operatingsystem.os_default_templates.where(:template_kind_id => kind).blank?
  39 + @operatingsystem.os_default_templates.build(:template_kind_id => kind)
  40 + end
39 41 end if SETTINGS[:unattended]
40 42 end
41 43
21 app/controllers/puppetclasses_controller.rb
... ... @@ -1,3 +1,5 @@
  1 +require 'foreman/controller/environments'
  2 +
1 3 class PuppetclassesController < ApplicationController
2 4 include Foreman::Controller::Environments
3 5 include Foreman::Controller::AutoCompleteSearch
@@ -56,23 +58,4 @@ def destroy
56 58 redirect_to puppetclasses_url
57 59 end
58 60
59   - # AJAX methods
60   -
61   - # adds a puppetclass to an existing host or hostgroup
62   - #
63   - # We assign the new puppetclasses (e.g. in the context of a Host or a Host Group)
64   - # via ajax and not java script as rendering javascript for each and every class
65   - # seems to be much longer than the average roundtrip time to the server
66   - # TODO: convert this to pure javascript then AJAX will not be required.
67   - def assign
68   - return unless request.xhr?
69   -
70   - type = params[:type]
71   - render :update do |page|
72   - page.insert_html :bottom, :selected_classes, :partial => 'selectedClasses', :locals => {:klass => @puppetclass, :type => type}
73   - page["selected_puppetclass_#{@puppetclass.id}"].highlight(5000)
74   - page["puppetclass_#{@puppetclass.id}"].hide
75   - end
76   - end
77   -
78 61 end
3  app/controllers/reports_controller.rb
@@ -8,9 +8,6 @@ class ReportsController < ApplicationController
8 8 before_filter :set_admin_user, :only => :create
9 9 before_filter :setup_search_options, :only => :index
10 10
11   - # avoids storing the report data in the log files
12   - filter_parameter_logging :report
13   -
14 11 def index
15 12 values = Report.search_for(params[:search], :order => params[:order])
16 13 pagination_opts = { :page => params[:page], :per_page => params[:per_page] }
5 app/controllers/subnets_controller.rb
@@ -53,9 +53,8 @@ def freeip
53 53 respond_to do |format|
54 54 format.html do
55 55 render :update do |page|
56   - page['host_ip'].value = ip
57   - page['indicator'].hide
58   - page['host_ip'].visual_effect :highlight
  56 + page['#host_ip'].val(ip)
  57 + page['#host_ip'].show('highlight', 5000)
59 58 end
60 59 end
61 60 format.json { render :json => {:ip => ip} }
12 app/controllers/unattended_controller.rb
@@ -2,14 +2,14 @@ class UnattendedController < ApplicationController
2 2 layout nil
3 3
4 4 # Methods which return configuration files for syslinux(pxe), pxegrub or g/ipxe
5   - PXE_CONFIG_URLS = [:pxe_kickstart_config, :pxe_debian_config, :pxemenu] + TemplateKind.name_like("pxelinux").map(&:name)
6   - PXEGRUB_CONFIG_URLS = [:pxe_jumpstart_config] + TemplateKind.name_like("pxegrub").map(&:name)
7   - GPXE_CONFIG_URLS = [:gpxe_kickstart_config] + TemplateKind.name_like("gpxe").map(&:name)
  5 + PXE_CONFIG_URLS = [:pxe_kickstart_config, :pxe_debian_config, :pxemenu] + TemplateKind.where("name LIKE ?","pxelinux").map(&:name)
  6 + PXEGRUB_CONFIG_URLS = [:pxe_jumpstart_config] + TemplateKind.where("name LIKE ?", "pxegrub").map(&:name)
  7 + GPXE_CONFIG_URLS = [:gpxe_kickstart_config] + TemplateKind.where("name LIKE ?", "gpxe").map(&:name)
8 8 CONFIG_URLS = PXE_CONFIG_URLS + GPXE_CONFIG_URLS + PXEGRUB_CONFIG_URLS
9 9 # Methods which return valid provision instructions, used by the OS
10   - PROVISION_URLS = [:kickstart, :preseed, :jumpstart ] + TemplateKind.name_like("provision").map(&:name)
  10 + PROVISION_URLS = [:kickstart, :preseed, :jumpstart ] + TemplateKind.where("name LIKE ?", "provision").map(&:name)
11 11 # Methods which returns post install instructions for OS's which require it
12   - FINISH_URLS = [:preseed_finish, :jumpstart_finish] + TemplateKind.name_like("finish").map(&:name)
  12 + FINISH_URLS = [:preseed_finish, :jumpstart_finish] + TemplateKind.where("name LIKE ?", "finish").map(&:name)
13 13
14 14 # We dont require any of these methods for provisioning
15 15 skip_before_filter :require_ssl, :require_login, :authorize
@@ -151,7 +151,7 @@ def unattended_local
151 151 safe_render config and return
152 152 end
153 153 type = "unattended_local/#{request.path.gsub("/#{controller_name}/","")}.local"
154   - render :template => type if File.exists?("#{RAILS_ROOT}/app/views/#{type}.rhtml")
  154 + render :template => type if File.exists?("#{Rails.root}/app/views/#{type}.rhtml")
155 155 end
156 156
157 157 def set_content_type
5 app/controllers/users_controller.rb
... ... @@ -1,7 +1,6 @@
1 1 class UsersController < ApplicationController
2 2 include Foreman::Controller::AutoCompleteSearch
3 3
4   - filter_parameter_logging :password, :password_confirmation
5 4 skip_before_filter :require_login, :only => [:login, :logout]
6 5 skip_before_filter :authorize, :only => [:login, :logout]
7 6
@@ -117,9 +116,9 @@ def logout
117 116 def auth_source_selected
118 117 render :update do |page|
119 118 if params[:auth_source_id] and AuthSource.find(params[:auth_source_id]).can_set_password?
120   - page.show 'password'
  119 + page['#password'].show
121 120 else
122   - page.hide 'password'
  121 + page['#password'].hide
123 122 end
124 123 end
125 124 end
17 app/helpers/application_helper.rb
@@ -29,7 +29,7 @@ def link_to_add_fields(name, f, association, partial = nil, options = {})
29 29 fields = f.fields_for(association, new_object, :child_index => "new_#{association}") do |builder|
30 30 render((partial.nil? ? association.to_s.singularize + "_fields" : partial), :f => builder)
31 31 end
32   - link_to_function(name, h("add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")"), options.merge({:class => "btn small info"}) )
  32 + link_to_function(name, ("add_fields(this, \"#{association}\", \"#{escape_javascript(fields)}\")").html_safe, options.merge({:class => "btn small info"}) )
33 33 end
34 34
35 35 def toggle_div divs
@@ -48,20 +48,11 @@ def toggle_div divs
48 48 end
49 49
50 50 def link_to_remove_puppetclass klass
51   - link_to_function "",:class=>"ui-icon ui-icon-minus" do |page|
52   - page["selected_puppetclass_#{klass.id}"].remove
53   - #TODO if the class is already selected, removing it will not add it to the avail class list
54   - page << "if ($('puppetclass_#{klass.id}')) {"
55   - page["puppetclass_#{klass.id}"].show
56   - page << "}"
57   - end
  51 + link_to_function "","remove_puppet_class(this)", :'data-class-id'=>klass.id, :class=>"ui-icon ui-icon-minus"
58 52 end
59 53
60 54 def link_to_add_puppetclass klass, type
61   - # link to remote is faster than inline js when having many classes
62   - link_to_remote "",
63   - {:url => assign_puppetclass_path(klass, :type => type),
64   - :position => {:after => {:success => "selected_classes" }}},{:class=>"ui-icon ui-icon-plus"}
  55 + link_to_function "", "add_puppet_class(this)", :'data-class-id'=>klass.id, :class=>"ui-icon ui-icon-plus"
65 56 end
66 57
67 58 def check_all_links(form_name)
@@ -146,7 +137,7 @@ def auto_complete_search(method, val,tag_options = {}, completion_options = {})
146 137 end
147 138
148 139 def help_path
149   - link_to "Help", :action => "help"
  140 + link_to "Help", :action => "welcome"
150 141 end
151 142
152 143 def edit_textfield(object, property, options={})
6 app/helpers/audits_helper.rb
@@ -13,11 +13,11 @@ def audit_title audit
13 13 end
14 14
15 15 def audit_parent audit
16   - audit.try(:auditable_parent).try(:name)
  16 + audit.try(:associated).try(:name)
17 17 end
18 18
19   - def auditable_type audit
20   - audit.auditable_type.split("::").last
  19 + def association_type audit
  20 + audit.association_type.split("::").last if audit.association_type
21 21 end
22 22
23 23 def change_order action, value
6 app/helpers/dashboard_helper.rb
@@ -32,4 +32,10 @@ def render_run_distribution data, options = {}
32 32 data[:counter],
33 33 options
34 34 end
  35 +
  36 + def searchable_links name, search
  37 + search += " and #{params[:search]}" unless params[:search].blank?
  38 + link_to name, hosts_path(:search => search)
  39 + end
  40 +
35 41 end
17 app/helpers/hosts_helper.rb
@@ -101,14 +101,6 @@ def selected? host
101 101 session[:selected].include?(host.id.to_s)
102 102 end
103 103
104   - def update_details_from_hostgroup
105   - return nil unless @host.new_record?
106   - remote_function(:url => { :action => "process_hostgroup" },
107   - :method => :post, :loading => "$('#indicator1').show()",
108   - :complete => "$('#indicator1').hide()",
109   - :with => "'hostgroup_id=' + value")
110   - end
111   -
112 104 def report_status_chart name, title, subtitle, data, options = {}
113 105 content_tag(:div, nil,
114 106 { :id => name,
@@ -139,11 +131,10 @@ def runtime_chart name, title, subtitle, data, options = {}
139 131 def reports_show
140 132 return unless @host.reports.size > 0
141 133 form_tag @host, :id => 'days_filter', :method => :get do
142   - content_tag(:p, {}) { "Reports from the last " +
143   - select(nil, 'range', 1..days_ago(@host.reports.first.reported_at),
144   - {:selected => @range}, {:class=>"mini", :onchange =>"$('#days_filter').submit();$(this).disabled();"}) +
145   - " days - #{@host.reports.recent(@range.days.ago).count} reports found"
146   - }
  134 + content_tag(:span, "Reports from the last ") +
  135 + select(nil, 'range', 1..days_ago(@host.reports.first.reported_at),
  136 + {:selected => @range}, {:class=>"mini", :onchange =>"$('#days_filter').submit();$(this).disabled();"}).html_safe +
  137 + " days - #{@host.reports.recent(@range.days.ago).count} reports found"
147 138 end
148 139 end
149 140
63 app/helpers/layout_helper.rb
... ... @@ -1,15 +1,15 @@
1 1 module LayoutHelper
2 2 def title(page_title, page_header = nil)
3   - @content_for_title = page_title.to_s
  3 + content_for(:title, page_title.to_s)
4 4 @page_header = page_header || @content_for_title
5 5 end
6 6
7 7 def title_actions *elements
8   - content_for(:title_actions) { elements.join(" ") }
  8 + content_for(:title_actions) { elements.join(" ").html_safe }
9 9 end
10 10
11 11 def search_bar *elements
12   - content_for(:search_bar) { elements.join(" ") }
  12 + content_for(:search_bar) { elements.join(" ").html_safe }
13 13 end
14 14
15 15 def stylesheet(*args)
@@ -20,25 +20,6 @@ def javascript(*args)
20 20 content_for(:head) { javascript_include_tag(*args) }
21 21 end
22 22
23   - def will_paginate(collection = nil, options = {})
24   - options.merge!(:class=>"span10 pagination fr")
25   - options[:renderer] ||= "WillPaginate::ViewHelpers::BootstrapLinkRenderer"
26   - options[:inner_window] ||= 3
27   - options[:outer_window] ||= 0
28   - super collection, options
29   - end
30   -
31   - def page_entries_info(collection, options = {})
32   - html = super(collection, options)
33   - html += options[:more] if options[:more]
34   - content_tag(
35   - :div,content_tag(
36   - :ul, content_tag(
37   - :li, link_to(html, "#")
38   - ), :style=>"float: left;"
39   - ), :class => "span6 pagination")
40   - end
41   -
42 23 def text_f(f, attr, options = {})
43 24 field(f, attr, options) do
44 25 f.text_field attr, options
@@ -83,29 +64,28 @@ def selectable_f(f, attr, array, select_options = {}, html_options = {})
83 64
84 65 def field(f, attr, options = {})
85 66 obj = f.object
86   - error = obj.errors.on(attr)
  67 + error = obj.errors[attr]
  68 + help_inline = content_tag(:span, (error.empty? ? options.delete(:help_inline) : error.to_sentence.html_safe), :class => "help-inline")
  69 + help_block = content_tag(:span, options.delete(:help_block), :class => "help-block")
87 70 content_tag :div, :class => "clearfix #{error.empty? ? "" : 'error'}" do
88   - f.label(attr, options.delete(:label)) +
  71 + f.label(attr, options.delete(:label)).html_safe +
89 72 content_tag(:div, :class => "input") do
90   - raw = ""
91   - raw += content_tag(:span, (error.empty? ? options[:help_inline] : error.to_a.to_sentence), :class => "help-inline")
92   - raw += content_tag(:span, options[:help_block], :class => "help-block")
93   - yield + raw
94   - end
  73 + yield.html_safe + help_inline.html_safe + help_block.html_safe
  74 + end.html_safe
95 75 end
96 76 end
97 77
98 78 def submit_or_cancel f
99   - "<br>" + content_tag(:p, :class => "ra") do
  79 + "<br>".html_safe + content_tag(:p, :class => "ra") do
100 80 link_to("Cancel", eval("#{controller_name}_path"), :class => "btn") + " " +
101 81 f.submit("Submit", :class => "btn primary")
102 82 end
103 83 end
104 84
105 85 def base_errors_for obj
106   - if errors = obj.errors.on(:base)
  86 + unless obj.errors[:base].blank?
107 87 content_tag(:div, :class => "alert-message block-message error base in fade", "data-alert" => true) do
108   - '<a class="close" href="#">×</a>' + "<h4>Unable to save</h4>" + errors.map {|e| "<li>#{e}</li>"}.join
  88 + "<a class='close' href='#'>×</a><h4>Unable to save</h4> ".html_safe + obj.errors[:base].map {|e| "<li>#{e}</li>"}.to_s.html_safe
109 89 end
110 90 end
111 91 end
@@ -114,4 +94,23 @@ def popover title, msg, options = {}
114 94 link_to_function title, {:rel => "popover", "data-content" => msg, "data-original-title" => title}.merge(options)
115 95 end
116 96
  97 + def will_paginate(collection = nil, options = {})
  98 + options.merge!(:class=>"span10 pagination fr")
  99 + options[:renderer] ||= "WillPaginate::ActionView::BootstrapLinkRenderer"
  100 + options[:inner_window] ||= 2
  101 + options[:outer_window] ||= 0
  102 + super collection, options
  103 + end
  104 +
  105 + def page_entries_info(collection, options = {})
  106 + html = super(collection, options)
  107 + html += options[:more].html_safe if options[:more]
  108 + content_tag(
  109 + :div,content_tag(
  110 + :ul, content_tag(
  111 + :li, link_to(html, "#")
  112 + ), :style=>"float: left;"
  113 + ), :class => "span6 pagination")
  114 + end
  115 +
117 116 end
2  app/helpers/lookup_keys_helper.rb
@@ -8,7 +8,7 @@ def remove_child_link(name, f, opts = {})
8 8 def add_child_link(name, association, opts = {})
9 9 opts[:class] = [opts[:class], "add_nested_fields btn small success"].compact.join(" ")
10 10 opts[:"data-association"] = association
11   - link_to(name, "javascript:void(0)", opts)
  11 + link_to(name.to_s, "javascript:void(0)", opts)
12 12 end
13 13
14 14 def new_child_fields_template(form_builder, association, options = { })
14 app/helpers/operatingsystems_helper.rb
... ... @@ -1,18 +1,6 @@
1 1 module OperatingsystemsHelper
2 2 include CommonParametersHelper
3 3
4   - # displays release name on debian based distributions on operating system edit page.
5   - def show_release
6   - update_page do |page|
7   - page << "if (value == 'Debian' || value == 'Solaris') {"
8   - page[:release_name].show
9   - page[:release_name].highlight
10   - page << "} else {"
11   - page[:release_name].hide
12   - page << "}"
13   - end
14   - end
15   -
16 4 def icon record, opts = {}
17 5 return "" if record.blank? or record.name.blank?
18 6 family = case record.name
@@ -39,7 +27,7 @@ def icon record, opts = {}
39 27 end
40 28
41 29 def os_name record, opts = {}
42   - "#{icon(record, opts)} #{h(record)}"
  30 + "#{icon(record, opts)} #{record}".html_safe
43 31 end
44 32
45 33 end
2  app/helpers/puppetclasses_helper.rb
@@ -3,7 +3,7 @@ module PuppetclassesHelper
3 3 include LookupKeysHelper
4 4 def rdoc_classes_path environment, name
5 5 klass = name.gsub('::', '/')
6   - frame = '<div id="puppetdoc"><iframe src="' + h(root_url + "puppet/rdoc/#{environment}/classes/#{klass}.html") + '" frameborder="0" height="600px" width="100%" scrolling="auto"></iframe></div>'
  6 + frame = '<div id="puppetdoc"><iframe src="' + root_url + "puppet/rdoc/#{environment}/classes/#{klass}.html" + '" frameborder="0" height="600px" width="100%" scrolling="auto"></iframe></div>'.html_safe
7 7 update_page do |page|
8 8 page.replace_html(:content, frame)
9 9 page.insert_html(:after, "puppetdoc",link_to(:back))
9 app/helpers/reports_helper.rb
@@ -22,7 +22,7 @@ def reports_since builder
22 22 end
23 23
24 24 def metric m
25   - h(m.round_with_precision(4)) rescue "N/A"
  25 + m.round(4) rescue "N/A"
26 26 end
27 27
28 28 def report_tag level
@@ -42,10 +42,9 @@ def report_tag level
42 42 def logs_show
43 43 return unless @report.logs.size > 0
44 44 form_tag @report, :id => 'level_filter', :method => :get do
45   - content_tag(:p, {}) { "Show log messages: " +
46   - select(nil, 'level', [['All messages', 'notice'],['Warnings and errors', 'warning'],['Errors only', 'error']],
47