vagrant-openshift 1.0.11 → 1.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/README.asciidoc +39 -53
  3. data/lib/vagrant-openshift/action/{build_sources.rb → build_openshift2.rb} +2 -2
  4. data/lib/vagrant-openshift/action/{build_geard.rb → build_openshift3.rb} +9 -5
  5. data/lib/vagrant-openshift/action/{build_geard_images.rb → build_openshift3_images.rb} +6 -6
  6. data/lib/vagrant-openshift/action/build_openshift3_infrastructure_images.rb +50 -0
  7. data/lib/vagrant-openshift/action/{checkout_tests.rb → checkout_openshift2_tests.rb} +2 -2
  8. data/lib/vagrant-openshift/action/checkout_repositories.rb +1 -1
  9. data/lib/vagrant-openshift/action/clean.rb +1 -3
  10. data/lib/vagrant-openshift/action/clone_upstream_repositories.rb +1 -1
  11. data/lib/vagrant-openshift/action/create_bare_repo_placeholders.rb +1 -1
  12. data/lib/vagrant-openshift/action/{create_puppet_file.rb → create_openshift2_puppet_file.rb} +1 -1
  13. data/lib/vagrant-openshift/action/{create_test_users.rb → create_openshift2_test_users.rb} +2 -2
  14. data/lib/vagrant-openshift/action/{download_artifacts.rb → download_artifacts_openshift2.rb} +3 -4
  15. data/lib/vagrant-openshift/action/download_artifacts_openshift3.rb +61 -0
  16. data/lib/vagrant-openshift/action/generate_template.rb +42 -4
  17. data/lib/vagrant-openshift/action/{idle_all_gears.rb → idle_all_gears_openshift2.rb} +2 -2
  18. data/lib/vagrant-openshift/action/{install_open_shift_dependencies.rb → install_openshift2_base_dependencies.rb} +2 -2
  19. data/lib/vagrant-openshift/action/{install_build_dependencies.rb → install_openshift2_build_dependencies.rb} +1 -1
  20. data/lib/vagrant-openshift/action/{install_geard.rb → install_openshift3.rb} +27 -21
  21. data/lib/vagrant-openshift/action/{install_geard_base_dependencies.rb → install_openshift3_base_dependencies.rb} +8 -25
  22. data/lib/vagrant-openshift/action/{install_geard_images.rb → install_openshift3_images.rb} +1 -1
  23. data/lib/vagrant-openshift/action/{local_repo_checkout.rb → local_openshift2_checkout.rb} +2 -2
  24. data/lib/vagrant-openshift/action/{local_geard_checkout.rb → local_openshift3_checkout.rb} +5 -5
  25. data/lib/vagrant-openshift/action/{run_tests.rb → run_openshift2_tests.rb} +2 -2
  26. data/lib/vagrant-openshift/action/{run_geard_tests.rb → run_openshift3_tests.rb} +25 -16
  27. data/lib/vagrant-openshift/action/sync_local_repository.rb +8 -5
  28. data/lib/vagrant-openshift/action/sync_upstream_repository.rb +2 -2
  29. data/lib/vagrant-openshift/action/{restart_geard.rb → try_restart_openshift3.rb} +3 -5
  30. data/lib/vagrant-openshift/action/{uninstall_openshift_rpms.rb → uninstall_openshift2_rpms.rb} +2 -2
  31. data/lib/vagrant-openshift/action.rb +67 -63
  32. data/lib/vagrant-openshift/command/{build_origin_base.rb → build_openshift2_base.rb} +3 -3
  33. data/lib/vagrant-openshift/command/{build_geard.rb → build_openshift3.rb} +4 -4
  34. data/lib/vagrant-openshift/command/{build_geard_base.rb → build_openshift3_base.rb} +4 -4
  35. data/lib/vagrant-openshift/command/{build_geard_images.rb → build_openshift3_images.rb} +7 -7
  36. data/lib/vagrant-openshift/command/build_openshift3_infrastructure_images.rb +60 -0
  37. data/lib/vagrant-openshift/command/{restart_geard.rb → install_openshift3.rb} +4 -4
  38. data/lib/vagrant-openshift/command/{local_repo_setup.rb → local_openshift2_setup.rb} +3 -3
  39. data/lib/vagrant-openshift/command/{local_geard_setup.rb → local_openshift3_setup.rb} +3 -3
  40. data/lib/vagrant-openshift/command/openshift_init.rb +1 -1
  41. data/lib/vagrant-openshift/command/{repo_sync.rb → repo_sync_openshift2.rb} +4 -4
  42. data/lib/vagrant-openshift/command/{repo_sync_geard.rb → repo_sync_openshift3.rb} +8 -8
  43. data/lib/vagrant-openshift/command/{test.rb → test_openshift2.rb} +3 -3
  44. data/lib/vagrant-openshift/command/{test_geard.rb → test_openshift3.rb} +4 -4
  45. data/lib/vagrant-openshift/command/{test_geard_image.rb → test_openshift3_image.rb} +4 -4
  46. data/lib/vagrant-openshift/command/{install_geard.rb → try_restart_openshift3.rb} +4 -4
  47. data/lib/vagrant-openshift/constants.rb +29 -8
  48. data/lib/vagrant-openshift/helper/command_helper.rb +12 -5
  49. data/lib/vagrant-openshift/plugin.rb +44 -39
  50. data/lib/vagrant-openshift/provisioner.rb +4 -4
  51. data/lib/vagrant-openshift/templates/builder/Rakefile +3 -3
  52. data/lib/vagrant-openshift/templates/builder/lib/rpm.rb +2 -2
  53. data/lib/vagrant-openshift/templates/builder/lib/test.rb +1 -1
  54. data/lib/vagrant-openshift/templates/command/init-openshift/Vagrantfile.erb +10 -14
  55. data/lib/vagrant-openshift/templates/command/init-openshift/box_info.yaml +9 -9
  56. data/lib/vagrant-openshift/version.rb +1 -1
  57. metadata +37 -34
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53f42ad6eeea81faac5dc4094f66c540759b5276
4
- data.tar.gz: c6f5b108e6fea0f10d3023204ae3bf44e78051bc
3
+ metadata.gz: e99424d02a9d9cf48ecfe8b86623f866c41f67ae
4
+ data.tar.gz: a9394c7c854bd35e0a2b0b75486fa842469cdbff
5
5
  SHA512:
