lobot 2.0.0pre → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (297) hide show
  1. data/.gitignore +7 -10
  2. data/.gitmodules +1 -1
  3. data/.pairs +15 -0
  4. data/.rvmrc +1 -1
  5. data/.travis.yml +5 -0
  6. data/Gemfile +2 -2
  7. data/LICENSE.txt +1 -1
  8. data/README.md +67 -29
  9. data/Rakefile +11 -6
  10. data/Vagrantfile +8 -5
  11. data/bin/lobot +2 -4
  12. data/chef/cookbooks/pivotal_ci/attributes/jenkins.rb +1 -0
  13. data/chef/cookbooks/pivotal_ci/files/default/tests/minitest/default_test.rb +40 -2
  14. data/chef/cookbooks/pivotal_ci/recipes/id_rsa.rb +5 -0
  15. data/chef/cookbooks/pivotal_ci/recipes/jenkins_config.rb +5 -2
  16. data/chef/cookbooks/pivotal_ci/recipes/limited_travis_ci_environment.rb +4 -0
  17. data/chef/cookbooks/pivotal_ci/templates/default/jenkins-job-config.xml.erb +8 -6
  18. data/chef/cookbooks/pivotal_ci/test/kitchen/cookbooks/pivotal_ci_test/attributes/default.rb +0 -1
  19. data/chef/cookbooks/pivotal_ci/test/kitchen/cookbooks/pivotal_ci_test/recipes/bootstrap.rb +41 -0
  20. data/chef/cookbooks/pivotal_ci/test/kitchen/cookbooks/pivotal_ci_test/recipes/default.rb +1 -41
  21. data/chef/travis-cookbooks/ci_environment/apt/recipes/default.rb +8 -7
  22. data/chef/travis-cookbooks/ci_environment/bazaar/recipes/default.rb +1 -1
  23. data/chef/travis-cookbooks/ci_environment/cassandra/attributes/default.rb +6 -3
  24. data/chef/travis-cookbooks/ci_environment/cassandra/recipes/datastax.rb +1 -1
  25. data/chef/travis-cookbooks/ci_environment/cassandra/recipes/package.rb +1 -1
  26. data/chef/travis-cookbooks/ci_environment/cassandra/recipes/tarball.rb +6 -2
  27. data/chef/travis-cookbooks/ci_environment/cassandra/templates/default/cassandra.init.erb +58 -131
  28. data/chef/travis-cookbooks/ci_environment/chromium/recipes/default.rb +1 -1
  29. data/chef/travis-cookbooks/ci_environment/clang/attributes/tarball.rb +2 -7
  30. data/chef/travis-cookbooks/ci_environment/clang/recipes/default.rb +1 -1
  31. data/chef/travis-cookbooks/ci_environment/clang/recipes/tarball.rb +2 -4
  32. data/chef/travis-cookbooks/ci_environment/couchdb/recipes/default.rb +1 -1
  33. data/chef/travis-cookbooks/ci_environment/couchdb/recipes/ppa.rb +1 -1
  34. data/chef/travis-cookbooks/ci_environment/couchdb/recipes/ubuntu-12.04.rb +1 -1
  35. data/chef/travis-cookbooks/ci_environment/couchdb/recipes/ubuntu1110_ppa.rb +1 -1
  36. data/chef/travis-cookbooks/ci_environment/couchdb/recipes/ubuntu1204_ppa.rb +1 -1
  37. data/chef/travis-cookbooks/ci_environment/doxygen/recipes/default.rb +24 -0
  38. data/chef/travis-cookbooks/ci_environment/elasticsearch/attributes/default.rb +4 -1
  39. data/chef/travis-cookbooks/ci_environment/elasticsearch/recipes/default.rb +8 -5
  40. data/chef/travis-cookbooks/ci_environment/emacs/recipes/nox.rb +1 -1
  41. data/chef/travis-cookbooks/ci_environment/firefox/recipes/default.rb +1 -1
  42. data/chef/travis-cookbooks/ci_environment/git/recipes/default.rb +1 -1
  43. data/chef/travis-cookbooks/ci_environment/git/recipes/ppa.rb +1 -1
  44. data/chef/travis-cookbooks/ci_environment/golang/attributes/default.rb +3 -3
  45. data/chef/travis-cookbooks/ci_environment/gradle/attributes/tarball.rb +1 -1
  46. data/chef/travis-cookbooks/ci_environment/haskell/recipes/default.rb +1 -1
  47. data/chef/travis-cookbooks/ci_environment/haskell/recipes/ghc_package.rb +1 -1
  48. data/chef/travis-cookbooks/ci_environment/haskell/recipes/ghc_source.rb +1 -1
  49. data/chef/travis-cookbooks/ci_environment/haskell/recipes/platform_package.rb +1 -1
  50. data/chef/travis-cookbooks/ci_environment/haskell/recipes/platform_ppa.rb +1 -1
  51. data/chef/travis-cookbooks/ci_environment/haskell/recipes/platform_source.rb +1 -1
  52. data/chef/travis-cookbooks/ci_environment/haskell/recipes/source.rb +1 -1
  53. data/chef/travis-cookbooks/ci_environment/hbase/recipes/cdh4.rb +1 -1
  54. data/chef/travis-cookbooks/ci_environment/java/attributes/default.rb +4 -2
  55. data/chef/travis-cookbooks/ci_environment/java/recipes/default.rb +1 -1
  56. data/chef/travis-cookbooks/ci_environment/java/recipes/oraclejdk7.rb +6 -1
  57. data/chef/travis-cookbooks/ci_environment/kerl/attributes/source.rb +1 -1
  58. data/chef/travis-cookbooks/ci_environment/kerl/files/default/erlang.cookie +1 -0
  59. data/chef/travis-cookbooks/ci_environment/kerl/recipes/source.rb +8 -0
  60. data/chef/travis-cookbooks/ci_environment/kestrel/recipes/tarball.rb +1 -1
  61. data/chef/travis-cookbooks/ci_environment/leiningen/attributes/default.rb +1 -1
  62. data/chef/travis-cookbooks/ci_environment/leiningen/recipes/default.rb +1 -1
  63. data/chef/travis-cookbooks/ci_environment/leiningen/recipes/lein1x.rb +1 -1
  64. data/chef/travis-cookbooks/ci_environment/leiningen/recipes/lein2x.rb +1 -1
  65. data/chef/travis-cookbooks/ci_environment/libffi/recipes/default.rb +1 -1
  66. data/chef/travis-cookbooks/ci_environment/libgdbm/recipes/default.rb +1 -1
  67. data/chef/travis-cookbooks/ci_environment/libncurses/recipes/default.rb +1 -1
  68. data/chef/travis-cookbooks/ci_environment/libossp-uuid/recipes/default.rb +1 -1
  69. data/chef/travis-cookbooks/ci_environment/libreadline/recipes/default.rb +1 -1
  70. data/chef/travis-cookbooks/ci_environment/libssl/recipes/098.rb +1 -1
  71. data/chef/travis-cookbooks/ci_environment/libssl/recipes/default.rb +1 -1
  72. data/chef/travis-cookbooks/ci_environment/libxml/recipes/default.rb +1 -1
  73. data/chef/travis-cookbooks/ci_environment/lighttpd/recipes/default.rb +1 -1
  74. data/chef/travis-cookbooks/ci_environment/maven3/recipes/default.rb +5 -2
  75. data/chef/travis-cookbooks/ci_environment/maven3/recipes/package.rb +1 -1
  76. data/chef/travis-cookbooks/ci_environment/maven3/recipes/ppa.rb +1 -1
  77. data/chef/travis-cookbooks/ci_environment/maven3/recipes/tarball.rb +1 -1
  78. data/chef/travis-cookbooks/ci_environment/memcached/attributes/default.rb +1 -1
  79. data/chef/travis-cookbooks/ci_environment/memcached/attributes/ppa.rb +1 -1
  80. data/chef/travis-cookbooks/ci_environment/memcached/recipes/default.rb +1 -1
  81. data/chef/travis-cookbooks/ci_environment/memcached/recipes/ppa.rb +1 -1
  82. data/chef/travis-cookbooks/ci_environment/mercurial/recipes/default.rb +1 -1
  83. data/chef/travis-cookbooks/ci_environment/mercurial/recipes/ppa.rb +36 -0
  84. data/chef/travis-cookbooks/ci_environment/mongodb/attributes/mongodb.rb +1 -1
  85. data/chef/travis-cookbooks/ci_environment/mongodb/files/default/mongodb.sysvinit.sh +1 -1
  86. data/chef/travis-cookbooks/ci_environment/mongodb/recipes/apt.rb +5 -5
  87. data/chef/travis-cookbooks/ci_environment/mongodb/recipes/server.rb +5 -2
  88. data/chef/travis-cookbooks/ci_environment/mysql/attributes/default.rb +1 -3
  89. data/chef/travis-cookbooks/ci_environment/mysql/recipes/server_on_ramfs.rb +6 -1
  90. data/chef/travis-cookbooks/ci_environment/mysql/templates/default/my.cnf.erb +0 -2
  91. data/chef/travis-cookbooks/ci_environment/mysql/templates/default/ramfs/my.cnf.erb +0 -2
  92. data/chef/travis-cookbooks/ci_environment/neo4j-server/attributes/tarball.rb +13 -2
  93. data/chef/travis-cookbooks/ci_environment/neo4j-server/recipes/tarball.rb +26 -2
  94. data/chef/travis-cookbooks/ci_environment/networking_basic/recipes/default.rb +4 -1
  95. data/chef/travis-cookbooks/ci_environment/nodejs/attributes/multi.rb +3 -3
  96. data/chef/travis-cookbooks/ci_environment/nodejs/recipes/multi.rb +1 -1
  97. data/chef/travis-cookbooks/ci_environment/openssh/recipes/default.rb +1 -1
  98. data/chef/travis-cookbooks/ci_environment/perlbrew/attributes/multi.rb +1 -1
  99. data/chef/travis-cookbooks/ci_environment/phantomjs/attributes/default.rb +2 -2
  100. data/chef/travis-cookbooks/ci_environment/phantomjs/metadata.rb +3 -0
  101. data/chef/travis-cookbooks/ci_environment/phantomjs/recipes/default.rb +3 -1
  102. data/chef/travis-cookbooks/ci_environment/phantomjs/recipes/tarball.rb +3 -2
  103. data/chef/travis-cookbooks/ci_environment/php/attributes/default.rb +40 -2
  104. data/chef/travis-cookbooks/ci_environment/php/providers/pecl.rb +73 -0
  105. data/chef/travis-cookbooks/ci_environment/php/recipes/extensions.rb +25 -0
  106. data/chef/travis-cookbooks/ci_environment/php/recipes/multi.rb +5 -4
  107. data/chef/travis-cookbooks/ci_environment/php/resources/pecl.rb +10 -0
  108. data/chef/travis-cookbooks/ci_environment/phpbuild/attributes/default.rb +2 -2
  109. data/chef/travis-cookbooks/ci_environment/phpbuild/files/default/after-install.d/phpunit.sh +58 -0
  110. data/chef/travis-cookbooks/ci_environment/phpbuild/files/default/definitions/5.2.17 +3 -1
  111. data/chef/travis-cookbooks/ci_environment/phpbuild/files/default/definitions/5.3.3 +2 -1
  112. data/chef/travis-cookbooks/ci_environment/phpbuild/providers/build.rb +1 -1
  113. data/chef/travis-cookbooks/ci_environment/phpbuild/recipes/default.rb +8 -10
  114. data/chef/travis-cookbooks/ci_environment/phpbuild/templates/default/default_configure_options.erb +4 -0
  115. data/chef/travis-cookbooks/ci_environment/phpenv/attributes/default.rb +6 -0
  116. data/chef/travis-cookbooks/ci_environment/phpenv/recipes/default.rb +11 -7
  117. data/chef/travis-cookbooks/ci_environment/postgresql/recipes/server_on_ramfs.rb +2 -2
  118. data/chef/travis-cookbooks/ci_environment/python/attributes/default.rb +2 -2
  119. data/chef/travis-cookbooks/ci_environment/python/recipes/multi.rb +10 -3
  120. data/chef/travis-cookbooks/ci_environment/rabbitmq/attributes/default.rb +3 -0
  121. data/chef/travis-cookbooks/ci_environment/rabbitmq/recipes/default.rb +6 -2
  122. data/chef/travis-cookbooks/ci_environment/ragel/recipes/custom.rb +1 -1
  123. data/chef/travis-cookbooks/ci_environment/ragel/recipes/default.rb +1 -1
  124. data/chef/travis-cookbooks/ci_environment/redis/attributes/default.rb +3 -0
  125. data/chef/travis-cookbooks/ci_environment/redis/recipes/default.rb +6 -3
  126. data/chef/travis-cookbooks/ci_environment/redis/recipes/ppa.rb +1 -1
  127. data/chef/travis-cookbooks/ci_environment/riak/attributes/default.rb +1 -0
  128. data/chef/travis-cookbooks/ci_environment/riak/attributes/package.rb +3 -3
  129. data/chef/travis-cookbooks/{messaging_broker/openssl/recipes/default.rb → ci_environment/riak/attributes/service.rb} +4 -3
  130. data/chef/travis-cookbooks/ci_environment/riak/recipes/config.rb +2 -2
  131. data/chef/travis-cookbooks/ci_environment/riak/recipes/default.rb +12 -5
  132. data/chef/travis-cookbooks/ci_environment/rvm/attributes/default.rb +1 -1
  133. data/chef/travis-cookbooks/ci_environment/rvm/attributes/multi.rb +2 -0
  134. data/chef/travis-cookbooks/ci_environment/rvm/files/default/gemsets/global.gems +1 -1
  135. data/chef/travis-cookbooks/ci_environment/rvm/files/default/gemsets/jruby/global.gems +1 -1
  136. data/chef/travis-cookbooks/ci_environment/rvm/files/default/gemsets/ruby/2.0.0/global.gems +2 -0
  137. data/chef/travis-cookbooks/ci_environment/rvm/files/default/gemsets/ruby/head/global.gems +2 -0
  138. data/chef/travis-cookbooks/ci_environment/rvm/recipes/default.rb +23 -1
  139. data/chef/travis-cookbooks/ci_environment/rvm/recipes/multi.rb +2 -2
  140. data/chef/travis-cookbooks/ci_environment/rvm/templates/default/bundler_config.yml.erb +2 -0
  141. data/chef/travis-cookbooks/ci_environment/sbt/CHANGELOG.md +20 -0
  142. data/chef/travis-cookbooks/ci_environment/sbt/LICENSE +201 -0
  143. data/chef/travis-cookbooks/ci_environment/sbt/README.md +78 -2
  144. data/chef/travis-cookbooks/ci_environment/sbt/attributes/default.rb +36 -10
  145. data/chef/travis-cookbooks/ci_environment/sbt/metadata.json +27 -17
  146. data/chef/travis-cookbooks/ci_environment/sbt/metadata.rb +13 -6
  147. data/chef/travis-cookbooks/ci_environment/sbt/recipes/default.rb +101 -51
  148. data/chef/travis-cookbooks/ci_environment/sbt/templates/default/jvmopts.erb +7 -0
  149. data/chef/travis-cookbooks/ci_environment/sbt/templates/default/sbtopts.erb +54 -0
  150. data/chef/travis-cookbooks/ci_environment/sphinx/attributes/default.rb +2 -2
  151. data/chef/travis-cookbooks/ci_environment/sphinx/metadata.rb +4 -4
  152. data/chef/travis-cookbooks/ci_environment/sphinx/recipes/all.rb +1 -1
  153. data/chef/travis-cookbooks/ci_environment/sphinx/recipes/default.rb +1 -1
  154. data/chef/travis-cookbooks/{messaging_broker/build-essential/recipes/default.rb → ci_environment/sqlite/recipes/ppa.rb} +13 -24
  155. data/chef/travis-cookbooks/ci_environment/subversion/recipes/default.rb +1 -1
  156. data/chef/travis-cookbooks/ci_environment/sweeper/recipes/default.rb +1 -1
  157. data/chef/travis-cookbooks/ci_environment/travis_build_environment/attributes/default.rb +2 -0
  158. data/chef/travis-cookbooks/ci_environment/travis_build_environment/recipes/ci_user.rb +2 -2
  159. data/chef/travis-cookbooks/ci_environment/travis_build_environment/recipes/default.rb +1 -3
  160. data/chef/travis-cookbooks/ci_environment/travis_build_environment/recipes/root.rb +5 -1
  161. data/chef/travis-cookbooks/ci_environment/travis_build_environment/templates/default/ci_user/{dot_bashrc.sh → dot_bashrc.sh.erb} +0 -4
  162. data/chef/travis-cookbooks/ci_environment/unarchivers/recipes/default.rb +1 -1
  163. data/chef/travis-cookbooks/ci_environment/xserver/metadata.rb +3 -0
  164. data/chef/travis-cookbooks/ci_environment/xserver/recipes/default.rb +1 -1
  165. data/chef/travis-cookbooks/ci_environment/zeromq/recipes/default.rb +6 -23
  166. data/chef/travis-cookbooks/ci_environment/zeromq/recipes/{20x.rb → ppa.rb} +14 -14
  167. data/chef/travis-cookbooks/ci_environment/zookeeper/recipes/cdh4.rb +1 -1
  168. data/chef/travis-cookbooks/worker_host/java/metadata.rb +1 -1
  169. data/chef/travis-cookbooks/worker_host/java/recipes/openjdk.rb +6 -0
  170. data/chef/travis-cookbooks/worker_host/jruby/attributes/default.rb +1 -1
  171. data/chef/travis-cookbooks/worker_host/jruby/metadata.rb +1 -1
  172. data/chef/travis-cookbooks/worker_host/jruby/recipes/default.rb +1 -0
  173. data/chef/travis-cookbooks/worker_host/monit/recipes/default.rb +21 -17
  174. data/chef/travis-cookbooks/worker_host/networking_basic/metadata.rb +1 -1
  175. data/chef/travis-cookbooks/worker_host/networking_basic/recipes/default.rb +0 -6
  176. data/chef/travis-cookbooks/worker_host/ntp/.gitignore +1 -0
  177. data/chef/travis-cookbooks/worker_host/ntp/.travis.yml +6 -0
  178. data/chef/travis-cookbooks/worker_host/ntp/CHANGELOG.md +35 -0
  179. data/chef/travis-cookbooks/worker_host/ntp/CONTRIBUTING +29 -0
  180. data/chef/travis-cookbooks/worker_host/ntp/LICENSE +201 -0
  181. data/chef/travis-cookbooks/worker_host/ntp/README.md +163 -0
  182. data/chef/travis-cookbooks/worker_host/ntp/Rakefile +19 -0
  183. data/chef/travis-cookbooks/worker_host/ntp/TESTING.md +213 -0
  184. data/chef/travis-cookbooks/worker_host/ntp/attributes/default.rb +54 -0
  185. data/chef/travis-cookbooks/{messaging_broker/rabbitmq/resources/vhost.rb → worker_host/ntp/attributes/ntpdate.rb} +6 -7
  186. data/chef/travis-cookbooks/worker_host/ntp/chefignore +19 -0
  187. data/chef/travis-cookbooks/worker_host/ntp/files/default/ntp.leapseconds +222 -0
  188. data/chef/travis-cookbooks/worker_host/ntp/metadata.json +117 -0
  189. data/chef/travis-cookbooks/worker_host/ntp/metadata.rb +45 -0
  190. data/chef/travis-cookbooks/worker_host/ntp/recipes/default.rb +50 -0
  191. data/chef/travis-cookbooks/worker_host/ntp/recipes/disable.rb +22 -0
  192. data/chef/travis-cookbooks/worker_host/ntp/recipes/ntpdate.rb +36 -0
  193. data/chef/travis-cookbooks/{messaging_broker/openssl/libraries/secure_password.rb → worker_host/ntp/recipes/undo.rb} +17 -18
  194. data/chef/travis-cookbooks/worker_host/ntp/templates/default/ntp.conf.erb +55 -0
  195. data/chef/travis-cookbooks/worker_host/ntp/templates/default/ntpdate.erb +14 -0
  196. data/chef/travis-cookbooks/worker_host/rvm/recipes/multi.rb +1 -1
  197. data/chef/travis-cookbooks/worker_host/travis_worker/attributes/default.rb +10 -3
  198. data/chef/travis-cookbooks/worker_host/travis_worker/files/default/signal_wrapper.rb +22 -0
  199. data/chef/travis-cookbooks/worker_host/travis_worker/metadata.rb +2 -2
  200. data/chef/travis-cookbooks/worker_host/travis_worker/recipes/bluebox.rb +97 -0
  201. data/chef/travis-cookbooks/worker_host/travis_worker/recipes/default.rb +25 -15
  202. data/chef/travis-cookbooks/worker_host/travis_worker/templates/default/sv-travis-worker-run.erb +1 -1
  203. data/chef/travis-cookbooks/worker_host/travis_worker/templates/default/worker-bluebox.yml.erb +21 -0
  204. data/chef/travis-cookbooks/worker_host/travis_worker/templates/default/worker.yml.erb +0 -4
  205. data/chef/travis-cookbooks/worker_host/travis_worker_collectd/metadata.rb +1 -0
  206. data/chef/travis-cookbooks/worker_host/travis_worker_collectd/recipes/bluebox.rb +15 -0
  207. data/chef/travis-cookbooks/worker_host/travis_worker_collectd/recipes/default.rb +1 -0
  208. data/chef/travis-cookbooks/worker_host/users/recipes/default.rb +5 -0
  209. data/cookbooks/.gitkeep +3 -0
  210. data/lib/lobot.rb +8 -4
  211. data/lib/lobot/amazon.rb +33 -19
  212. data/lib/lobot/cli.rb +70 -46
  213. data/lib/lobot/config.rb +151 -19
  214. data/lib/lobot/configuration_wizard.rb +117 -0
  215. data/lib/lobot/keychain.rb +36 -0
  216. data/lib/lobot/password.rb +13 -0
  217. data/lib/lobot/sobo.rb +57 -13
  218. data/lib/lobot/templates/default_rails_build_script.sh +13 -0
  219. data/lib/lobot/version.rb +2 -2
  220. data/lobot.gemspec +4 -5
  221. data/script/bootstrap_server.sh +1 -1
  222. data/script/ci_build.sh +13 -0
  223. data/spec/assets/test_cert.crt +18 -0
  224. data/spec/fixtures/ssh_keys/vagrant_test_key +27 -0
  225. data/spec/fixtures/ssh_keys/vagrant_test_key.pub +1 -0
  226. data/spec/lib/lobot/amazon_spec.rb +80 -39
  227. data/spec/lib/lobot/cli_spec.rb +223 -154
  228. data/spec/lib/lobot/config_spec.rb +207 -5
  229. data/spec/lib/lobot/configuration_wizard_spec.rb +347 -0
  230. data/spec/lib/lobot/keychain_spec.rb +33 -0
  231. data/spec/lib/lobot/password_spec.rb +15 -0
  232. data/spec/spec_helper.rb +19 -1
  233. data/templates/Gemfile-remote +4 -0
  234. metadata +83 -100
  235. data/chef/travis-cookbooks/ci_environment/rvm/files/default/gemsets/ruby/1.8.6/global.gems +0 -2
  236. data/chef/travis-cookbooks/ci_environment/travis_build_environment/files/default/root/dot_bashrc.sh +0 -86
  237. data/chef/travis-cookbooks/ci_environment/zeromq/attributes/default.rb +0 -7
  238. data/chef/travis-cookbooks/messaging_broker/build-essential/README.md +0 -24
  239. data/chef/travis-cookbooks/messaging_broker/build-essential/metadata.rb +0 -10
  240. data/chef/travis-cookbooks/messaging_broker/emacs/metadata.rb +0 -11
  241. data/chef/travis-cookbooks/messaging_broker/emacs/recipes/default.rb +0 -21
  242. data/chef/travis-cookbooks/messaging_broker/erlang/attributes/default.rb +0 -1
  243. data/chef/travis-cookbooks/messaging_broker/erlang/metadata.rb +0 -11
  244. data/chef/travis-cookbooks/messaging_broker/erlang/recipes/default.rb +0 -27
  245. data/chef/travis-cookbooks/messaging_broker/git/README.rdoc +0 -37
  246. data/chef/travis-cookbooks/messaging_broker/git/metadata.rb +0 -16
  247. data/chef/travis-cookbooks/messaging_broker/git/recipes/default.rb +0 -24
  248. data/chef/travis-cookbooks/messaging_broker/git/recipes/server.rb +0 -34
  249. data/chef/travis-cookbooks/messaging_broker/git/templates/default/sv-git-daemon-log-run.erb +0 -2
  250. data/chef/travis-cookbooks/messaging_broker/git/templates/default/sv-git-daemon-run.erb +0 -3
  251. data/chef/travis-cookbooks/messaging_broker/haproxy/README.md +0 -79
  252. data/chef/travis-cookbooks/messaging_broker/haproxy/attributes/default.rb +0 -22
  253. data/chef/travis-cookbooks/messaging_broker/haproxy/metadata.rb +0 -13
  254. data/chef/travis-cookbooks/messaging_broker/haproxy/recipes/app_lb.rb +0 -50
  255. data/chef/travis-cookbooks/messaging_broker/haproxy/recipes/default.rb +0 -42
  256. data/chef/travis-cookbooks/messaging_broker/haproxy/templates/default/haproxy-app_lb.cfg.erb +0 -34
  257. data/chef/travis-cookbooks/messaging_broker/haproxy/templates/default/haproxy-default.erb +0 -4
  258. data/chef/travis-cookbooks/messaging_broker/haproxy/templates/default/haproxy.cfg.erb +0 -27
  259. data/chef/travis-cookbooks/messaging_broker/iptables/definitions/iptables_rule.rb +0 -35
  260. data/chef/travis-cookbooks/messaging_broker/iptables/files/default/rebuild-iptables +0 -284
  261. data/chef/travis-cookbooks/messaging_broker/iptables/metadata.rb +0 -10
  262. data/chef/travis-cookbooks/messaging_broker/iptables/recipes/default.rb +0 -50
  263. data/chef/travis-cookbooks/messaging_broker/iptables/templates/default/all_established.erb +0 -2
  264. data/chef/travis-cookbooks/messaging_broker/iptables/templates/default/all_icmp.erb +0 -2
  265. data/chef/travis-cookbooks/messaging_broker/iptables/templates/default/iptables_load.erb +0 -3
  266. data/chef/travis-cookbooks/messaging_broker/openssl/README.md +0 -37
  267. data/chef/travis-cookbooks/messaging_broker/openssl/metadata.rb +0 -8
  268. data/chef/travis-cookbooks/messaging_broker/rabbitmq/README.md +0 -86
  269. data/chef/travis-cookbooks/messaging_broker/rabbitmq/attributes/default.rb +0 -10
  270. data/chef/travis-cookbooks/messaging_broker/rabbitmq/metadata.rb +0 -63
  271. data/chef/travis-cookbooks/messaging_broker/rabbitmq/providers/user.rb +0 -66
  272. data/chef/travis-cookbooks/messaging_broker/rabbitmq/providers/vhost.rb +0 -34
  273. data/chef/travis-cookbooks/messaging_broker/rabbitmq/recipes/cluster.rb +0 -35
  274. data/chef/travis-cookbooks/messaging_broker/rabbitmq/recipes/default.rb +0 -51
  275. data/chef/travis-cookbooks/messaging_broker/rabbitmq/resources/user.rb +0 -25
  276. data/chef/travis-cookbooks/messaging_broker/rabbitmq/templates/default/doterlang.cookie.erb +0 -1
  277. data/chef/travis-cookbooks/messaging_broker/rabbitmq/templates/default/rabbitmq-env.conf.erb +0 -10
  278. data/chef/travis-cookbooks/messaging_broker/rabbitmq/templates/default/rabbitmq_cluster.config.erb +0 -5
  279. data/ci_build.sh +0 -20
  280. data/docs/ci_yml.md +0 -39
  281. data/features/ci.feature +0 -29
  282. data/features/config/secrets.yml.example +0 -4
  283. data/features/step_definitions/ci_steps.rb +0 -137
  284. data/features/support/env.rb +0 -12
  285. data/lib/generators/lobot/USAGE +0 -15
  286. data/lib/generators/lobot/config_generator.rb +0 -141
  287. data/lib/generators/lobot/install_generator.rb +0 -25
  288. data/lib/generators/lobot/templates/Capfile +0 -6
  289. data/lib/generators/lobot/templates/ci.yml +0 -22
  290. data/lib/generators/lobot/templates/ci_build.sh +0 -22
  291. data/lib/generators/lobot/templates/deploy-ci.rb +0 -7
  292. data/lib/generators/lobot/templates/soloistrc +0 -23
  293. data/lib/lobot/jenkins.rb +0 -17
  294. data/lib/lobot/railtie.rb +0 -20
  295. data/lib/lobot/recipes/ci.rb +0 -78
  296. data/lib/lobot/tasks/ci.rake +0 -93
  297. data/spec/lib/lobot/jenkins_spec.rb +0 -14
