bebox 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (402) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +78 -0
  3. data/Gemfile +3 -0
  4. data/Gemfile.lock +163 -0
  5. data/LICENSE +21 -0
  6. data/README.md +372 -0
  7. data/Rakefile +8 -0
  8. data/bebox.gemspec +40 -0
  9. data/bin/bebox +5 -0
  10. data/lib/bebox/cli.rb +42 -0
  11. data/lib/bebox/commands/commands_helper.rb +33 -0
  12. data/lib/bebox/commands/environment_commands.rb +46 -0
  13. data/lib/bebox/commands/general_commands.rb +24 -0
  14. data/lib/bebox/commands/node_commands.rb +68 -0
  15. data/lib/bebox/commands/prepare_commands.rb +59 -0
  16. data/lib/bebox/commands/project_commands.rb +44 -0
  17. data/lib/bebox/commands/provision_commands.rb +145 -0
  18. data/lib/bebox/environment.rb +114 -0
  19. data/lib/bebox/logger.rb +51 -0
  20. data/lib/bebox/node.rb +308 -0
  21. data/lib/bebox/profile.rb +102 -0
  22. data/lib/bebox/project.rb +259 -0
  23. data/lib/bebox/provision.rb +257 -0
  24. data/lib/bebox/role.rb +103 -0
  25. data/lib/bebox/version.rb +3 -0
  26. data/lib/bebox/wizards/environment_wizard.rb +45 -0
  27. data/lib/bebox/wizards/node_wizard.rb +163 -0
  28. data/lib/bebox/wizards/profile_wizard.rb +91 -0
  29. data/lib/bebox/wizards/project_wizard.rb +175 -0
  30. data/lib/bebox/wizards/provision_wizard.rb +80 -0
  31. data/lib/bebox/wizards/role_wizard.rb +97 -0
  32. data/lib/bebox.rb +2 -0
  33. data/lib/deb/puppet_3.6.0/augeas-lenses_0.10.0-0ubuntu4_all.deb +0 -0
  34. data/lib/deb/puppet_3.6.0/debconf-utils_1.5.42ubuntu1_all.deb +0 -0
  35. data/lib/deb/puppet_3.6.0/facter_2.0.1-1puppetlabs1_amd64.deb +0 -0
  36. data/lib/deb/puppet_3.6.0/hiera_1.3.2-1puppetlabs1_all.deb +0 -0
  37. data/lib/deb/puppet_3.6.0/libaugeas-ruby1.8_0.3.0-1.1ubuntu4_amd64.deb +0 -0
  38. data/lib/deb/puppet_3.6.0/libaugeas-ruby_0.3.0-1.1ubuntu4_all.deb +0 -0
  39. data/lib/deb/puppet_3.6.0/libaugeas0_0.10.0-0ubuntu4_amd64.deb +0 -0
  40. data/lib/deb/puppet_3.6.0/libjson-ruby_1.6.3-1_all.deb +0 -0
  41. data/lib/deb/puppet_3.6.0/libruby1.8_1.8.7.352-2ubuntu1.4_amd64.deb +0 -0
  42. data/lib/deb/puppet_3.6.0/libruby_4.8_all.deb +0 -0
  43. data/lib/deb/puppet_3.6.0/libshadow-ruby1.8_1.4.1-8build1_amd64.deb +0 -0
  44. data/lib/deb/puppet_3.6.0/puppet-common_3.6.0-1puppetlabs1_all.deb +0 -0
  45. data/lib/deb/puppet_3.6.0/puppet_3.6.0-1puppetlabs1_all.deb +0 -0
  46. data/lib/deb/puppet_3.6.0/ruby-json_1.6.3-1_amd64.deb +0 -0
  47. data/lib/deb/puppet_3.6.0/ruby-rgen_0.6.5-1puppetlabs1_all.deb +0 -0
  48. data/lib/deb/puppet_3.6.0/ruby1.8_1.8.7.352-2ubuntu1.4_amd64.deb +0 -0
  49. data/lib/deb/puppet_3.6.0/ruby_4.8_all.deb +0 -0
  50. data/lib/deb/puppet_3.6.0/virt-what_1.11-1_amd64.deb +0 -0
  51. data/lib/templates/node/Vagrantfile.erb +18 -0
  52. data/lib/templates/node/deploy_vagrant_node.erb +3 -0
  53. data/lib/templates/node/node.yml.erb +3 -0
  54. data/lib/templates/node/prepared_node.yml.erb +4 -0
  55. data/lib/templates/node/provisioned_node.yml.erb +4 -0
  56. data/lib/templates/project/Capfile.erb +2 -0
  57. data/lib/templates/project/Gemfile.erb +5 -0
  58. data/lib/templates/project/config/deploy/environment.erb +40 -0
  59. data/lib/templates/project/config/deploy/vagrant.erb +42 -0
  60. data/lib/templates/project/config/deploy.erb +120 -0
  61. data/lib/templates/project/dot_bebox.erb +4 -0
  62. data/lib/templates/project/gitignore.erb +7 -0
  63. data/lib/templates/project/ubuntu_dependencies +10 -0
  64. data/lib/templates/puppet/default_profiles/base/fundamental/ruby/Puppetfile +0 -0
  65. data/lib/templates/puppet/default_profiles/base/fundamental/ruby/manifests/init.pp +24 -0
  66. data/lib/templates/puppet/default_profiles/base/fundamental/sudo/Puppetfile +0 -0
  67. data/lib/templates/puppet/default_profiles/base/fundamental/sudo/manifests/init.pp +22 -0
  68. data/lib/templates/puppet/default_profiles/base/fundamental/users/Puppetfile +0 -0
  69. data/lib/templates/puppet/default_profiles/base/fundamental/users/manifests/init.pp +18 -0
  70. data/lib/templates/puppet/default_profiles/base/security/fail2ban/Puppetfile +2 -0
  71. data/lib/templates/puppet/default_profiles/base/security/fail2ban/manifests/init.pp +28 -0
  72. data/lib/templates/puppet/default_profiles/base/security/iptables/Puppetfile +2 -0
  73. data/lib/templates/puppet/default_profiles/base/security/iptables/manifests/init.pp +27 -0
  74. data/lib/templates/puppet/default_profiles/base/security/ssh/Puppetfile +2 -0
  75. data/lib/templates/puppet/default_profiles/base/security/ssh/manifests/init.pp +30 -0
  76. data/lib/templates/puppet/default_profiles/base/security/sysctl/Puppetfile +2 -0
  77. data/lib/templates/puppet/default_profiles/base/security/sysctl/manifests/init.pp +20 -0
  78. data/lib/templates/puppet/default_profiles/base/users/ssh/Puppetfile +2 -0
  79. data/lib/templates/puppet/default_profiles/base/users/ssh/manifests/init.pp +47 -0
  80. data/lib/templates/puppet/default_profiles/base/users/users/Puppetfile +0 -0
  81. data/lib/templates/puppet/default_profiles/base/users/users/manifests/init.pp +18 -0
  82. data/lib/templates/puppet/default_roles/fundamental/manifests/init.pp +16 -0
  83. data/lib/templates/puppet/default_roles/security/manifests/init.pp +17 -0
  84. data/lib/templates/puppet/default_roles/users/manifests/init.pp +15 -0
  85. data/lib/templates/puppet/profiles/Puppetfile.erb +24 -0
  86. data/lib/templates/puppet/profiles/manifests/init.pp.erb +17 -0
  87. data/lib/templates/puppet/roles/manifests/init.pp.erb +14 -0
  88. data/lib/templates/puppet/step-0/Puppetfile.erb +5 -0
  89. data/lib/templates/puppet/step-0/hiera/data/common.yaml.erb +26 -0
  90. data/lib/templates/puppet/step-0/hiera/data/environment.yaml.erb +26 -0
  91. data/lib/templates/puppet/step-0/hiera/data/node.yaml.erb +26 -0
  92. data/lib/templates/puppet/step-0/hiera/hiera.yaml.erb +11 -0
  93. data/lib/templates/puppet/step-0/manifests/node.erb +5 -0
  94. data/lib/templates/puppet/step-0/manifests/site.pp.erb +15 -0
  95. data/lib/templates/puppet/step-0/modules/rbenv/AUTHORS +11 -0
  96. data/lib/templates/puppet/step-0/modules/rbenv/CHANGELOG.md +70 -0
  97. data/lib/templates/puppet/step-0/modules/rbenv/Gemfile +8 -0
  98. data/lib/templates/puppet/step-0/modules/rbenv/Gemfile.lock +28 -0
  99. data/lib/templates/puppet/step-0/modules/rbenv/Modulefile +7 -0
  100. data/lib/templates/puppet/step-0/modules/rbenv/README.md +173 -0
  101. data/lib/templates/puppet/step-0/modules/rbenv/Rakefile +22 -0
  102. data/lib/templates/puppet/step-0/modules/rbenv/TODO +10 -0
  103. data/lib/templates/puppet/step-0/modules/rbenv/bin/autospec +16 -0
  104. data/lib/templates/puppet/step-0/modules/rbenv/bin/facter +16 -0
  105. data/lib/templates/puppet/step-0/modules/rbenv/bin/filebucket +16 -0
  106. data/lib/templates/puppet/step-0/modules/rbenv/bin/hiera +16 -0
  107. data/lib/templates/puppet/step-0/modules/rbenv/bin/htmldiff +16 -0
  108. data/lib/templates/puppet/step-0/modules/rbenv/bin/ldiff +16 -0
  109. data/lib/templates/puppet/step-0/modules/rbenv/bin/pi +16 -0
  110. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet +16 -0
  111. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet-lint +16 -0
  112. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppet-module +16 -0
  113. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetca +16 -0
  114. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetd +16 -0
  115. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetdoc +16 -0
  116. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetmasterd +16 -0
  117. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetqd +16 -0
  118. data/lib/templates/puppet/step-0/modules/rbenv/bin/puppetrun +16 -0
  119. data/lib/templates/puppet/step-0/modules/rbenv/bin/rake +16 -0
  120. data/lib/templates/puppet/step-0/modules/rbenv/bin/ralsh +16 -0
  121. data/lib/templates/puppet/step-0/modules/rbenv/bin/rspec +16 -0
  122. data/lib/templates/puppet/step-0/modules/rbenv/bin/rspec-puppet-init +16 -0
  123. data/lib/templates/puppet/step-0/modules/rbenv/lib/puppet/provider/rbenvgem/default.rb +50 -0
  124. data/lib/templates/puppet/step-0/modules/rbenv/lib/puppet/type/rbenvgem.rb +62 -0
  125. data/lib/templates/puppet/step-0/modules/rbenv/manifests/bundle.pp +36 -0
  126. data/lib/templates/puppet/step-0/modules/rbenv/manifests/client.pp +48 -0
  127. data/lib/templates/puppet/step-0/modules/rbenv/manifests/compile.pp +102 -0
  128. data/lib/templates/puppet/step-0/modules/rbenv/manifests/definition.pp +31 -0
  129. data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/centos.pp +25 -0
  130. data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/suse.pp +28 -0
  131. data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies/ubuntu.pp +17 -0
  132. data/lib/templates/puppet/step-0/modules/rbenv/manifests/dependencies.pp +8 -0
  133. data/lib/templates/puppet/step-0/modules/rbenv/manifests/gem.pp +29 -0
  134. data/lib/templates/puppet/step-0/modules/rbenv/manifests/install.pp +55 -0
  135. data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin/rbenvvars.pp +16 -0
  136. data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin/rubybuild.pp +16 -0
  137. data/lib/templates/puppet/step-0/modules/rbenv/manifests/plugin.pp +40 -0
  138. data/lib/templates/puppet/step-0/modules/rbenv/metadata.json +109 -0
  139. data/lib/templates/puppet/step-0/modules/rbenv/templates/Gemfile.erb +5 -0
  140. data/lib/templates/puppet/step-0/modules/rbenv/templates/dot.rbenvrc.erb +8 -0
  141. data/lib/templates/puppet/step-0/modules/stdlib/CHANGELOG.md +418 -0
  142. data/lib/templates/puppet/step-0/modules/stdlib/CONTRIBUTING.md +65 -0
  143. data/lib/templates/puppet/step-0/modules/stdlib/Gemfile +33 -0
  144. data/lib/templates/puppet/step-0/modules/stdlib/Gemfile.lock +166 -0
  145. data/lib/templates/puppet/step-0/modules/stdlib/LICENSE +19 -0
  146. data/lib/templates/puppet/step-0/modules/stdlib/Modulefile +11 -0
  147. data/lib/templates/puppet/step-0/modules/stdlib/README.markdown +1304 -0
  148. data/lib/templates/puppet/step-0/modules/stdlib/README_DEVELOPER.markdown +35 -0
  149. data/lib/templates/puppet/step-0/modules/stdlib/README_SPECS.markdown +7 -0
  150. data/lib/templates/puppet/step-0/modules/stdlib/RELEASE_PROCESS.markdown +24 -0
  151. data/lib/templates/puppet/step-0/modules/stdlib/Rakefile +18 -0
  152. data/lib/templates/puppet/step-0/modules/stdlib/checksums.json +349 -0
  153. data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/facter_dot_d.rb +202 -0
  154. data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/pe_version.rb +53 -0
  155. data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/puppet_vardir.rb +26 -0
  156. data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/root_home.rb +32 -0
  157. data/lib/templates/puppet/step-0/modules/stdlib/lib/facter/util/puppet_settings.rb +21 -0
  158. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/abs.rb +36 -0
  159. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/any2array.rb +33 -0
  160. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/base64.rb +37 -0
  161. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/bool2num.rb +49 -0
  162. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/capitalize.rb +34 -0
  163. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/chomp.rb +35 -0
  164. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/chop.rb +37 -0
  165. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/concat.rb +41 -0
  166. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/count.rb +22 -0
  167. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/deep_merge.rb +44 -0
  168. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/defined_with_params.rb +35 -0
  169. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete.rb +46 -0
  170. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_at.rb +49 -0
  171. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_undef_values.rb +34 -0
  172. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/delete_values.rb +26 -0
  173. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/difference.rb +36 -0
  174. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/dirname.rb +15 -0
  175. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/downcase.rb +33 -0
  176. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/empty.rb +28 -0
  177. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/ensure_packages.rb +35 -0
  178. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/ensure_resource.rb +45 -0
  179. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/flatten.rb +33 -0
  180. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/floor.rb +25 -0
  181. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/fqdn_rotate.rb +46 -0
  182. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/get_module_path.rb +17 -0
  183. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/getparam.rb +35 -0
  184. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/getvar.rb +26 -0
  185. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/grep.rb +33 -0
  186. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_interface_with.rb +52 -0
  187. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_ip_address.rb +25 -0
  188. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_ip_network.rb +25 -0
  189. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/has_key.rb +28 -0
  190. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/hash.rb +41 -0
  191. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/intersection.rb +34 -0
  192. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_array.rb +22 -0
  193. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_bool.rb +22 -0
  194. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_domain_name.rb +50 -0
  195. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_float.rb +30 -0
  196. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_function_available.rb +26 -0
  197. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_hash.rb +22 -0
  198. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_integer.rb +45 -0
  199. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_ip_address.rb +32 -0
  200. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_mac_address.rb +27 -0
  201. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_numeric.rb +75 -0
  202. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/is_string.rb +26 -0
  203. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/join.rb +41 -0
  204. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/join_keys_to_values.rb +47 -0
  205. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/keys.rb +26 -0
  206. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/loadyaml.rb +20 -0
  207. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/lstrip.rb +33 -0
  208. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/max.rb +21 -0
  209. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/member.rb +44 -0
  210. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/merge.rb +34 -0
  211. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/min.rb +21 -0
  212. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/num2bool.rb +43 -0
  213. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/parsejson.rb +24 -0
  214. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/parseyaml.rb +24 -0
  215. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/pick.rb +29 -0
  216. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/pick_default.rb +35 -0
  217. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/prefix.rb +45 -0
  218. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/range.rb +88 -0
  219. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/reject.rb +31 -0
  220. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/reverse.rb +28 -0
  221. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/rstrip.rb +32 -0
  222. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/shuffle.rb +46 -0
  223. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/size.rb +48 -0
  224. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/sort.rb +27 -0
  225. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/squeeze.rb +36 -0
  226. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/str2bool.rb +46 -0
  227. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/str2saltedsha512.rb +32 -0
  228. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/strftime.rb +107 -0
  229. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/strip.rb +39 -0
  230. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/suffix.rb +45 -0
  231. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/swapcase.rb +39 -0
  232. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/time.rb +49 -0
  233. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/to_bytes.rb +28 -0
  234. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/type.rb +50 -0
  235. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/union.rb +34 -0
  236. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/unique.rb +51 -0
  237. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/upcase.rb +41 -0
  238. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/uriescape.rb +35 -0
  239. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_absolute_path.rb +56 -0
  240. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_array.rb +33 -0
  241. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_augeas.rb +81 -0
  242. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_bool.rb +34 -0
  243. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_cmd.rb +48 -0
  244. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_hash.rb +33 -0
  245. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_ipv4_address.rb +48 -0
  246. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_ipv6_address.rb +49 -0
  247. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_re.rb +40 -0
  248. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_slength.rb +71 -0
  249. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/validate_string.rb +33 -0
  250. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/values.rb +39 -0
  251. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/values_at.rb +98 -0
  252. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/parser/functions/zip.rb +65 -0
  253. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/provider/file_line/ruby.rb +83 -0
  254. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/type/anchor.rb +46 -0
  255. data/lib/templates/puppet/step-0/modules/stdlib/lib/puppet/type/file_line.rb +79 -0
  256. data/lib/templates/puppet/step-0/modules/stdlib/manifests/init.pp +20 -0
  257. data/lib/templates/puppet/step-0/modules/stdlib/manifests/stages.pp +43 -0
  258. data/lib/templates/puppet/step-0/modules/stdlib/metadata.json +111 -0
  259. data/lib/templates/puppet/step-0/modules/sudo/.fixtures.yml +5 -0
  260. data/lib/templates/puppet/step-0/modules/sudo/.gemfile +14 -0
  261. data/lib/templates/puppet/step-0/modules/sudo/.gemfile.lock +43 -0
  262. data/lib/templates/puppet/step-0/modules/sudo/.travis.yml +34 -0
  263. data/lib/templates/puppet/step-0/modules/sudo/LICENSE +13 -0
  264. data/lib/templates/puppet/step-0/modules/sudo/Modulefile +9 -0
  265. data/lib/templates/puppet/step-0/modules/sudo/README.md +171 -0
  266. data/lib/templates/puppet/step-0/modules/sudo/Rakefile +1 -0
  267. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.aix +90 -0
  268. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.archlinux +90 -0
  269. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.deb +90 -0
  270. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.freebsd +98 -0
  271. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.omnios +90 -0
  272. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.rhel5 +97 -0
  273. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.rhel6 +115 -0
  274. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.solaris +90 -0
  275. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.suse +81 -0
  276. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.ubuntu +30 -0
  277. data/lib/templates/puppet/step-0/modules/sudo/files/sudoers.wheezy +17 -0
  278. data/lib/templates/puppet/step-0/modules/sudo/lib/augeas/lenses/fixedsudoers.aug +520 -0
  279. data/lib/templates/puppet/step-0/modules/sudo/manifests/allow.pp +76 -0
  280. data/lib/templates/puppet/step-0/modules/sudo/manifests/conf.pp +105 -0
  281. data/lib/templates/puppet/step-0/modules/sudo/manifests/configs.pp +24 -0
  282. data/lib/templates/puppet/step-0/modules/sudo/manifests/init.pp +151 -0
  283. data/lib/templates/puppet/step-0/modules/sudo/manifests/package/aix.pp +46 -0
  284. data/lib/templates/puppet/step-0/modules/sudo/manifests/package/solaris.pp +60 -0
  285. data/lib/templates/puppet/step-0/modules/sudo/manifests/package.pp +61 -0
  286. data/lib/templates/puppet/step-0/modules/sudo/manifests/params.pp +127 -0
  287. data/lib/templates/puppet/step-0/modules/sudo/metadata.json +59 -0
  288. data/lib/templates/puppet/step-0/modules/sudo/templates/users_groups.erb +9 -0
  289. data/lib/templates/puppet/step-0/modules/users/manifests/init.pp +15 -0
  290. data/lib/templates/puppet/step-0/modules/users/manifests/user.pp +50 -0
  291. data/lib/templates/puppet/step-1/Puppetfile.erb +5 -0
  292. data/lib/templates/puppet/step-1/hiera/data/common.yaml.erb +11 -0
  293. data/lib/templates/puppet/step-1/hiera/data/environment.yaml.erb +11 -0
  294. data/lib/templates/puppet/step-1/hiera/data/node.yaml.erb +11 -0
  295. data/lib/templates/puppet/step-1/hiera/hiera.yaml.erb +11 -0
  296. data/lib/templates/puppet/step-1/manifests/node.erb +5 -0
  297. data/lib/templates/puppet/step-1/manifests/site.pp.erb +15 -0
  298. data/lib/templates/puppet/step-1/modules/users/manifests/init.pp +15 -0
  299. data/lib/templates/puppet/step-1/modules/users/manifests/user.pp +49 -0
  300. data/lib/templates/puppet/step-2/Puppetfile.erb +5 -0
  301. data/lib/templates/puppet/step-2/hiera/data/common.yaml.erb +1 -0
  302. data/lib/templates/puppet/step-2/hiera/data/environment.yaml.erb +1 -0
  303. data/lib/templates/puppet/step-2/hiera/data/node.yaml.erb +1 -0
  304. data/lib/templates/puppet/step-2/hiera/hiera.yaml.erb +11 -0
  305. data/lib/templates/puppet/step-2/manifests/node.erb +3 -0
  306. data/lib/templates/puppet/step-2/manifests/site.pp.erb +10 -0
  307. data/lib/templates/puppet/step-3/Puppetfile.erb +5 -0
  308. data/lib/templates/puppet/step-3/hiera/data/common.yaml.erb +99 -0
  309. data/lib/templates/puppet/step-3/hiera/data/environment.yaml.erb +99 -0
  310. data/lib/templates/puppet/step-3/hiera/data/node.yaml.erb +99 -0
  311. data/lib/templates/puppet/step-3/hiera/hiera.yaml.erb +11 -0
  312. data/lib/templates/puppet/step-3/manifests/node.erb +5 -0
  313. data/lib/templates/puppet/step-3/manifests/site.pp.erb +15 -0
  314. data/spec/environment_spec.rb +82 -0
  315. data/spec/factories/environment.rb +20 -0
  316. data/spec/factories/node.rb +22 -0
  317. data/spec/factories/profile.rb +10 -0
  318. data/spec/factories/project.rb +17 -0
  319. data/spec/factories/provision.rb +13 -0
  320. data/spec/factories/role.rb +9 -0
  321. data/spec/fixtures/Capfile.test +2 -0
  322. data/spec/fixtures/Gemfile.test +5 -0
  323. data/spec/fixtures/config/deploy/environment.test +35 -0
  324. data/spec/fixtures/config/deploy/production.test +35 -0
  325. data/spec/fixtures/config/deploy/staging.test +35 -0
  326. data/spec/fixtures/config/deploy/vagrant.test +37 -0
  327. data/spec/fixtures/config/deploy.test +120 -0
  328. data/spec/fixtures/dot_bebox.test.erb +4 -0
  329. data/spec/fixtures/dot_gitignore.test +8 -0
  330. data/spec/fixtures/node/Vagrantfile.test.erb +18 -0
  331. data/spec/fixtures/node/node_0.test.erb +3 -0
  332. data/spec/fixtures/node/prepared_node_0.test.erb +4 -0
  333. data/spec/fixtures/node/provisioned_node_0.test.erb +4 -0
  334. data/spec/fixtures/node/vagrant_deploy.test +38 -0
  335. data/spec/fixtures/puppet/hiera/data/node0.server1.test.yaml.test +4 -0
  336. data/spec/fixtures/puppet/profiles/test/profile_0/Puppetfile.test +24 -0
  337. data/spec/fixtures/puppet/profiles/test/profile_0/Puppetfile_with_modules.test +20 -0
  338. data/spec/fixtures/puppet/profiles/test/profile_0/manifests/init.pp.test +17 -0
  339. data/spec/fixtures/puppet/profiles/test/profile_0/manifests/init_with_content.pp.test +22 -0
  340. data/spec/fixtures/puppet/roles/manifests/init.pp.test +14 -0
  341. data/spec/fixtures/puppet/steps/step-0/hiera/data/common.yaml.test +26 -0
  342. data/spec/fixtures/puppet/steps/step-0/hiera/data/node0.server1.test.yaml.test +0 -0
  343. data/spec/fixtures/puppet/steps/step-0/hiera/data/pname_env.yaml.test +26 -0
  344. data/spec/fixtures/puppet/steps/step-0/hiera/data/production.yaml.test +0 -0
  345. data/spec/fixtures/puppet/steps/step-0/hiera/data/staging.yaml.test +0 -0
  346. data/spec/fixtures/puppet/steps/step-0/hiera/data/vagrant.yaml.test +0 -0
  347. data/spec/fixtures/puppet/steps/step-0/hiera/hiera.yaml.test +11 -0
  348. data/spec/fixtures/puppet/steps/step-0/manifests/site.pp.test +10 -0
  349. data/spec/fixtures/puppet/steps/step-0/manifests/site_with_node.pp.test +15 -0
  350. data/spec/fixtures/puppet/steps/step-1/hiera/data/common.yaml.test +11 -0
  351. data/spec/fixtures/puppet/steps/step-1/hiera/data/node0.server1.test.yaml.test +0 -0
  352. data/spec/fixtures/puppet/steps/step-1/hiera/data/pname_env.yaml.test +11 -0
  353. data/spec/fixtures/puppet/steps/step-1/hiera/data/production.yaml.test +0 -0
  354. data/spec/fixtures/puppet/steps/step-1/hiera/data/staging.yaml.test +0 -0
  355. data/spec/fixtures/puppet/steps/step-1/hiera/data/vagrant.yaml.test +0 -0
  356. data/spec/fixtures/puppet/steps/step-1/hiera/hiera.yaml.test +11 -0
  357. data/spec/fixtures/puppet/steps/step-1/manifests/site.pp.test +10 -0
  358. data/spec/fixtures/puppet/steps/step-1/manifests/site_with_node.pp.test +15 -0
  359. data/spec/fixtures/puppet/steps/step-2/Puppetfile.test +6 -0
  360. data/spec/fixtures/puppet/steps/step-2/hiera/data/common.yaml.test +1 -0
  361. data/spec/fixtures/puppet/steps/step-2/hiera/data/node0.server1.test.yaml.test +1 -0
  362. data/spec/fixtures/puppet/steps/step-2/hiera/data/pname_env.yaml.test +1 -0
  363. data/spec/fixtures/puppet/steps/step-2/hiera/data/production.yaml.test +1 -0
  364. data/spec/fixtures/puppet/steps/step-2/hiera/data/staging.yaml.test +1 -0
  365. data/spec/fixtures/puppet/steps/step-2/hiera/data/vagrant.yaml.test +1 -0
  366. data/spec/fixtures/puppet/steps/step-2/hiera/hiera.yaml.test +11 -0
  367. data/spec/fixtures/puppet/steps/step-2/manifests/site.pp.test +10 -0
  368. data/spec/fixtures/puppet/steps/step-2/manifests/site_with_node.pp.test +13 -0
  369. data/spec/fixtures/puppet/steps/step-2/manifests/site_with_node_role_association.pp.test +16 -0
  370. data/spec/fixtures/puppet/steps/step-2/modules/profiles/manifests/test/profile_0.pp.test +17 -0
  371. data/spec/fixtures/puppet/steps/step-2/modules/roles/manifests/role_0.pp.test +16 -0
  372. data/spec/fixtures/puppet/steps/step-3/hiera/data/common.yaml.test +99 -0
  373. data/spec/fixtures/puppet/steps/step-3/hiera/data/node0.server1.test.yaml.test +1 -0
  374. data/spec/fixtures/puppet/steps/step-3/hiera/data/pname_env.yaml.test +99 -0
  375. data/spec/fixtures/puppet/steps/step-3/hiera/data/production.yaml.test +1 -0
  376. data/spec/fixtures/puppet/steps/step-3/hiera/data/staging.yaml.test +1 -0
  377. data/spec/fixtures/puppet/steps/step-3/hiera/data/vagrant.yaml.test +1 -0
  378. data/spec/fixtures/puppet/steps/step-3/hiera/hiera.yaml.test +11 -0
  379. data/spec/fixtures/puppet/steps/step-3/manifests/site.pp.test +10 -0
  380. data/spec/fixtures/puppet/steps/step-3/manifests/site_with_node.pp.test +15 -0
  381. data/spec/fixtures/puppet/ubuntu_dependencies.test +10 -0
  382. data/spec/node0.server1.test/prepare_phase_spec.rb +53 -0
  383. data/spec/node0.server1.test/provision_step_0_spec.rb +46 -0
  384. data/spec/node0.server1.test/provision_step_1_spec.rb +41 -0
  385. data/spec/node0.server1.test/provision_step_2_spec.rb +79 -0
  386. data/spec/node0.server1.test/provision_step_3_spec.rb +76 -0
  387. data/spec/node_role_spec.rb +20 -0
  388. data/spec/node_spec.rb +71 -0
  389. data/spec/node_wizard_spec.rb +22 -0
  390. data/spec/ordered_phases_spec.rb +55 -0
  391. data/spec/pre_prepare_spec.rb +78 -0
  392. data/spec/pre_provision_steps_spec.rb +40 -0
  393. data/spec/profile_spec.rb +70 -0
  394. data/spec/project_spec.rb +195 -0
  395. data/spec/project_wizard_spec.rb +51 -0
  396. data/spec/puppet_spec_helper.rb +15 -0
  397. data/spec/role_profiles_spec.rb +40 -0
  398. data/spec/role_spec.rb +56 -0
  399. data/spec/spec_helper.rb +37 -0
  400. data/spec/support/config_specs.yaml.example +2 -0
  401. data/spec/vagrant_spec_helper.rb +15 -0
  402. metadata +625 -0
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+ require_relative '../spec/factories/role.rb'
3
+ require_relative '../spec/factories/node.rb'
4
+ require_relative '../spec/factories/provision.rb'
5
+
6
+ describe 'Test 10: Associate node and role' do
7
+
8
+ let(:role) { build(:role) }
9
+ let(:nodes) { [build(:node)] }
10
+
11
+ context 'set role' do
12
+ it 'should add a role to a node' do
13
+ node = nodes.first
14
+ Bebox::Provision.associate_node_role(node.project_root, node.environment, node.hostname, role.name)
15
+ expected_content = File.read('spec/fixtures/puppet/steps/step-2/manifests/site_with_node_role_association.pp.test').strip
16
+ output_file = File.read("#{node.project_root}/puppet/steps/2-services/manifests/site.pp").strip
17
+ expect(output_file).to eq(expected_content)
18
+ end
19
+ end
20
+ end
data/spec/node_spec.rb ADDED
@@ -0,0 +1,71 @@
1
+ require 'spec_helper'
2
+ require_relative '../spec/factories/node.rb'
3
+
4
+ describe 'Test 04: Bebox::Node' do
5
+
6
+ describe 'Nodes management' do
7
+
8
+ subject { build(:node) }
9
+
10
+ context 'node creation' do
11
+ it 'should create hiera data template' do
12
+ subject.create_hiera_template
13
+ Bebox::PROVISION_STEPS.each do |step|
14
+ expect(File.exist?("#{subject.project_root}/puppet/steps/#{Bebox::Provision.step_name(step)}/hiera/data/#{subject.hostname}.yaml")).to eq(true)
15
+ end
16
+ end
17
+
18
+ it 'should create node in manifests file' do
19
+ subject.create_manifests_node
20
+ Bebox::PROVISION_STEPS.each do |step|
21
+ content = File.read("spec/fixtures/puppet/steps/#{step}/manifests/site_with_node.pp.test").gsub(/\s+/, ' ').strip
22
+ output = File.read("#{subject.project_root}/puppet/steps/#{Bebox::Provision.step_name(step)}/manifests/site.pp").gsub(/\s+/, ' ').strip
23
+ expect(output).to eq(content)
24
+ end
25
+ end
26
+
27
+ it 'should create checkpoint' do
28
+ subject.create_node_checkpoint
29
+ expect(File.exist?("#{subject.project_root}/.checkpoints/environments/#{subject.environment}/nodes/#{subject.hostname}.yml")).to be (true)
30
+ node_content = File.read("#{subject.project_root}/.checkpoints/environments/#{subject.environment}/nodes/#{subject.hostname}.yml").gsub(/\s+/, ' ').strip
31
+ ouput_template = Tilt::ERBTemplate.new('spec/fixtures/node/node_0.test.erb')
32
+ node_output_content = ouput_template.render(nil, node: subject).gsub(/\s+/, ' ').strip
33
+ expect(node_content).to eq(node_output_content)
34
+ end
35
+
36
+ it 'should list the current nodes' do
37
+ current_nodes = [subject.hostname]
38
+ nodes = Bebox::Node.list(subject.project_root, subject.environment, 'nodes')
39
+ expect(nodes).to include(*current_nodes)
40
+ end
41
+ end
42
+
43
+ context 'node deletion' do
44
+ it 'should remove checkpoint' do
45
+ subject.remove_checkpoints
46
+ expect(File.exist?("#{subject.project_root}/.checkpoints/environments/#{subject.environment}/nodes/#{subject.hostname}.yml")).to be (false)
47
+ end
48
+
49
+ it 'should not list any nodes' do
50
+ nodes = Bebox::Node.list(subject.project_root, subject.environment, 'nodes')
51
+ expect(nodes.count).to eq(0)
52
+ end
53
+
54
+ it 'should remove hiera data' do
55
+ subject.remove_hiera_template
56
+ Bebox::PROVISION_STEPS.each do |step|
57
+ expect(File.exist?("#{subject.project_root}/puppet/steps/#{Bebox::Provision.step_name(step)}/hiera/data/#{subject.hostname}.yaml")).to be (false)
58
+ end
59
+ end
60
+
61
+ it 'should remove node from manifests' do
62
+ subject.remove_manifests_node
63
+ Bebox::PROVISION_STEPS.each do |step|
64
+ content = File.read("spec/fixtures/puppet/steps/#{step}/manifests/site.pp.test").gsub(/\s+/, ' ').strip
65
+ output = File.read("#{subject.project_root}/puppet/steps/#{Bebox::Provision.step_name(step)}/manifests/site.pp").gsub(/\s+/, ' ').strip
66
+ expect(output).to eq(content)
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,22 @@
1
+ require 'spec_helper'
2
+
3
+ require_relative '../spec/factories/node.rb'
4
+
5
+ describe 'Test 03: Manage nodes with the wizard' do
6
+
7
+ subject { Bebox::NodeWizard.new }
8
+
9
+ let(:project_root) { "#{Dir.pwd}/tmp/bebox-pname" }
10
+ let(:environment) { "vagrant" }
11
+ let(:node_hostname) { "node_0.server1.test" }
12
+ let(:node_ip) { YAML.load_file('spec/support/config_specs.yaml')['test_ip'] }
13
+
14
+ it 'should check node existence' do
15
+ output = subject.node_exists?(project_root, environment, node_hostname)
16
+ expect(output).to eq(false)
17
+ end
18
+
19
+ it 'the ip should be free' do
20
+ expect(subject.free_ip?(node_ip)).to eq(true)
21
+ end
22
+ end
@@ -0,0 +1,55 @@
1
+ require 'spec_helper'
2
+ require 'project_wizard_spec'
3
+ require 'project_spec'
4
+ require 'environment_spec'
5
+ require 'node_wizard_spec'
6
+ require 'node_spec'
7
+ require 'pre_prepare_spec'
8
+ require 'node0.server1.test/prepare_phase_spec'
9
+ require 'role_spec'
10
+ require 'profile_spec'
11
+ require 'role_profiles_spec'
12
+ require 'node_role_spec'
13
+ require 'pre_provision_steps_spec'
14
+ require 'node0.server1.test/provision_step_0_spec'
15
+ require 'node0.server1.test/provision_step_1_spec'
16
+ require 'node0.server1.test/provision_step_2_spec'
17
+ require 'node0.server1.test/provision_step_3_spec'
18
+
19
+
20
+ describe 'Test 99: ordered specs' do
21
+
22
+ RSpec.configure do |config|
23
+ puts 'Configure spec order'
24
+ config.order_groups_and_examples do |list|
25
+ list.sort_by { |item| item.description if item.class != RSpec::Core::Example }
26
+ end
27
+ end
28
+
29
+ context '99: project destroy' do
30
+
31
+ let(:project) { build(:project) }
32
+ let(:node) { build(:node) }
33
+
34
+ it 'should clean spec files' do
35
+ # Test if the vagrant was halt
36
+ Bebox::Node.halt_vagrant_nodes(node.project_root)
37
+ expect(node.vagrant_box_running?).to be(false)
38
+ # Test if the vagrant box was destroyed
39
+ node.remove_vagrant_box
40
+ expect(node.vagrant_box_exist?).to be(false)
41
+ # Test if the project directory was destroyed
42
+ project.destroy
43
+ expect(Dir.exist?("#{project.path}")).to be(false)
44
+ # Test that the local hosts file was restored
45
+ puts "\nPlease provide your account password, if ask you, to restore the local hosts file.".yellow
46
+ hosts_backup_content = File.read("#{node.local_hosts_path}/hosts_before_#{project.name}").gsub(/\s+/, ' ').strip
47
+ node.restore_local_hosts(project.name)
48
+ hosts_content = File.read("#{node.local_hosts_path}/hosts").gsub(/\s+/, ' ').strip
49
+ expect(hosts_content).to eq(hosts_backup_content)
50
+ expect(File.exist?("#{node.local_hosts_path}/hosts_before_#{project.name}")).to be(false)
51
+ end
52
+ end
53
+
54
+ specify("End of tests") {}
55
+ end
@@ -0,0 +1,78 @@
1
+ require 'spec_helper'
2
+ require 'tilt'
3
+ require 'colorize'
4
+ require_relative '../spec/factories/node.rb'
5
+
6
+ describe 'Test 05: Bebox::Node' do
7
+
8
+ describe 'Pre-prepare nodes' do
9
+
10
+ let(:nodes) { 1.times.map{|index| build(:node, :created, hostname: "node#{index}.server1.test")} }
11
+ let(:project_root) { "#{Dir.pwd}/tmp/bebox-pname" }
12
+ let(:environment) { 'vagrant' }
13
+ let(:project_name) {'bebox-pname'}
14
+ let(:vagrant_box_base) {"#{Dir.pwd}/ubuntu-server-12042-x64-vbox4210-nocm.box"}
15
+
16
+ context 'pre vagrant prepare' do
17
+ it 'should generate the Vagrantfile' do
18
+ Bebox::Node.generate_vagrantfile(project_root, nodes)
19
+ vagrantfile_content = File.read("#{project_root}/Vagrantfile").gsub(/\s+/, ' ').strip
20
+ ouput_template = Tilt::ERBTemplate.new('spec/fixtures/node/Vagrantfile.test.erb')
21
+ vagrantfile_output_content = ouput_template.render(nil, ip_address: nodes.first.ip).gsub(/\s+/, ' ').strip
22
+ expect(vagrantfile_content).to eq(vagrantfile_output_content)
23
+ end
24
+ it 'should regenerate the vagrant deploy file' do
25
+ Bebox::Node.regenerate_deploy_file(project_root, environment, nodes)
26
+ vagrant_deploy_content = File.read("#{project_root}/config/deploy/vagrant.rb").gsub(/\s+/, ' ').strip
27
+ vagrant_deploy_output_content = File.read("spec/fixtures/node/vagrant_deploy.test").gsub(/\s+/, ' ').strip
28
+ expect(vagrant_deploy_content).to eq(vagrant_deploy_output_content)
29
+ end
30
+ end
31
+
32
+ context 'vagrant prepare' do
33
+ describe 'Configure the hosts file' do
34
+ it 'should create a hosts backup file' do
35
+ node = nodes.first
36
+ puts "\nPlease provide your account password, if ask you, to configure the local hosts file.".yellow
37
+ `sudo rm -rf #{node.local_hosts_path}/hosts_before_#{project_name}`
38
+ original_hosts_content = File.read("#{node.local_hosts_path}/hosts").gsub(/\s+/, ' ').strip
39
+ nodes.each{|node| node.backup_local_hosts(project_name)}
40
+ hosts_backup_file = "#{node.local_hosts_path}/hosts_before_#{project_name}"
41
+ expect(File).to exist(hosts_backup_file)
42
+ hosts_backup_content = File.read(hosts_backup_file).gsub(/\s+/, ' ').strip
43
+ expect(original_hosts_content).to eq(hosts_backup_content)
44
+ end
45
+
46
+ it 'should add the hosts config to hosts file' do
47
+ nodes.each{|node| node.add_to_local_hosts}
48
+ node = nodes.first
49
+ hosts_content = File.read("#{node.local_hosts_path}/hosts").gsub(/\s+/, ' ').strip
50
+ expect(hosts_content).to include(*nodes.map{|node| "#{node.ip} #{node.hostname}"})
51
+ end
52
+ end
53
+
54
+ describe 'vagrant setup' do
55
+ it 'should add the node to vagrant' do
56
+ vagrant_box_names_expected = nodes.map{|node| "#{project_name}-#{node.hostname}"}
57
+ nodes.each{|node| node.add_vagrant_node(project_name, vagrant_box_base)}
58
+ node = nodes.first
59
+ expect(node.installed_vagrant_box_names).to include(*vagrant_box_names_expected)
60
+ end
61
+
62
+ it 'should up the vagrant boxes' do
63
+ Bebox::Node.up_vagrant_nodes(project_root)
64
+ nodes.each{|node| expect(node.vagrant_box_running?).to eq(true)}
65
+ end
66
+
67
+ it 'should connect to vagrant box through ssh' do
68
+ connection_successful = true
69
+ nodes.each do |node|
70
+ `ssh -q -oStrictHostKeyChecking=no -i ~/.vagrant.d/insecure_private_key -l vagrant #{node.ip} exit`
71
+ connection_successful &= ($?.exitstatus == 0)
72
+ end
73
+ expect(connection_successful).to eq(true)
74
+ end
75
+ end
76
+ end
77
+ end
78
+ end
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+ require_relative '../spec/factories/role.rb'
3
+ require_relative '../spec/factories/profile.rb'
4
+ require_relative '../spec/factories/provision.rb'
5
+
6
+ describe 'Test 11: Pre provision apply step' do
7
+
8
+ let(:provision) { build(:provision, step: 'step-2') }
9
+ let(:role) { build(:role) }
10
+ let(:profile) { build(:profile) }
11
+ let(:profiles) { [profile.relative_path] }
12
+
13
+ before :all do
14
+ role.create
15
+ profile.create
16
+ Bebox::Role.add_profile(role.project_root, role.name, profile.relative_path)
17
+ `cp spec/fixtures/puppet/profiles/#{profile.relative_path}/Puppetfile_with_modules.test #{profile.absolute_path}/Puppetfile`
18
+ end
19
+
20
+ it 'should generate a Puppetfile' do
21
+ Bebox::Provision.generate_puppetfile(provision.project_root, provision.step, [profile.relative_path])
22
+ output_file = File.read("#{provision.project_root}/puppet/steps/#{Bebox::Provision.step_name(provision.step)}/Puppetfile").gsub(/\s+/, ' ').strip
23
+ expected_content = File.read("spec/fixtures/puppet/steps/#{provision.step}/Puppetfile.test").gsub(/\s+/, ' ').strip
24
+ expect(output_file).to eq(expected_content)
25
+ end
26
+
27
+ it 'should generate the roles and profiles modules' do
28
+ Bebox::Provision.generate_roles_and_profiles(provision.project_root, provision.step, role.name, [profile.relative_path])
29
+ # Expect the role is created
30
+ output_file = File.read("#{provision.project_root}/puppet/steps/#{Bebox::Provision.step_name(provision.step)}/modules/roles/manifests/#{role.name}.pp").gsub(/\s+/, ' ').strip
31
+ expected_content = File.read("spec/fixtures/puppet/steps/#{provision.step}/modules/roles/manifests/#{role.name}.pp.test").gsub(/\s+/, ' ').strip
32
+ expect(output_file).to eq(expected_content)
33
+ # Expect the profiles are created
34
+ profiles.each do |profile_name|
35
+ output_file = File.read("#{provision.project_root}/puppet/steps/#{Bebox::Provision.step_name(provision.step)}/modules/profiles/manifests/#{profile_name}.pp").gsub(/\s+/, ' ').strip
36
+ expected_content = File.read("spec/fixtures/puppet/steps/#{provision.step}/modules/profiles/manifests/#{profile_name}.pp.test").gsub(/\s+/, ' ').strip
37
+ expect(output_file).to eq(expected_content)
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,70 @@
1
+ require 'spec_helper'
2
+ require_relative '../spec/factories/profile.rb'
3
+
4
+ describe 'Test 08: Bebox::Profile' do
5
+
6
+ describe 'Manage profiles' do
7
+
8
+ subject { build(:profile) }
9
+
10
+ before :all do
11
+ subject.create
12
+ end
13
+
14
+ context '00: profile creation' do
15
+
16
+ it 'should validate the profile name' do
17
+ # Test not valid reserved words
18
+ Bebox::RESERVED_WORDS.each{|reserved_word| expect(Bebox::Profile.valid_name?(reserved_word)).to be (false)}
19
+ # Test not valid start by undescore
20
+ expect(Bebox::Profile.valid_name?('_profile_0')).to be (false)
21
+ # Test not valid contain Upper letter
22
+ expect(Bebox::Profile.valid_name?('Profile_0')).to be (false)
23
+ # Test not valid contain dash character
24
+ expect(Bebox::Profile.valid_name?('profile-0')).to be (false)
25
+ # Test valid name not contains reserved words, start with letter, contains only downcase letters, numbers and undescores
26
+ expect(Bebox::Profile.valid_name?(subject.name)).to be (true)
27
+ end
28
+
29
+ it 'should clean the profile path' do
30
+ # Profile path with slash
31
+ expect(Bebox::Profile.cleanpath('/')).to eq ('')
32
+ # Profile path with multiple slashes
33
+ expect(Bebox::Profile.cleanpath('///basic//test///')).to eq ('basic/test')
34
+ # Subject path is correct so would be the same
35
+ expect(Bebox::Profile.cleanpath(subject.path)).to eq (subject.path)
36
+ end
37
+
38
+ it 'should create profile directories' do
39
+ expect(Dir.exist?("#{subject.absolute_path}/manifests")).to be (true)
40
+ end
41
+
42
+ it 'should generate the manifests file' do
43
+ output_file = File.read("#{subject.absolute_path}/manifests/init.pp").strip
44
+ expected_content = File.read("spec/fixtures/puppet/profiles/#{subject.relative_path}/manifests/init.pp.test").strip
45
+ expect(output_file).to eq(expected_content)
46
+ end
47
+
48
+ it 'should generate the Puppetfile' do
49
+ output_file = File.read("#{subject.absolute_path}/Puppetfile").strip
50
+ expected_content = File.read("spec/fixtures/puppet/profiles/#{subject.relative_path}/Puppetfile.test").strip
51
+ expect(output_file).to eq(expected_content)
52
+ end
53
+ end
54
+
55
+ context '01: profile list' do
56
+ it 'should list profiles' do
57
+ current_profiles = [subject.relative_path]
58
+ profiles = Bebox::Profile.list(subject.project_root)
59
+ expect(profiles).to include(*current_profiles)
60
+ end
61
+ end
62
+
63
+ context '02: profile deletion' do
64
+ it 'should delete profile directory' do
65
+ subject.remove
66
+ expect(Dir.exist?("#{subject.absolute_path}")).to be (false)
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,195 @@
1
+ require 'spec_helper'
2
+ require_relative '../spec/factories/project.rb'
3
+
4
+ describe 'Test 01: Bebox::Project' do
5
+
6
+ describe 'Project creation' do
7
+
8
+ subject { build(:project) }
9
+
10
+ it 'should create the project directory' do
11
+ subject.create_project_directory
12
+ expect(Dir.exist?(subject.path)).to be true
13
+ end
14
+
15
+ context '00: Project config files creation' do
16
+ it 'should create the templates directories' do
17
+ directories_expected = ['templates', 'roles', 'profiles']
18
+ subject.create_templates_directories
19
+ directories = []
20
+ directories << Dir["#{subject.path}/*/"].map { |f| File.basename(f) }
21
+ directories << Dir["#{subject.path}/*/*/"].map { |f| File.basename(f) }
22
+ directories << Dir["#{subject.path}/*/*/*/"].map { |f| File.basename(f) }
23
+ expect(directories.flatten).to include(*directories_expected)
24
+ end
25
+
26
+ it 'should create config deploy directories' do
27
+ directories_expected = ['config', 'deploy', 'keys', 'environments']
28
+ subject.create_config_deploy_directories
29
+ directories = []
30
+ directories << Dir["#{subject.path}/*/"].map { |f| File.basename(f) }
31
+ directories << Dir["#{subject.path}/*/*/"].map { |f| File.basename(f) }
32
+ directories << Dir["#{subject.path}/*/*/*/"].map { |f| File.basename(f) }
33
+ expect(directories.flatten).to include(*directories_expected)
34
+ end
35
+
36
+ it 'should generate a .bebox file' do
37
+ subject.generate_dot_bebox_file
38
+ dotbebox_content = File.read("#{subject.path}/.bebox").gsub(/\s+/, ' ').strip
39
+ ouput_template = Tilt::ERBTemplate.new('spec/fixtures/dot_bebox.test.erb')
40
+ dotbebox_expected_content = ouput_template.render(nil, created_at: subject.created_at).gsub(/\s+/, ' ').strip
41
+ expect(dotbebox_content).to eq(dotbebox_expected_content)
42
+ end
43
+
44
+ it 'should generate a .gitignore file' do
45
+ subject.generate_gitignore_file
46
+ expected_content = File.read("#{subject.path}/.gitignore")
47
+ output_file = File.read('spec/fixtures/dot_gitignore.test')
48
+ expect(output_file).to eq(expected_content)
49
+ end
50
+
51
+ it 'should generate a .ruby-version file' do
52
+ subject.generate_ruby_version
53
+ version = File.read("#{subject.path}/.ruby-version").strip
54
+ expect(version).to eq(RUBY_VERSION)
55
+ end
56
+
57
+ it 'should create a Capfile' do
58
+ subject.create_capfile
59
+ expected_content = File.read("#{subject.path}/Capfile")
60
+ output_file = File.read('spec/fixtures/Capfile.test')
61
+ expect(output_file).to eq(expected_content)
62
+ end
63
+
64
+ it 'should generate deploy file' do
65
+ subject.generate_deploy_file
66
+ config_deploy_content = File.read("#{subject.path}/config/deploy.rb").gsub(/\s+/, ' ').strip
67
+ config_deploy_output_content = File.read("spec/fixtures/config/deploy.test").gsub(/\s+/, ' ').strip
68
+ expect(config_deploy_content).to eq(config_deploy_output_content)
69
+ end
70
+
71
+ it 'should create Gemfile' do
72
+ subject.create_gemfile
73
+ content = File.read("#{subject.path}/Gemfile").gsub(/\s+/, ' ').strip
74
+ output = File.read("spec/fixtures/Gemfile.test").gsub(/\s+/, ' ').strip
75
+ expect(output).to eq(content)
76
+ end
77
+ end
78
+
79
+ context '01: Create puppet base' do
80
+ it 'should generate SO dependencies files' do
81
+ subject.generate_so_dependencies_files
82
+ content = File.read("#{subject.path}/puppet/prepare/dependencies/ubuntu/packages")
83
+ output = File.read("spec/fixtures/puppet/ubuntu_dependencies.test")
84
+ expect(output).to eq(content)
85
+ end
86
+
87
+ it 'should copy puppet install files' do
88
+ subject.copy_puppet_install_files
89
+ expect(Dir.exist?("#{subject.path}/puppet/lib/deb/puppet_3.6.0")).to be (true)
90
+ expect(Dir["#{subject.path}/puppet/lib/deb/puppet_3.6.0/*"].count).to eq(18)
91
+ end
92
+
93
+ it 'should generate steps directories' do
94
+ expected_directories = ['prepare', 'profiles', 'roles', 'steps',
95
+ '0-fundamental', '1-users', '2-services', '3-security',
96
+ 'hiera', 'manifests', 'modules', 'data']
97
+ subject.generate_steps_directories
98
+ directories = []
99
+ directories << Dir["#{subject.path}/puppet/*/"].map { |f| File.basename(f) }
100
+ directories << Dir["#{subject.path}/puppet/*/*/"].map { |f| File.basename(f) }
101
+ directories << Dir["#{subject.path}/puppet/*/*/*/"].map { |f| File.basename(f) }
102
+ directories << Dir["#{subject.path}/puppet/*/*/*/*/"].map { |f| File.basename(f) }
103
+ expect(directories.flatten).to include(*expected_directories)
104
+ end
105
+
106
+ it 'should copy the default roles and profiles' do
107
+ expected_roles_directories = ['fundamental', 'security', 'users']
108
+ expected_profiles_directories = ['profiles', 'base', 'fundamental', 'ruby', 'manifests', 'sudo', 'users', 'security', 'fail2ban', 'iptables', 'ssh', 'sysctl']
109
+ subject.copy_default_roles_profiles
110
+ directories = Dir["#{subject.path}/puppet/roles/*/"].map { |f| File.basename(f) }.uniq
111
+ expect(directories).to include(*expected_roles_directories)
112
+ directories = Dir["#{subject.path}/puppet/profiles/**/"].map { |f| File.basename(f) }.uniq
113
+ expect(directories).to include(*expected_profiles_directories)
114
+ end
115
+
116
+ context '02: generate steps templates' do
117
+ before :all do
118
+ subject.generate_steps_templates
119
+ end
120
+ it 'should generate manifests template' do
121
+ Bebox::PROVISION_STEPS.each do |step|
122
+ content = File.read("spec/fixtures/puppet/steps/#{step}/manifests/site.pp.test")
123
+ output = File.read("#{subject.path}/puppet/steps/#{Bebox::Provision.step_name(step)}/manifests/site.pp")
124
+ expect(output).to eq(content)
125
+ end
126
+ end
127
+ it 'should generate hiera template' do
128
+ Bebox::PROVISION_STEPS.each do |step|
129
+ content = File.read("spec/fixtures/puppet/steps/#{step}/hiera/hiera.yaml.test")
130
+ output = File.read("#{subject.path}/puppet/steps/#{Bebox::Provision.step_name(step)}/hiera/hiera.yaml")
131
+ expect(output).to eq(content)
132
+ end
133
+ end
134
+ it 'should generate hiera data common' do
135
+ Bebox::PROVISION_STEPS.each do |step|
136
+ content = File.read("spec/fixtures/puppet/steps/#{step}/hiera/data/common.yaml.test")
137
+ output = File.read("#{subject.path}/puppet/steps/#{Bebox::Provision.step_name(step)}/hiera/data/common.yaml")
138
+ expect(output).to eq(content)
139
+ end
140
+ end
141
+ end
142
+ end
143
+
144
+ context '03: checkpoints' do
145
+ it 'should create checkpoints directories' do
146
+ expected_directories = ['.checkpoints', 'environments']
147
+ subject.create_checkpoints
148
+ directories = []
149
+ directories << Dir["#{subject.path}/.checkpoints/"].map { |f| File.basename(f) }
150
+ directories << Dir["#{subject.path}/.checkpoints/*/"].map { |f| File.basename(f) }
151
+ expect(directories.flatten).to include(*expected_directories)
152
+ end
153
+ end
154
+
155
+ context '04: bundle project' do
156
+ it 'should install dependencies' do
157
+ subject.bundle_project
158
+ expect(File).to exist("#{subject.path}/Gemfile.lock")
159
+ end
160
+ end
161
+
162
+ context '05: create default environments' do
163
+
164
+ before(:all) do
165
+ subject.create_default_environments
166
+ end
167
+
168
+ it 'should generate deploy files' do
169
+ subject.environments.each do |environment|
170
+ config_deploy_vagrant_content = File.read("#{subject.path}/config/deploy/#{environment.name}.rb").gsub(/\s+/, ' ').strip
171
+ config_deploy_vagrant_output_content = File.read("spec/fixtures/config/deploy/#{environment.name}.test").gsub(/\s+/, ' ').strip
172
+ expect(config_deploy_vagrant_content).to eq(config_deploy_vagrant_output_content)
173
+ end
174
+ end
175
+
176
+ it 'should create checkpoints' do
177
+ expected_directories = ['vagrant', 'staging', 'production', 'nodes', 'prepared_nodes',
178
+ 'steps', 'step-0', 'step-1', 'step-2', 'step-3']
179
+ directories = []
180
+ directories << Dir["#{subject.path}/.checkpoints/environments/*/"].map { |f| File.basename(f) }
181
+ directories << Dir["#{subject.path}/.checkpoints/environments/*/*/"].map { |f| File.basename(f) }
182
+ directories << Dir["#{subject.path}/.checkpoints/environments/*/*/*/"].map { |f| File.basename(f) }
183
+ expect(directories.flatten).to include(*expected_directories)
184
+ end
185
+
186
+ it 'should create capistrano base' do
187
+ subject.environments.each do |environment|
188
+ expect(Dir.exist?("#{subject.path}/config/keys/environments/#{environment.name}")).to be (true)
189
+ end
190
+ expect(File.exist?("#{subject.path}/config/keys/environments/vagrant/id_rsa")).to be (true)
191
+ expect(File.exist?("#{subject.path}/config/keys/environments/vagrant/id_rsa.pub")).to be (true)
192
+ end
193
+ end
194
+ end
195
+ end
@@ -0,0 +1,51 @@
1
+ require 'spec_helper'
2
+ # require 'vcr'
3
+
4
+ require_relative '../spec/factories/project.rb'
5
+
6
+ describe 'Test 00: Create a new project with the wizard' do
7
+
8
+ describe 'Project data provision' do
9
+
10
+ subject { Bebox::ProjectWizard.new }
11
+
12
+ let(:project_name) { 'bebox-pname' }
13
+ let(:parent_path) { "#{Dir.pwd}/tmp" }
14
+ let(:http_box_uri) {'http://puppet-vagrant-boxes.puppetlabs.com/ubuntu-server-12042-x64-vbox4210-nocm.box'}
15
+ let(:local_box_uri) {"#{Dir.pwd}/spec/fixtures/test_box.box"}
16
+ let(:bebox_boxes_path) {File.expand_path(Bebox::ProjectWizard::BEBOX_BOXES_PATH)}
17
+
18
+ it 'should check project existence' do
19
+ output = subject.project_exists?(parent_path, project_name)
20
+ expect(output).to eq(false)
21
+ end
22
+
23
+ it 'should setup the bebox boxes directory' do
24
+ subject.bebox_boxes_setup
25
+ expect(Dir.exist?("#{bebox_boxes_path}/tmp")).to eq(true)
26
+ expect(Dir["#{bebox_boxes_path}/tmp/*"].count).to eq(0)
27
+ end
28
+
29
+ it 'should validate an http box uri' do
30
+ output = subject.uri_valid?(http_box_uri)
31
+ expect(output).to eq(true)
32
+ end
33
+
34
+ it 'should validate a local-file box uri' do
35
+ output = subject.uri_valid?(local_box_uri)
36
+ expect(output).to eq(true)
37
+ end
38
+
39
+ # it 'should download an http box' do
40
+ # VCR.use_cassette('box_download') do
41
+ # subject.set_box(http_box_uri)
42
+ # end
43
+ # expect(File.exist?("#{bebox_boxes_path}/ubuntu-server-12042-x64-vbox4210-nocm.box")).to eq(true)
44
+ # end
45
+
46
+ it 'should link a local file box' do
47
+ subject.set_box(local_box_uri)
48
+ expect(File.symlink?("#{bebox_boxes_path}/test_box.box")).to eq(true)
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,15 @@
1
+ RSpec.configure do |config|
2
+ config.before do
3
+ host = 'node0.server1.test'
4
+ if config.host != host
5
+ config.disable_sudo = true
6
+ config.ssh.close if config.ssh
7
+ config.host = host
8
+ options = Net::SSH::Config.for(config.host)
9
+ options[:keys] = ["#{puppet.project_root}/config/keys/environments/vagrant/id_rsa"]
10
+ options[:forward_agent] = true
11
+ user = 'puppet'
12
+ config.ssh = Net::SSH.start(config.host, user, options)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,40 @@
1
+ require 'spec_helper'
2
+ require_relative '../spec/factories/role.rb'
3
+ require_relative '../spec/factories/profile.rb'
4
+
5
+ describe 'Test 09: Associate roles and profiles' do
6
+
7
+ let(:role) { build(:role) }
8
+ let(:profile) { build(:profile) }
9
+
10
+ before :all do
11
+ role.create
12
+ profile.create
13
+ end
14
+
15
+ context 'add profiles' do
16
+ it 'should add a profile to a role' do
17
+ role_content = "include profiles::#{profile.namespace_name}"
18
+ Bebox::Role.add_profile(role.project_root, role.name, profile.relative_path)
19
+ output_file = File.read("#{role.path}/manifests/init.pp").strip
20
+ expect(output_file).to include(role_content)
21
+ end
22
+ end
23
+
24
+ context 'list profiles' do
25
+ it 'should list profiles' do
26
+ current_profiles = [profile.relative_path]
27
+ profiles = Bebox::Role.list_profiles(role.project_root, role.name)
28
+ expect(profiles).to include(*current_profiles)
29
+ end
30
+ end
31
+
32
+ context 'remove profiles' do
33
+ it 'should delete profile in a role' do
34
+ role_content = "include profiles::#{profile.namespace_name}"
35
+ Bebox::Role.remove_profile(role.project_root, role.name, profile.relative_path)
36
+ output_file = File.read("#{role.path}/manifests/init.pp").strip
37
+ expect(output_file).to_not include(role_content)
38
+ end
39
+ end
40
+ end