6
- metadata.gz: 10b73600f020405ff442a623b791af60cee555d494cead79959fac324c3ef5bb409937f46bfb80298c82a6f8a13bf35b07eab8d65f29c8d30b6dbfd82e86f245
7
- data.tar.gz: 78059996e90d5fdc8ca322c4c3c03f9ba11844f54de8de83553c71df7a928ad786c9fb81d4dc2818cb5a53adfb0682dcf1d777da54bd618d0e7a356d1230b061
6
+ metadata.gz: 586312d43c42cb95f7464e97ba75d9eb56638784038cbb8d7810fb837a145186e3119218e518977e2c3e31ab0b9f8caf13b489935c31c58e65c52587052f6b48
7
+ data.tar.gz: d5b882400527319a834c92ab70f9231e2fa643e198898dd6e5744758b2a14dbecf8e5e05c92b8178d89329d33d43de97321c9bb8e3de218bf095eee2200966d8
data/README.asciidoc CHANGED
@@ -33,59 +33,30 @@ Compile an install the plugin using Rake
33
33
  $ rake vagrant:install
34
34
  ----
35
35
 
36
- === Getting started
36
+ === Getting started with Openshift v3
37
37
 
38
38
  ==== Clone the OpenShift Origin repositories
39
39
 
40
- ===== Geard
41
-
42
40
  [source, sh]
43
41
  ----