@@ -1,6 +1,6 @@
1
1
  maintainer "Travis CI"
2
2
  maintainer_email "mathias@travis-ci.org"
3
3
  license "Apache 2.0"
4
- description "Installs/Configures Travis Worker"
5
- version "0.2.0"
4
+ description "Installs/Configures the Travis Worker"
5
+ version "0.5.1"
6
6
  depends "runit"
@@ -0,0 +1,97 @@
1
+ require_recipe 'runit'
2
+ require_recipe 'jruby'
3
+
4
+ users = if Chef::Config[:solo]
5
+ node[:users]
6
+ else
7
+ search(:users)
8
+ end
9
+
10
+ execute "monit-reload" do
11
+ action :nothing
12
+ command "monit reload"
13
+ end
14
+
15
+ package "ruby1.9.3" do
16
+ action :install
17
+ end
18
+
19
+ cookbook_file "/usr/local/bin/signal_wrapper" do
20
+ source "signal_wrapper.rb"
21
+ mode "0755"
22
+ owner "root"
23
+ backup false
24
+ end
25
+
26
+ 1.upto(node[:travis][:worker][:workers]) do |worker|
27
+ app = "worker-#{worker}"
28
+ worker_name = "#{app}.#{node[:fqdn]}"
29
+ home = "#{node[:travis][:worker][:home]}/#{app}"
30
+ service_name = "travis-worker-#{worker}"
31
+
32
+ service service_name do
33
+ action :nothing
34
+ end
35
+
36
+ directory home do
37
+ action :create
38
+ recursive true
39
+ owner "travis"
40
+ group "travis"
41
+ mode "0755"
42
+ end
43
+
44
+ git home do
45
+ repository node[:travis][:worker][:repository]
46
+ reference node[:travis][:worker][:ref]
47
+ action :sync
48
+ user "travis"
49
+ group "travis"
50
+ notifies :restart, resources(:service => service_name)
51
+ end
52
+
53
+ directory "#{home}/log" do
54
+ action :create
55
+ owner "travis"
56
+ group "travis"
57
+ mode "0755"
58
+ end
59
+
60
+ bash "bundle gems" do
61
+ code "#{File.dirname(node[:jruby][:bin])}/bundle install --deployment --binstubs"
62
+ user "travis"
63
+ group "travis"
64
+ cwd home
65
+ end
66
+
67
+ template "#{home}/config/worker.yml" do
68
+ source "worker-bluebox.yml.erb"
69
+ owner "travis"
70
+ group "travis"
71
+ mode "0600"
72
+ variables :amqp => node[:travis][:worker][:amqp],
73
+ :worker => node[:travis][:worker],
74
+ :hostname => worker_name,
75
+ :bluebox => node[:bluebox],
76
+ :librato => node[:collectd_librato]
77
+
78
+ notifies :restart, resources(:service => service_name)
79
+ end
80
+
81
+ runit_service "travis-worker-#{worker}" do
82
+ options :jruby => node[:jruby][:bin],
83
+ :worker_home => home,
84
+ :user => "travis",
85
+ :group => "travis"
86
+ template_name "travis-worker"
87
+ end
88
+
89
+ template "/etc/monit/conf.d/travis-worker-#{worker}.monitrc" do
90
+ source "travis-worker.monitrc.erb"
91
+ owner "root"
92
+ group "root"
93
+ mode "0644"
94
+ variables :home => home
95
+ notifies :run, resources(:execute => 'monit-reload')
96
+ end
97
+ end
@@ -60,18 +60,8 @@ link "#{node[:travis][:worker][:home]}/.VirtualBox/VirtualBox.xml" do
60
60
  }
61
61
  end
62
62
 
63
- if not node[:travis][:worker][:post_checkout].empty?
64
- bash "run post checkout hook (#{node[:travis][:worker][:post_checkout][:command]})" do
65
- code node[:travis][:worker][:post_checkout][:command]
66
- user "travis"
67
- not_if "cd #{node[:travis][:worker][:home]} && #{node[:travis][:worker][:post_checkout][:condition]}"
68
- cwd node[:travis][:worker][:home]
69
- notifies :restart, resources(:service => 'travis-worker')
70
- end
71
- end
72
-
73
63
  bash "bundle gems" do
74
- code "#{File.dirname(node[:jruby][:bin])}/bundle install --path vendor/bundle --binstubs"
64
+ code "#{File.dirname(node[:jruby][:bin])}/bundle install --deployment --binstubs"
75
65
  user "travis"
76
66
  group "travis"
77
67
  cwd node[:travis][:worker][:home]
@@ -89,17 +79,37 @@ template "#{node[:travis][:worker][:home]}/config/worker.yml" do
89
79
  end
90
80
 
91
81
  bash "download VirtualBox images" do
92
- code "#{node[:jruby][:bin]} ./bin/thor travis:vms:download 2>/dev/null"
82
+ if node[:travis][:worker][:box]
83
+ code "#{node[:jruby][:bin]} ./bin/thor travis:vms:download #{node[:travis][:worker][:box]} 2>/dev/null"
84
+ not_if {
85
+ File.exists?("#{node[:travis][:worker][:home]}/boxes/travis-#{node[:travis][:worker][:env]}-pro.box")
86
+ }
87
+ else
88
+ code "#{node[:jruby][:bin]} ./bin/thor travis:vms:download 2>/dev/null"
89
+ not_if {
90
+ File.exists?("#{node[:travis][:worker][:home]}/boxes/travis-#{node[:travis][:worker][:env]}.box")
91
+ }
92
+ end
93
+
93
94
  user "travis"