44
42
  $ echo "export GOPATH=~/code" >> ~/.bash_profile # ~/code can be any dir
45
43
  $ source ~/.bash_profile
46
44
  $ cd $GOPATH
47
- $ vagrant geard-local-checkout -u <github username>
48
- ----
49
-
50
- ===== OpenShift 2.x
51
-
52
- [source, sh]
53
- ----
54
- $ vagrant origin-local-checkout -u <github username>
45
+ $ vagrant openshift3-local-checkout -u <github username>
46
+ $ cd github.com/src/openshift/origin
55
47
  ----
56
48
 
57
- This will clone several repositories from link:http://www.github.com[GitHub] and link them against the upstream repositories.
58
-
59
- NOTE: Skip this step if building upstream code
60
49
 
61
50
  ==== Initialize the Vagrantfile
62
51
 
63
- Create a Vagrantfile and customize it to match your requirements:
64
-
65
- [source, sh]
66
- ----
67
- $ vagrant origin-init <instance name>
68
- ----
69
-
70
- .Command options:
71
-
72
- * Specify which OS to build with:
73
- ** --os fedora - Launch a Fedora 20 image (used for Geard development)
74
- ** --os rhel6 - Launch a RHEL 6 image (where available)
75
- ** --os centos6 - Launch a CentOS 6 image (where available, used for OpenShift 2.x development)
76
-
77
- * Specify the stage of image to launch:
78
- ** --stage os - Launch the base operating system with no OpenShift dependencies
79
- ** --stage deps - Launch the image with OpenShift dependencies already installed
80
- ** --stage inst - Launch the image with OpenShift fully installed
81
-
82
- .So to launch the latest OpenShift instance:
52
+ Generate a .vagrant-openshift.json it to match your requirements:
83
53
 
84
54
  [source, sh]
85
55
  ----
86
56
  $ vagrant origin-init --stage inst --os fedora <instance name>
87
57
  ----
88
58
 
59
+
89
60
  ==== Start the machine
90
61
 
91
62
  ===== VirtualBox
@@ -104,61 +75,76 @@ Note: See Other Environments below for launching against other options.
104
75
 
105
76
  * Syncing and building code from local repository clones
106
77
 
107
- ===== Geard
78
+ [source, sh]
79
+ ----
80
+ $ vagrant sync-openshift3
81
+ ----
82
+
83
+
84
+ ==== Running Tests
108
85
 
109
86
  [source, sh]
110
87
  ----
111
- $ vagrant sync-geard
88
+ $ vagrant test-openshift3 --all
112
89
  ----
113
90
 
114
91
 
115
- ===== OpenShift 2.x
92
+ === Getting started with Openshift v2
93
+
94
+ ==== Clone the OpenShift Origin repositories
116
95
 
117
96
  [source, sh]
118
97
  ----
119
- $ vagrant sync
98
+ $ vagrant openshift2-local-checkout -u <github username>
120
99
  ----
121
100
 
101
+ This will clone several repositories from link:http://www.github.com[GitHub] and link them against the upstream repositories.
122
102
 
123
- ==== Running OpenShift Origin Tests
103
+ NOTE: Skip this step if building upstream code
124
104
 
125
- ===== Geard
105
+ ==== Initialize the Vagrantfile
106
+
107
+ Create a Vagrantfile and customize it to match your requirements:
126
108
 
127
109
  [source, sh]
128
110
  ----
129
- $ vagrant test-geard --all
111
+ $ vagrant origin-init --stage inst --os centos6 <instance name>
130
112
  ----
131
113
 
114
+ ==== Start the machine
115
+
116
+ ===== VirtualBox
132
117
 
133
- ===== OpenShift 2.x
118
+ Running with the default VirtualBox provider
134
119
 
135
120
  [source, sh]
136
121
  ----
137
- $ vagrant test --all
122
+ vagrant up
138
123
  ----
139
124
 
140
- == Other Notes
125
+ Note: See Other Environments below for launching against other options.
141
126
 