94
95
  group "travis"
95
96
  cwd node[:travis][:worker][:home]
96
- not_if {
97
- File.exists?("#{node[:travis][:worker][:home]}/boxes/travis-#{node[:travis][:worker][:env]}.box")
98
- }
99
97
  notifies :restart, resources(:service => 'travis-worker')
100
98
  environment({"HOME" => home})
101
99
  end
102
100
 
101
+ bash "copy box image" do
102
+ code "cp #{node[:travis][:worker][:home]}/boxes/travis-#{node[:travis][:worker][:env]}-pro.box #{node[:travis][:worker][:home]}/boxes/travis-#{node[:travis][:worker][:env]}.box"
103
+ user "travis"
104
+ group "travis"
105
+ cwd node[:travis][:worker][:home]
106
+ not_if {
107
+ File.exists?("#{node[:travis][:worker][:home]}/boxes/travis-#{node[:travis][:worker][:env]}.box")
108
+ }
109
+ only_if {
110
+ File.exists?("#{node[:travis][:worker][:home]}/boxes/travis-#{node[:travis][:worker][:env]}-pro.box")
111
+ }
112
+ end
103
113
 
104
114
  bash "create VirtualBox images" do
105
115
  code "#{node[:jruby][:bin]} ./bin/thor travis:vms:create &>/tmp/vbox-create.log"