142
- ==== Install OpenShift and its Dependencies
143
127
 
144
- If starting from --stage os, install the build and package dependencies.
128
+ ==== Making Subsequent Changes
145
129
 
146
- ===== Geard
130
+ * Syncing and building code from local repository clones
147
131
 
148
132
  [source, sh]
149
133
  ----
150
- $ vagrant build-geard-base
151
- $ vagrant install-geard
134
+ $ vagrant sync-openshift2
152
135
  ----
153
136
 
154
- ===== OpenShift 2.x
137
+
138
+ ==== Running Tests
155
139
 
156
140
  [source, sh]
157
141
  ----
158
- $ vagrant origin-build-base
159
- $ vagrant sync --clean
142
+ $ vagrant test-openshift2 --all
160
143
  ----
161
144
 
145
+
146
+ == Other Notes
147
+
162
148
  ==== Other Environments
163
149
 
164
150
  ===== AWS/EC2
@@ -291,7 +277,7 @@ certtool --generate-certificate --load-privkey clientkey.pem \
291
277
 
292
278
  ----
293
279
  LIBVIRTD_ARGS="--listen"
294
- ----
280
+ ----
295
281
 
296
282
  ** Restart libvirtd
297
283
 
@@ -17,7 +17,7 @@
17
17
  module Vagrant
18
18
  module Openshift
19
19
  module Action
20
- class BuildSources
20
+ class BuildOpenshift2
21
21
  include CommandHelper
22
22
 
23
23
  def initialize(app, env)
@@ -36,4 +36,4 @@ module Vagrant
36
36
  end
37
37
  end
38
38
  end
39
- end
39
+ end
@@ -17,7 +17,7 @@
17
17
  module Vagrant
18
18
  module Openshift
19
19
  module Action
20
- class BuildGeard
20
+ class BuildOpenshift3
21
21
  include CommandHelper
22
22
 
23
23
  def initialize(app, env)
@@ -26,11 +26,15 @@ module Vagrant
26
26
  end
27
27
 
28
28
  def call(env)
29
- do_execute(env[:machine], sync_bash_command('geard', %{
30
- echo "Performing geard build..."
29
+ do_execute(env[:machine], sync_bash_command('origin', %{
30
+ echo "Performing openshift build..."
31
31
  set -e
32
- contrib/build -s
33
- }))
32
+ hack/build-go.sh
33
+ if [ ! -d _output/etcd ]
34
+ then
35
+ hack/install-etcd.sh
36
+ fi
37
+ }))
34
38
 
35
39
  @app.call(env)
36
40
  end
@@ -17,7 +17,7 @@
17
17
  module Vagrant
18
18
  module Openshift
19
19
  module Action
20
- class BuildGeardImages
20
+ class BuildOpenshift3Images
21
21
  include CommandHelper
22
22
 
23
23
  def initialize(app, env, options)
@@ -30,9 +30,9 @@ module Vagrant
30
30
  # FIXME: Measure what would be the appropriate timeout here as the
31
31
  # docker build command can take quite a long time...
32
32
  #
33
- @options[:geard_images].each do |geard_image, _|
34
- docker_image_name = "openshift/#{geard_image}"
35
- docker_file_path = "#{Constants.build_dir}#{geard_image}"
33
+ @options[:openshift3_images].each do |openshift3_image, _|
34
+ docker_image_name = "openshift/#{openshift3_image}"
35
+ docker_file_path = "#{Constants.build_dir}#{openshift3_image}"
36
36
  build_cmd = %{
37
37
  echo "Building #{docker_image_name} image"
38
38
  pushd #{docker_file_path}
@@ -40,9 +40,9 @@ pushd #{docker_file_path}
40
40
  popd
41
41
  }
42
42
  if @options[:force]
43
- sudo(env[:machine], build_cmd, { :timeout => 60*20 })
43
+ sudo(env[:machine], build_cmd, { :timeout => 60*20, :verbose => false })
44
44
  else
45
- sudo(env[:machine], sync_bash_command(geard_image, build_cmd), { :timeout => 60*20 })
45
+ sudo(env[:machine], sync_bash_command(openshift3_image, build_cmd), { :timeout => 60*20, :verbose => false })
46
46
  end
47
47
  end
48
48
  @app.call(env)
@@ -0,0 +1,50 @@
1
+ #--
2
+ # Copyright 2014 Red Hat, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #++
16
+
17
+ module Vagrant
18
+ module Openshift
19
+ module Action
20
+ class BuildOpenshift3InfrastructureImages
21
+ include CommandHelper
22
+
23
+ def initialize(app, env, options)
24
+ @app = app
25
+ @env = env
26
+ @options = options
27
+ end
28
+
29
+ def call(env)
30
+ # FIXME: Measure what would be the appropriate timeout here as the
31
+ # docker build command can take quite a long time...
32
+ #
33
+ @options[:openshift3_infrastructure_images].each do |openshift3_image, _|
34
+ docker_image_name = "openshift/#{openshift3_image}"
35
+ docker_file_path = "#{Constants.build_dir}#{Vagrant::Openshift::Constants.openshift3_infrastructure_images[openshift3_image]}"
36
+ build_cmd = %{
37
+ echo "Building #{docker_image_name} image"
38
+ pushd #{docker_file_path}
39
+ docker build --rm #{@options[:force] ? "--no-cache" : ""} -t #{docker_image_name} .
40
+ popd
41
+ }
42
+ sudo(env[:machine], build_cmd, { :timeout => 60*20, :verbose => false })
43
+ end
44
+ @app.call(env)
45
+ end
46
+
47
+ end
48
+ end
49
+ end
50
+ end
@@ -17,7 +17,7 @@
17
17
  module Vagrant
18
18
  module Openshift
19
19
  module Action
20
- class CheckoutTests
20
+ class CheckoutOpenshift2Tests
21
21
  include CommandHelper
22
22
 
23
23
  def initialize(app, env)
@@ -54,4 +54,4 @@ Listen 81
54
54
  end
55
55
  end
56
56
  end
57
- end
57
+ end
@@ -28,7 +28,7 @@ module Vagrant
28
28
 
29
29
  def call(env)
30
30
  git_clone_commands = ""
31
- Constants.repos.each do |repo_name, url|
31
+ Constants.repos(env).each do |repo_name, url|
32
32
  bare_repo_name = repo_name + "-bare"
33
33
  bare_repo_path = Constants.build_dir + bare_repo_name
34
34
  repo_path = Constants.build_dir + repo_name
@@ -26,10 +26,8 @@ module Vagrant
26
26
  end
27
27
 
28
28
  def call(env)
29
- is_fedora = env[:machine].communicate.test("test -e /etc/fedora-release")
30
-
31
29
  git_clone_commands = ""
32
- Constants.repos.each do |repo_name, url|
30
+ Constants.repos(env).each do |repo_name, url|
33
31
  bare_repo_name = repo_name + "-bare"
34
32
  wc_repo_name = repo_name + "-bare-working_copy"
35
33
  bare_repo_path = Constants.build_dir + bare_repo_name
@@ -34,7 +34,7 @@ module Vagrant
34
34
  }}
35
35
 
36
36
  git_clone_commands = ""
37
- Constants.repos.each do |repo_name, url|
37
+ Constants.repos(env).each do |repo_name, url|
38
38
  bare_repo_name = repo_name + "-bare"
39
39
  bare_repo_path = Constants.build_dir + bare_repo_name
40
40
 
@@ -33,7 +33,7 @@ module Vagrant
33
33
  }}
34
34
 
35
35
  git_clone_commands = ""
36
- Constants.repos.each do |repo_name, url|
36
+ Constants.repos(env).each do |repo_name, url|
37
37
  bare_repo_name = repo_name + "-bare"