@@ -1,4 +1,4 @@
1
1
  #!/bin/bash
2
2
  exec 2>&1
3
3
  cd <%= @options[:worker_home] %>
4
- exec chpst -u <%= @options[:user] %>:<%= @options[:group] %> <%= @options[:jruby] %> ./bin/thor travis:worker:boot
4
+ exec chpst -u <%= @options[:user] %>:<%= @options[:group] %> /usr/local/bin/signal_wrapper <%= @options[:jruby] %> ./bin/thor travis:worker:boot
@@ -0,0 +1,21 @@
1
+ env: <%= @worker[:env] %>
2
+ linux:
3
+ host: <%= @hostname %>
4
+ log_level: <%= @worker[:log_level] %>
5
+ amqp:
6
+ <% @amqp.each do |key, value| -%>
7
+ <%= key %>: <%= value %>
8
+ <% end -%>
9
+ vms:
10
+ provider: <%= @worker[:provider] %>
11
+ count: <%= @worker[:vms] %>
12
+ blue_box:
13
+ customer_id: <%= @bluebox[:customer_id] %>
14
+ api_key: <%= @bluebox[:api_key] %>
15
+ flavor_id: <%= @bluebox[:flavor_id] %>
16
+ location_id: <%= @bluebox[:location_id] %>
17
+ librato:
18
+ email: <%= @librato[:email] %>
19
+ token: <%= @librato[:token] %>
20
+ language_mappings:
21
+ haskell: jvm
@@ -8,7 +8,3 @@ env: <%= @env %>
8
8
  vms:
9
9
  count: <%= @vms %>
10
10
  vbox_home: '/usr/lib/virtualbox'
11
- timeouts:
12
- install: 600
13
- before_script: 480
14
- script: 1500
@@ -1 +1,2 @@
1
+ version "0.1.0"
1
2
  depends "collectd"
@@ -0,0 +1,15 @@
1
+ require_recipe 'collectd'
2
+
3
+ collectd_plugin "load"
4
+
5
+ collectd_plugin "memory"
6
+
7
+ collectd_plugin "interface" do
8
+ options :interface => "lo", :ignore_selected => true
9
+ end
10
+
11
+ collectd_plugin "df" do
12
+ options :mount_point => "/",
13
+ :report_reserved => false,
14
+ :report_inodes => false
15
+ end
@@ -9,3 +9,4 @@ collectd_plugin "cpu"
9
9
  collectd_plugin "interface" do
10
10
  options :interface => "lo", :ignore_selected => true
11
11
  end
12
+
@@ -42,6 +42,11 @@ users.each do |user|
42
42
  notifies :reload, resources(:ohai => "reload_passwd"), :immediately
43
43
  end
44
44
 
45
+ file "#{user[:home]}/.zshrc" do
46
+ action :create_if_missing
47
+ content "# Automatically generated by Chef."
48
+ end
49
+
45
50
  (user[:groups] || []).each do |group_name|
46
51
  group_id = groups.find {|group| group[:id] == group_name}[:gid]
47
52
 
@@ -0,0 +1,3 @@
1
+ This directory should remain empty, it is used by consumers of
2
+ Lobot, so when we deploy a lobot CI instance for testing, this
3
+ matches an end user's experience.
@@ -1,4 +1,8 @@
1
- require File.expand_path("../lobot/version", __FILE__)
2
-
3
- module Lobot
4
- end
1
+ require "lobot/version"
2
+ require "lobot/config"
3
+ require "lobot/sobo"
4
+ require "lobot/amazon"
5
+ require "lobot/keychain"
6
+ require "lobot/configuration_wizard"
7
+ require "lobot/cli"
8
+ require "lobot/password"
@@ -11,15 +11,15 @@ module Lobot
11
11
  @secret = secret
12
12
  end
13
13
 