38
38
  bare_repo_path = Constants.build_dir + bare_repo_name
39
39
 
@@ -17,7 +17,7 @@
17
17
  module Vagrant
18
18
  module Openshift
19
19
  module Action
20
- class CreatePuppetFile
20
+ class CreateOpenshift2PuppetFile
21
21
  include CommandHelper
22
22
 
23
23
  def initialize(app, env)
@@ -17,7 +17,7 @@
17
17
  module Vagrant
18
18
  module Openshift
19
19
  module Action
20
- class CreateTestUsers
20
+ class CreateOpenshift2TestUsers
21
21
  include CommandHelper
22
22
 
23
23
  def initialize(app, env)
@@ -33,4 +33,4 @@ module Vagrant
33
33
  end
34
34
  end
35
35
  end
36
- end
36
+ end
@@ -18,7 +18,7 @@ require 'pathname'
18
18
  module Vagrant
19
19
  module Openshift
20
20
  module Action
21
- class DownloadArtifacts
21
+ class DownloadArtifactsOpenshift2
22
22
  include CommandHelper
23
23
 
24
24
  def initialize(app, env)
@@ -55,11 +55,10 @@ module Vagrant
55
55
  FileUtils.mkdir_p File.dirname(target.to_s)
56
56
  end
57
57
 
58
- command = "/usr/bin/rsync -avz -e 'ssh -i #{private_key_path}' --rsync-path='sudo rsync' #{ssh_info[:username]}@#{ssh_info[:host]}:#{source} #{target}"
58
+ command = "/usr/bin/rsync -avz -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i #{private_key_path}' --rsync-path='sudo rsync' #{ssh_info[:username]}@#{ssh_info[:host]}:#{source} #{target}"
59
59
 
60
60
  if not system(command)
61
- machine.ui.warn "Unable to download artifact"
62
- machine.ui.warn r.stderr
61
+ machine.ui.warn "Unable to download artifacts"
63
62
  end
64
63
  end
65
64
  @app.call(env)
@@ -0,0 +1,61 @@
1
+ #--
2
+ # Copyright 2013 Red Hat, Inc.
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #++
16
+ require 'pathname'
17
+
18
+ module Vagrant
19
+ module Openshift
20
+ module Action
21
+ class DownloadArtifactsOpenshift3
22
+ include CommandHelper
23
+
24
+ def initialize(app, env)
25
+ @app = app
26
+ @env = env
27
+ end
28
+
29
+ def call(env)
30
+ machine = @env[:machine]
31
+ machine.ui.info "Downloading logs"
32
+ ssh_info = machine.ssh_info
33
+ private_key_path = ssh_info[:private_key_path].kind_of?(Array) ? ssh_info[:private_key_path][0] : ssh_info[:private_key_path]
34
+
35
+ artifacts_dir = Pathname.new(File.expand_path(machine.env.root_path + "artifacts"))
36
+ download_map = {
37
+ "/var/log/yum.log" => artifacts_dir + "yum.log",
38
+ "/var/log/secure" => artifacts_dir + "secure",
39
+ "/var/log/audit/audit.log" => artifacts_dir + "audit.log"
40
+ }
41
+
42
+ download_map.each do |source,target|
43
+ machine.ui.info "Downloading artifacts from '#{source}' to '#{target}'"
44
+ if target.to_s.end_with? '/'
45
+ FileUtils.mkdir_p target.to_s
46
+ else
47
+ FileUtils.mkdir_p File.dirname(target.to_s)
48
+ end
49
+
50
+ command = "/usr/bin/rsync -avz -e 'ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i #{private_key_path}' --rsync-path='sudo rsync' #{ssh_info[:username]}@#{ssh_info[:host]}:#{source} #{target}"
51
+
52
+ if not system(command)
53
+ machine.ui.warn "Unable to download artifacts"
54
+ end
55
+ end
56
+ @app.call(env)
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -52,9 +52,46 @@ module Vagrant
52
52
  box_info[:aws_creds_file] = @aws_creds_file