14
- def security_groups
14
+ def fog_security_groups
15
15
  fog.security_groups
16
16
  end
17
17
 
18
- def key_pairs
18
+ def fog_key_pairs
19
19
  fog.key_pairs
20
20
  end
21
21
 
22
- def servers
22
+ def fog_servers
23
23
  fog.servers
24
24
  end
25
25
 
@@ -28,13 +28,13 @@ module Lobot
28
28
  end
29
29
 
30
30
  def create_security_group(group_name)
31
- unless security_groups.get(group_name)
32
- security_groups.create(:name => group_name, :description => 'Lobot-generated group')
31
+ unless fog_security_groups.get(group_name)
32
+ fog_security_groups.create(:name => group_name, :description => 'Lobot-generated group')
33
33
  end
34
34
  end
35
35
 
36
36
  def open_port(group_name, *ports)
37
- group = security_groups.get(group_name)
37
+ group = fog_security_groups.get(group_name)
38
38
  ports.each do |port|
39
39
  unless group.ip_permissions.any? { |p| (p["fromPort"]..p["toPort"]).include?(port) }
40
40
  group.authorize_port_range(port..port)
@@ -43,20 +43,26 @@ module Lobot
43
43
  end
44
44
 
45
45
  def delete_key_pair(key_pair_name)
46
- key_pairs.new(:name => key_pair_name).destroy
46
+ fog_key_pairs.new(:name => key_pair_name).destroy
47
47
  end
48
48
 
49
- def add_key_pair(key_pair_name, key_path)
50
- unless key_pairs.get(key_pair_name)
51
- key_pairs.create(:name => key_pair_name, :public_key => File.read("#{key_path}"))
52
- end
49
+ def add_key_pair(key_pair_name, public_key)
50
+ fog_key_pairs.create(:name => key_pair_name, :public_key => public_key) unless fog_key_pairs.get(key_pair_name)
51
+ end
52
+
53
+ def with_key_pair(pubkey)
54
+ unique_key_pair_name = "LOBOT-#{Time.now.to_i}"
55
+ add_key_pair(unique_key_pair_name, pubkey)
56
+ yield unique_key_pair_name if block_given?
57
+ ensure
58
+ delete_key_pair(unique_key_pair_name)
53
59
  end
54
60
 
55
61
  def launch_server(key_pair_name, security_group_name, instance_type = "m1.medium")
56
- servers.create(
62
+ fog_servers.create(
57
63
  :image_id => "ami-a29943cb",
58
64
  :flavor_id => instance_type,
59
- :availability_zone => "us-east-1a",
65
+ :availability_zone => "us-east-1b",
60
66
  :tags => {"Name" => "Lobot", "lobot" => Lobot::VERSION},
61
67
  :key_name => key_pair_name,
62
68
  :groups => [security_group_name]
@@ -67,11 +73,19 @@ module Lobot
67
73
  end
68
74
  end
69
75
 
70
- def destroy_ec2
71
- servers = fog.servers.select { |s| s.tags.keys.include?("lobot") && s.state == "running" }
72
- ips = servers.map(&:public_ip_address)
73
- servers.map(&:destroy)
74
- ips.each { |ip| release_elastic_ip(ip) }
76
+ def destroy_ec2(confirm_proc, *args)
77
+ servers.each do |server|
78
+ next unless (args == [:all]) || args.include?(server.id)
79
+ next unless confirm_proc.call(server)
80
+ ip = server.public_ip_address
81
+ server.destroy
82
+ release_elastic_ip(ip)
83
+ yield(server) if block_given?
84
+ end
85
+ end
86
+
87
+ def servers
88
+ fog_servers.select { |s| s.tags.keys.include?("lobot") && s.state == "running" }
75
89
  end
76
90
 
77
91
  def release_elastic_ip(ip)
@@ -88,4 +102,4 @@ module Lobot
88
102
  )
89
103
  end
90
104
  end
91
- end
105
+ end
@@ -1,50 +1,55 @@
1
1
  require "thor"
2
- require "lobot/config"
3
- require "lobot/sobo"
4
- require "lobot/amazon"
5
- require "lobot/jenkins"
2
+ require "thor/group"
6
3
  require "pp"
7
4
  require "tempfile"
8
5
  require "json"
6
+ require "lobot/configuration_wizard"
7
+ require "godot"
9
8
 
10
9
  module Lobot
11
- class CLI < Thor
10
+ class CLI < ::Thor
11
+ register(ConfigurationWizard, "setup", "setup", ConfigurationWizard::DESCRIPTION_TEXT)
12
+
12
13
  desc "ssh", "SSH into Lobot"
13
14
  def ssh
14
- exec("ssh -i #{lobot_config.server_ssh_key} ubuntu@#{lobot_config.master} -p #{lobot_config.ssh_port}")
15
+ exec("ssh -i #{lobot_config.server_ssh_key_path} ubuntu@#{lobot_config.master} -p #{lobot_config.ssh_port}")
15
16
  end
16
17
 
17
18
  desc "open", "Open a browser to Lobot"
18
19
  def open
19
- exec("open https://#{lobot_config.node_attributes.nginx.basic_auth_user}:#{lobot_config.node_attributes.nginx.basic_auth_password}@#{lobot_config.master}/")
20
+ exec("open #{lobot_config.jenkins_url}/")
20
21
  end
21
22
 
22
23
  desc "create", "Create a new Lobot server using EC2"
23
24
  def create
24
- ssh_key_path = File.expand_path("#{lobot_config.server_ssh_key}.pub")
25
-
26
- amazon.add_key_pair("lobot", ssh_key_path)
27
- amazon.create_security_group("lobot")
28
- amazon.open_port("lobot", 22, 443)
29
- server = amazon.launch_server("lobot", "lobot", lobot_config.instance_size)
25
+ server = amazon.with_key_pair(lobot_config.server_ssh_pubkey) do |keypair_name|
26
+ amazon.create_security_group("lobot")
27
+ amazon.open_port("lobot", 22, 443)
28
+ amazon.launch_server(keypair_name, "lobot", lobot_config.instance_size)
29
+ end
30
+ wait_for_server(server)
30
31
 
31
- puts "Writing ip address for ec2: #{server.public_ip_address}"
32
- lobot_config.master = server.public_ip_address
33
- lobot_config.instance_id = server.id
34
- lobot_config.save
32
+ say("Writing ip address for ec2: #{server.public_ip_address}")
35
33
 
36
- update_known_hosts
34
+ lobot_config.update(master: server.public_ip_address, instance_id: server.id)
37
35
  end
38
36
 
39
- desc "destroy_ec2", "Destroys all the lobot resources that we can find on ec2. Be Careful!"
37
+ desc "destroy_ec2", "Destroys all the lobot resources on EC2"
38
+ method_option :all, default: false
39
+ method_option :force, default: false
40
40
  def destroy_ec2
41
- amazon.destroy_ec2
42
- lobot_config.master = nil
41
+ instance = (options['all'] ? :all : lobot_config.instance_id)
42
+
43
+ amazon.destroy_ec2(confirmation_proc(options['force']), instance) do |server|
44
+ say("Clearing ip address for ec2: #{server.public_ip_address}")
45
+
46
+ lobot_config.update(master: nil, instance_id: nil)
47
+ end
43
48
  end
44
49
 
45
- desc "create_vagrant", "Lowers the price of heroin to reasonable levels"
50
+ desc "create_vagrant", "Creates a vagrant instance"
46
51
  def create_vagrant
47
- spawn_env = {"LOBOT_SSH_KEY" => File.expand_path("#{lobot_config.server_ssh_key}.pub"),
52
+ spawn_env = {"LOBOT_SSH_KEY" => lobot_config.server_ssh_pubkey_path,
48
53
  "VAGRANT_HOME" => File.expand_path("~")}
49
54
  spawn_options = {chdir: lobot_root_path}
50
55
 
@@ -53,22 +58,25 @@ module Lobot
53
58
 
54
59
  vagrant_ip = "192.168.33.10"
55
60
 
56
- puts "Writing ip address for vagrant: #{vagrant_ip}"
57
- lobot_config.master = vagrant_ip
58
- lobot_config.save
61
+ say("Writing ip address for vagrant: #{vagrant_ip}")
59
62
 
60
- update_known_hosts
63
+ lobot_config.update(master: vagrant_ip)
61
64
  end
62
65
 
63
66
  desc "config", "Dumps all configuration data for Lobot"
64
67
  def config
65
- pp lobot_config.to_hash
68
+ say lobot_config.display
69
+ end
70
+
71
+ desc "certificate", "Dump the certificate"
72
+ def certificate
73
+ say(keychain.fetch_remote_certificate("https://#{lobot_config.master}"))
66
74
  end
67
75
 
68
76
  desc "bootstrap", "Configures Lobot's master node"
69
77
  def bootstrap
70
78
  sync_bootstrap_script
71
- master_server.exec("bash -l script/bootstrap_server.sh")
79
+ master_server.system!("bash -l script/bootstrap_server.sh")
72
80
  rescue Errno::ECONNRESET
73
81
  sleep 1
74
82
  end
@@ -78,28 +86,28 @@ module Lobot
78
86
  sync_chef_recipes
79
87
  upload_soloist
80
88
  sync_github_ssh_key
81
- master_server.exec("bash -l -c 'rvm use 1.9.3; gem list | grep soloist || gem install --no-ri --no-rdoc soloist; soloist'")
82
- rescue Errno::ECONNRESET
89
+ master_server.upload(File.expand_path('../../../templates/Gemfile-remote', __FILE__), 'Gemfile')
90
+ master_server.system!("bash -l -c 'rvm use 1.9.3; bundle install; soloist'") rescue Errno::ECONNRESET
83
91
  sleep 1
84
92
  end
85
93
 
86
- desc "add_build(name, repository, branch, command)", "Adds a build to Lobot"
94
+ desc "add_build <name> <repository> <branch> <command>", "Adds a build to Lobot"
87
95
  def add_build(name, repository, branch, command)
88
- build = {
89
- "name" => name,
90
- "repository" => repository,
91
- "branch" => branch,
92
- "command" => command
93
- }
94
- lobot_config.node_attributes = lobot_config.node_attributes.tap do |config|
95
- config.jenkins.builds << build unless config.jenkins.builds.include?(build)
96
- end
96
+ raise lobot_config.errors.join(" and ") unless lobot_config.valid?
97
+
98
+ lobot_config.add_build(name, repository, branch, command)
97
99
  lobot_config.save
98
100
  end
99
101
 
102
+ desc "trust_certificate", "Adds the current master's certificate to your OSX keychain"
103
+ def trust_certificate
104
+ certificate_contents = keychain.fetch_remote_certificate("https://#{lobot_config.master}/")
105
+ keychain.add_certificate(certificate_contents)
106
+ end
107
+
100
108
  no_tasks do
101
109
  def master_server
102
- @master_server ||= Lobot::Sobo.new(lobot_config.master, lobot_config.server_ssh_key)
110
+ @master_server ||= Lobot::Sobo.new(lobot_config.master, lobot_config.server_ssh_key_path)
103
111
  end
104
112
 
105
113
  def lobot_config
@@ -110,16 +118,21 @@ module Lobot
110
118
  @amazon ||= Lobot::Amazon.new(lobot_config.aws_key, lobot_config.aws_secret)
111
119
  end
112
120
 
121
+ def keychain
122
+ @keychain ||= Lobot::Keychain.new("/Library/Keychains/System.keychain")
123
+ end
124
+
113
125
  def sync_bootstrap_script
114
126
  master_server.upload(File.join(lobot_root_path, "script/"), "script/")
115
127
  end
116
128
 
117
129
  def sync_github_ssh_key
118
- master_server.upload(lobot_config.github_ssh_key, "~/.ssh/id_rsa")
130
+ master_server.upload(lobot_config.github_ssh_key_path, "~/.ssh/id_rsa")
119
131
  end
120
132
 
121
133
  def sync_chef_recipes
122
134
  master_server.upload(File.join(lobot_root_path, "chef/"), "chef/")
135
+ master_server.upload("cookbooks/", "chef/project-cookbooks/")
123
136
  end
124
137
 
125
138
  def upload_soloist
@@ -132,6 +145,7 @@ module Lobot
132
145
  end
133
146
 
134
147
  private
148
+
135
149
  def lobot_root_path
136
150
  File.expand_path('../../..', __FILE__)
137
151
  end
@@ -140,9 +154,19 @@ module Lobot
140
154
  File.expand_path("config/lobot.yml", Dir.pwd)
141
155
  end
142
156
 
143
- def update_known_hosts
144
- raise "failed to remove old host key from known_hosts" unless system "ssh-keygen -R #{lobot_config.master} 2> /dev/null"
145
- raise "failed to add host key to known_hosts" unless system "ssh-keyscan #{lobot_config.master} 2> /dev/null >> ~/.ssh/known_hosts"
157
+ def wait_for_server(server)
158
+ Godot.new(server.public_ip_address, 22, :timeout => 180).wait!
159
+ end
160
+
161
+ # The proc is given a Fog server object and must return true/false
162
+ def confirmation_proc(force)
163
+ if force
164
+ ->(_) { true }
165
+ else
166
+ ->(server) {
167
+ yes?("DESTROY #{server.id} (#{server.public_ip_address})?")
168
+ }
169
+ end
146
170
  end
147
171
  end
148
172
  end