53
53
  find_ami_from_tag(box_info)
54
54
 
55
- contents = Vagrant::Util::TemplateRenderer.render(template_path.to_s[0..-5], box_info: box_info)
56
- File.open("Vagrantfile", "w+") do |f|
57
- f.write(contents)
55
+ if os == :fedora
56
+
57
+ gopath = nil
58
+ if ENV['GOPATH'] && !ENV['GOPATH'].empty?
59
+ gopath = File.expand_path(ENV['GOPATH'].split(/:/).last)
60
+ else
61
+ gopath = '.'
62
+ end
63
+
64
+ vagrant_openshift_config = {
65
+ 'instance_name' => box_info[:instance_name],
66
+ 'os' => os,
67
+ 'dev_cluster' => false,
68
+ 'num_minions' => 2,
69
+ 'rebuild_yum_cache' => false,
70
+ 'sync_to' => '/data/src',
71
+ 'sync_from' => "#{gopath}/src",
72
+ 'virtualbox' => {
73
+ 'box_name' => box_info[:virtualbox][:box_name],
74
+ 'box_url' => box_info[:virtualbox][:box_url]
75
+ },
76
+ 'vmware' => {
77
+ 'box_name' => box_info[:vmware][:box_name],
78
+ 'box_url' => box_info[:vmware][:box_url]
79
+ },
80
+ 'aws' => {
81
+ 'ami' => box_info[:aws][:ami],
82
+ 'ami_region' => box_info[:aws][:ami_region],
83
+ 'ssh_user' => box_info[:aws][:ssh_user]
84
+ }
85
+ }
86
+
87
+ File.open(".vagrant-openshift.json","w") do |f|
88
+ f.write(JSON.pretty_generate(vagrant_openshift_config))
89
+ end
90
+ else
91
+ contents = Vagrant::Util::TemplateRenderer.render(template_path.to_s[0..-5], box_info: box_info)
92
+ File.open("Vagrantfile", "w+") do |f|
93
+ f.write(contents)
94
+ end
58
95
  end
59
96
 
60
97
  @app.call(env)
@@ -77,7 +114,8 @@ module Vagrant
77
114
 
78
115
  aws_compute = Fog::Compute.new(fog_config)
79
116
  @env[:ui].info("Searching for latest base AMI")
80
- images = aws_compute.images.all({'Owner' => 'self', 'name' => "#{box_info[:aws][:ami_tag_prefix]}*" })
117
+ images = aws_compute.images.all({'Owner' => 'self', 'name' => "#{box_info[:aws][:ami_tag_prefix]}*",
118
+ 'state' => 'available' })
81
119
  latest_image = images.sort_by{ |i| i.name.split("_")[-1].to_i }.last
82
120
  box_info[:aws][:ami] = latest_image.id
83
121
  @env[:ui].info("Found: #{latest_image.id} (#{latest_image.name})")
@@ -17,7 +17,7 @@
17
17
  module Vagrant
18
18
  module Openshift
19
19
  module Action
20
- class IdleAllGears
20
+ class IdleAllGearsOpenshift2
21
21
  include CommandHelper
22
22
 
23
23
  def initialize(app, env)
@@ -33,4 +33,4 @@ module Vagrant
33
33
  end
34
34
  end
35
35
  end
36
- end
36
+ end
@@ -17,7 +17,7 @@
17
17
  module Vagrant
18
18
  module Openshift
19
19
  module Action
20
- class InstallOpenShiftDependencies
20
+ class InstallOpenshift2BaseDependencies
21
21
  include CommandHelper
22
22
 
23
23
  def initialize(app, env)
@@ -47,4 +47,4 @@ module Vagrant
47
47
  end
48
48
  end
49
49
  end
50
- end
50
+ end
@@ -17,7 +17,7 @@
17
17
  module Vagrant
18
18
  module Openshift
19
19
  module Action
20
- class InstallBuildDependencies
20
+ class InstallOpenshift2BuildDependencies
21
21
  include CommandHelper
22
22
 
23
23
  def initialize(app, env)
@@ -17,9 +17,8 @@
17
17
  module Vagrant
18
18
  module Openshift
19
19
  module Action
20
- class InstallGeard
20
+ class InstallOpenshift3
21
21
  include CommandHelper
22
-
23
22
  def initialize(app, env)
24
23
  @app = app
25
24
  @env = env
@@ -30,42 +29,49 @@ module Vagrant
30
29
  sudo(env[:machine], %{
31
30
  set -x
32
31
  # TODO Remove me ASAP
32
+ sed -i 's,^SELINUX=.*,SELINUX=permissive,' /etc/selinux/config
33
33
  setenforce 0
34
34
  usermod -a -G docker #{ssh_user}
35
35
 
36
- GEARD_PATH=/data/src/github.com/openshift/geard
37
- chown -R #{ssh_user}:#{ssh_user} /data
38
-
39
- # Modify SSHD config to use gear-auth-keys-command to support git clone from repo
40
- echo -e '\\nAuthorizedKeysCommand /usr/sbin/gear-auth-keys-command' >> /etc/ssh/sshd_config
41
- echo -e '\\nAuthorizedKeysCommandUser nobody' >> /etc/ssh/sshd_config
36
+ ORIGIN_PATH=/data/src/github.com/openshift/origin
42
37
 
43
- cat > /etc/profile.d/geard.sh <<DELIM
38
+ cat > /etc/profile.d/openshift.sh <<DELIM
44
39
  export GOPATH=/data
45
- export PATH=$GOPATH/bin:$PATH
46
- export GEARD_URI=http://172.17.42.1:43273
40
+ export PATH=$GOPATH/bin:$ORIGIN_PATH/_output/etcd/bin:$ORIGIN_PATH/_output/go/bin:$PATH
41
+ # Force using local images instead of always reaching docker hub when doing builds
42
+ export USE_LOCAL_IMAGES=true
47
43
  DELIM
48
44
 
49
- # Must listen on docker gateway address for container to access host, see: https://github.com/dotcloud/docker/issues/1143
50
- GEARD_OPTS=http://172.17.42.1:43273
51
- cat > /usr/lib/systemd/system/geard.service <<DELIM
45
+ source /etc/profile.d/openshift.sh
46
+
47
+ go get code.google.com/p/go.tools/cmd/cover
48
+
49
+ pushd $ORIGIN_PATH
50
+ hack/install-etcd.sh
51
+ popd
52
+
53
+ # Force socket reuse
54
+ echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse
55
+
56
+ chown -R #{ssh_user}:#{ssh_user} /data
57
+
58
+ cat > /usr/lib/systemd/system/openshift.service <<DELIM
52
59
  [Unit]
53
- Description=Gear Provisioning Daemon (geard)
60
+ Description=OpenShift
54
61
  After=docker.service
55
62
  Requires=docker.service
56
- Documentation=https://github.com/openshift/geard
63
+ Documentation=https://github.com/openshift/origin
57
64
 
58
65
  [Service]
59
66
  Type=simple
60
- EnvironmentFile=-/etc/default/gear
61
- ExecStart=/usr/bin/gear daemon $GEARD_OPTS
67
+ EnvironmentFile=-/etc/profile.d/openshift.sh
68
+ ExecStart=$ORIGIN_PATH/_output/go/bin/openshift start
62
69
 
63
70
  [Install]
64
71
  WantedBy=multi-user.target
65
72
  DELIM
66
73
 
67
- systemctl restart sshd
68
- systemctl enable geard.service
74
+ #systemctl enable openshift.service
69
75
  })
70
76
 
71
77
  @app.call(env)
@@ -73,4 +79,4 @@ systemctl enable geard.service
73
79
  end
74
80
  end
75
81
  end
76
- end
82
+ end