vagrant-openshift 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. checksums.yaml +7 -0
  2. data/.gitattributes +1 -0
  3. data/.gitignore +24 -0
  4. data/Gemfile +11 -0
  5. data/LICENSE.txt +13 -0
  6. data/README.asciidoc +379 -0
  7. data/Rakefile +53 -0
  8. data/lib/vagrant-openshift/action/build_geard.rb +41 -0
  9. data/lib/vagrant-openshift/action/build_geard_broker.rb +59 -0
  10. data/lib/vagrant-openshift/action/build_geard_console.rb +55 -0
  11. data/lib/vagrant-openshift/action/build_geard_images.rb +54 -0
  12. data/lib/vagrant-openshift/action/build_sources.rb +39 -0
  13. data/lib/vagrant-openshift/action/checkout_repositories.rb +72 -0
  14. data/lib/vagrant-openshift/action/checkout_tests.rb +57 -0
  15. data/lib/vagrant-openshift/action/clean.rb +51 -0
  16. data/lib/vagrant-openshift/action/clean_network_setup.rb +52 -0
  17. data/lib/vagrant-openshift/action/clone_upstream_repositories.rb +65 -0
  18. data/lib/vagrant-openshift/action/create_ami.rb +54 -0
  19. data/lib/vagrant-openshift/action/create_bare_repo_placeholders.rb +53 -0
  20. data/lib/vagrant-openshift/action/create_puppet_file.rb +84 -0
  21. data/lib/vagrant-openshift/action/create_test_users.rb +36 -0
  22. data/lib/vagrant-openshift/action/create_yum_repositories.rb +121 -0
  23. data/lib/vagrant-openshift/action/download_artifacts.rb +70 -0
  24. data/lib/vagrant-openshift/action/generate_template.rb +89 -0
  25. data/lib/vagrant-openshift/action/idle_all_gears.rb +36 -0
  26. data/lib/vagrant-openshift/action/install_build_dependencies.rb +48 -0
  27. data/lib/vagrant-openshift/action/install_geard.rb +76 -0
  28. data/lib/vagrant-openshift/action/install_geard_base_dependencies.rb +72 -0
  29. data/lib/vagrant-openshift/action/install_geard_broker.rb +39 -0
  30. data/lib/vagrant-openshift/action/install_geard_images.rb +51 -0
  31. data/lib/vagrant-openshift/action/install_open_shift_dependencies.rb +50 -0
  32. data/lib/vagrant-openshift/action/install_rhc.rb +42 -0
  33. data/lib/vagrant-openshift/action/local_geard_checkout.rb +58 -0
  34. data/lib/vagrant-openshift/action/local_repo_checkout.rb +47 -0
  35. data/lib/vagrant-openshift/action/modify_ami.rb +54 -0
  36. data/lib/vagrant-openshift/action/modify_instance.rb +71 -0
  37. data/lib/vagrant-openshift/action/prepare_ssh_config.rb +89 -0
  38. data/lib/vagrant-openshift/action/preserve_mcollective_logs.rb +48 -0
  39. data/lib/vagrant-openshift/action/restart_geard.rb +39 -0
  40. data/lib/vagrant-openshift/action/restart_geard_broker.rb +43 -0
  41. data/lib/vagrant-openshift/action/restart_geard_console.rb +43 -0
  42. data/lib/vagrant-openshift/action/run_geard_tests.rb +57 -0
  43. data/lib/vagrant-openshift/action/run_tests.rb +47 -0
  44. data/lib/vagrant-openshift/action/set_host_name.rb +43 -0
  45. data/lib/vagrant-openshift/action/setup_bind_dns_key.rb +38 -0
  46. data/lib/vagrant-openshift/action/setup_bind_host.rb +141 -0
  47. data/lib/vagrant-openshift/action/setup_builder_files.rb +57 -0
  48. data/lib/vagrant-openshift/action/setup_geard_broker.rb +71 -0
  49. data/lib/vagrant-openshift/action/sync_local_repository.rb +115 -0
  50. data/lib/vagrant-openshift/action/sync_upstream_repository.rb +71 -0
  51. data/lib/vagrant-openshift/action/test_exit_code.rb +36 -0
  52. data/lib/vagrant-openshift/action/uninstall_openshift_rpms.rb +37 -0
  53. data/lib/vagrant-openshift/action/yum_update.rb +67 -0
  54. data/lib/vagrant-openshift/action.rb +308 -0
  55. data/lib/vagrant-openshift/command/build_geard.rb +51 -0
  56. data/lib/vagrant-openshift/command/build_geard_base.rb +51 -0
  57. data/lib/vagrant-openshift/command/build_geard_broker.rb +59 -0
  58. data/lib/vagrant-openshift/command/build_geard_console.rb +59 -0
  59. data/lib/vagrant-openshift/command/build_geard_images.rb +68 -0
  60. data/lib/vagrant-openshift/command/build_origin_base.rb +51 -0
  61. data/lib/vagrant-openshift/command/checkout_repositories.rb +55 -0
  62. data/lib/vagrant-openshift/command/clone_upstream_repositories.rb +54 -0
  63. data/lib/vagrant-openshift/command/create_ami.rb +49 -0
  64. data/lib/vagrant-openshift/command/install_geard.rb +51 -0
  65. data/lib/vagrant-openshift/command/install_geard_broker.rb +51 -0
  66. data/lib/vagrant-openshift/command/install_rhc.rb +49 -0
  67. data/lib/vagrant-openshift/command/local_geard_setup.rb +62 -0
  68. data/lib/vagrant-openshift/command/local_repo_setup.rb +62 -0
  69. data/lib/vagrant-openshift/command/modify_ami.rb +54 -0
  70. data/lib/vagrant-openshift/command/modify_instance.rb +63 -0
  71. data/lib/vagrant-openshift/command/openshift_init.rb +83 -0
  72. data/lib/vagrant-openshift/command/repo_sync.rb +73 -0
  73. data/lib/vagrant-openshift/command/repo_sync_geard.rb +78 -0
  74. data/lib/vagrant-openshift/command/restart_geard.rb +51 -0
  75. data/lib/vagrant-openshift/command/restart_geard_broker.rb +51 -0
  76. data/lib/vagrant-openshift/command/restart_geard_console.rb +51 -0
  77. data/lib/vagrant-openshift/command/setup_geard_broker.rb +49 -0
  78. data/lib/vagrant-openshift/command/test.rb +108 -0
  79. data/lib/vagrant-openshift/command/test_geard.rb +59 -0
  80. data/lib/vagrant-openshift/command/test_geard_image.rb +147 -0
  81. data/lib/vagrant-openshift/config.rb +56 -0
  82. data/lib/vagrant-openshift/constants.rb +111 -0
  83. data/lib/vagrant-openshift/helper/command_helper.rb +213 -0
  84. data/lib/vagrant-openshift/plugin.rb +171 -0
  85. data/lib/vagrant-openshift/provisioner.rb +82 -0
  86. data/lib/vagrant-openshift/templates/builder/Rakefile +231 -0
  87. data/lib/vagrant-openshift/templates/builder/lib/.gitkeep +0 -0
  88. data/lib/vagrant-openshift/templates/builder/lib/rpm.rb +248 -0
  89. data/lib/vagrant-openshift/templates/builder/lib/test.rb +432 -0
  90. data/lib/vagrant-openshift/templates/builder/yum-listbuilddep +124 -0
  91. data/lib/vagrant-openshift/templates/command/init-openshift/Vagrantfile.erb +175 -0
  92. data/lib/vagrant-openshift/templates/command/init-openshift/box_info.yaml +152 -0
  93. data/lib/vagrant-openshift/version.rb +21 -0
  94. data/lib/vagrant-openshift.rb +34 -0
  95. data/vagrant-openshift.gemspec +43 -0
  96. metadata +234 -0
@@ -0,0 +1,42 @@
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 InstallRhc
21
+ include CommandHelper
22
+
23
+ def initialize(app, env)
24
+ @app = app
25
+ @env = env
26
+ end
27
+
28
+ def call(env)
29
+ do_execute(env[:machine], sync_bash_command('rhc', %{
30
+ echo "Build and install rhc from local source"
31
+ gem uninstall rhc -x -q
32
+ rm -f rhc-*.gem
33
+ gem build rhc.gemspec
34
+ gem install $(find ./ -name 'rhc-*.gem')
35
+ rm -f rhc-*.gem
36
+ }))
37
+ @app.call(env)
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,58 @@
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 LocalGeardCheckout
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
+ if ENV['GOPATH'].nil?
31
+ @env.ui.warn "You don't seem to have the GOPATH environment variable set on your system."
32
+ @env.ui.warn "See: 'go help gopath' for more details about GOPATH."
33
+ return
34
+ else
35
+ go_path = FileUtils.mkdir_p(
36
+ File.join(ENV['GOPATH'], 'src', 'github.com', 'openshift')
37
+ ).first
38
+ end
39
+ Dir.chdir(go_path) do
40
+ commands = "echo 'Waiting for the cloning process to finish'\n"
41
+ Constants.repos.each do |repo, url|
42
+ commands += %{
43
+ ( #{repo_checkout_bash_command(repo, url)} ) &
44
+ PIDS+=$!\" \";
45
+ }
46
+ end
47
+
48
+ commands += "[ -n \"$PIDS\" ] && wait $PIDS\n"
49
+ system(commands)
50
+ puts "OpenShift repositories cloned into #{Dir.pwd}"
51
+ end
52
+
53
+ @app.call(env)
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,47 @@
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
+
17
+ module Vagrant
18
+ module Openshift
19
+ module Action
20
+ class LocalRepoCheckout
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
+ commands = "echo 'Waiting for the cloning process to finish'\n"
31
+ Constants.repos.each do |repo, url|
32
+ commands += %{
33
+ ( #{repo_checkout_bash_command(repo, url)} ) &
34
+ PIDS+=$!\" \";
35
+ }
36
+ end
37
+
38
+ commands += "[ -n \"$PIDS\" ] && wait $PIDS\n"
39
+
40
+ system(commands)
41
+
42
+ @app.call(env)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,54 @@
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 'xmlsimple'
17
+ require 'pry'
18
+
19
+ module Vagrant
20
+ module Openshift
21
+ module Action
22
+ class ModifyAMI
23
+ include CommandHelper
24
+
25
+ def initialize(app, env, options)
26
+ @app = app
27
+ @env = env
28
+ @options = options
29
+ end
30
+
31
+ def call(env)
32
+ raise VagrantPlugins::AWS::Errors::FogError, :message => "Error: EC2 Machine is not available" unless env[:machine].state.id == :running
33
+
34
+ begin
35
+ machine = env[:aws_compute].servers.get(env[:machine].id)
36
+ unless @options[:tag].nil?
37
+ images = env[:aws_compute].images.all({"state" => "available", "name" => machine.tags["Name"]})
38
+ images.each do |i|
39
+ env[:aws_compute].create_tags(i.id, {'Name' => @options[:tag]})
40
+ break
41
+ end if images
42
+ end
43
+ rescue Excon::Errors::BadRequest => e
44
+ doc = XMLSimple.xml_in(e.response.body)
45
+ code = doc['Response']['Errors']['Error']['Code'][0]
46
+ message = doc['Response']['Errors']['Error']['Message'][0]
47
+ raise VagrantPlugins::AWS::Errors::FogError, :message => "#{message}. Code: #{code}"
48
+ end
49
+ @app.call(env)
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,71 @@
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 'xmlsimple'
17
+ require 'pry'
18
+
19
+ module Vagrant
20
+ module Openshift
21
+ module Action
22
+ class ModifyInstance
23
+ include CommandHelper
24
+
25
+ def initialize(app, env, options)
26
+ @app = app
27
+ @env = env
28
+ @options = options
29
+ end
30
+
31
+ def detach(env)
32
+ name = env[:machine].name.to_s
33
+ aws_dir = File.join(".vagrant", "machines", name, "aws")
34
+ FileUtils.rm_rf(aws_dir)
35
+ env[:machine].ui.info("Instance '#{name}' detached from local Vagrant.")
36
+ end
37
+
38
+ def call(env)
39
+ unless env[:machine].state.id == :running
40
+ detach(env) if @options[:detach]
41
+ raise VagrantPlugins::AWS::Errors::FogError,
42
+ :message => "Error: EC2 Machine is not available"
43
+ end
44
+
45
+ begin
46
+ machine = env[:aws_compute].servers.get(env[:machine].id)
47
+ unless @options[:rename].nil?
48
+ env[:aws_compute].tags.create(:resource_id => machine.identity, :key => 'Name', :value => @options[:rename])
49
+ env[:machine].ui.info("Renamed to #{@options[:rename]}")
50
+ end
51
+ if @options[:stop]
52
+ env[:machine].ui.info("Stopping instance #{machine.identity}")
53
+ machine.stop
54
+ while env[:machine].state.id != :stopped
55
+ sleep 5
56
+ end
57
+ env[:machine].ui.info("Stopped!")
58
+ end
59
+ detach(env) if @options[:detach]
60
+ rescue Excon::Errors::BadRequest => e
61
+ doc = XMLSimple.xml_in(e.response.body)
62
+ code = doc['Response']['Errors']['Error']['Code'][0]
63
+ message = doc['Response']['Errors']['Error']['Message'][0]
64
+ raise VagrantPlugins::AWS::Errors::FogError, :message => "#{message}. Code: #{code}"
65
+ end
66
+ @app.call(env)
67
+ end
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,89 @@
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
+
17
+ module Vagrant
18
+ module Openshift
19
+ module Action
20
+ class PrepareSshConfig
21
+ include CommandHelper
22
+
23
+ def initialize(app, env)
24
+ @app = app
25
+ @env = env
26
+ end
27
+
28
+ def call(env)
29
+ ssh_user = env[:machine].ssh_info[:username]
30
+ ssh_host = env[:machine].ssh_info[:host]
31
+ ssh_port = env[:machine].ssh_info[:port]
32
+ ssh_id_file = env[:machine].ssh_info[:private_key_path]
33
+ if ssh_id_file.kind_of?(Array)
34
+ ssh_id_file = ssh_id_file.first
35
+ end
36
+ ssh_id = env[:machine].id.gsub("-","")
37
+
38
+ ssh_config_path = Pathname.new(File.expand_path("~/.ssh/config"))
39
+ ssh_config_str = %{
40
+ Host verifier
41
+ HostName #{ssh_host}
42
+ Port #{ssh_port}
43
+ User #{ssh_user}
44
+ IdentityFile #{ssh_id_file}
45
+ StrictHostKeyChecking no
46
+
47
+ }
48
+
49
+ if ssh_config_path.exist?
50
+ if system( "grep -n 'Host verifier' #{ssh_config_path}" )
51
+ lines = File.new(ssh_config_path.to_s).readlines
52
+ lines.map!{ |line| line.rstrip }
53
+ idx = lines.index{ |l| l.match(/Host verifier/)}
54
+
55
+ lines.delete_at(idx)
56
+ while(not (lines[idx].nil? or lines[idx].match(/Host /)))
57
+ lines.delete_at(idx)
58
+ end
59
+
60
+ File.open(ssh_config_path.to_s, "w") do |file|
61
+ file.write(lines.join("\n"))
62
+ file.write(ssh_config_str)
63
+ end
64
+ else
65
+ File.open(ssh_config_path.to_s, "a") do |file|
66
+ file.write(ssh_config_str)
67
+ end
68
+ end
69
+ else
70
+ File.open(ssh_config_path.to_s, "w") do |file|
71
+ file.write(ssh_config_str)
72
+ end
73
+ FileUtils.chmod(0600, ssh_config_path.to_s)
74
+ end
75
+
76
+ home_dir=File.join(ENV['HOME'], '.openshiftdev/home.d')
77
+ if File.exists?(home_dir)
78
+ Dir.glob(File.join(home_dir, '???*'), File::FNM_DOTMATCH).each {|file|
79
+ puts "Installing ~/#{File.basename(file)}"
80
+ system "scp #{file} verifier:"
81
+ }
82
+ end
83
+
84
+ @app.call(env)
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
@@ -0,0 +1,48 @@
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
+
17
+ module Vagrant
18
+ module Openshift
19
+ module Action
20
+ class PreserveMcollectiveLogs
21
+ include CommandHelper
22
+
23
+ def initialize(app, env)
24
+ @app = app
25
+ @env = env
26
+ end
27
+
28
+ def call(env)
29
+ is_fedora = env[:machine].communicate.test("test -e /etc/fedora-release")
30
+ server_cfg_path = is_fedora ? '/etc/mcollective/server.cfg' : '/opt/rh/ruby193/root/etc/mcollective/server.cfg'
31
+
32
+ unless env[:machine].communicate.test("grep 'keeplogs=9999' #{server_cfg_path}")
33
+ env[:machine].ui.info "Keep all mcollective logs on remote instance"
34
+ sudo(env[:machine], "echo keeplogs=9999 >> #{server_cfg_path}")
35
+
36
+ if is_fedora
37
+ sudo(env[:machine], "/sbin/service mcollective restart")
38
+ else
39
+ sudo(env[:machine], "/sbin/service ruby193-mcollective restart")
40
+ end
41
+ end
42
+
43
+ @app.call(env)
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
@@ -0,0 +1,39 @@
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
+
17
+ module Vagrant
18
+ module Openshift
19
+ module Action
20
+ class RestartGeard
21
+ include CommandHelper
22
+
23
+ def initialize(app, env)
24
+ @app = app
25
+ @env = env
26
+ end
27
+
28
+ def call(env)
29
+ sudo(env[:machine], %{
30
+ systemctl restart geard
31
+ })
32
+
33
+ @app.call(env)
34
+ end
35
+
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,43 @@
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
+
17
+ module Vagrant
18
+ module Openshift
19
+ module Action
20
+ class RestartGeardBroker
21
+ include CommandHelper
22
+
23
+ def initialize(app, env)
24
+ @app = app
25
+ @env = env
26
+ end
27
+
28
+ def call(env)
29
+ #TODO the second line is a temporary hack due to the selinux policies being outdated in the repo
30
+ #TODO post geard fixes, remove sleep 2, and gear init from sudo below
31
+ sudo(env[:machine], %{
32
+ set -e
33
+ gear restart origin-broker-1
34
+ sleep 2
35
+ gear init --post "origin-broker-1" "origin-broker"
36
+ })
37
+ @app.call(env)
38
+ end
39
+
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,43 @@
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
+
17
+ module Vagrant
18
+ module Openshift
19
+ module Action
20
+ class RestartGeardConsole
21
+ include CommandHelper
22
+
23
+ def initialize(app, env)
24
+ @app = app
25
+ @env = env
26
+ end
27
+
28
+ def call(env)
29
+ #TODO the second line is a temporary hack due to the selinux policies being outdated in the repo
30
+ #TODO post geard fixes, remove sleep 2, and gear init from sudo below
31
+ sudo(env[:machine], %{
32
+ set -e
33
+ gear restart origin-console-1
34
+ sleep 2
35
+ gear init --post "origin-console-1" "origin-console"
36
+ })
37
+ @app.call(env)
38
+ end
39
+
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,57 @@
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
+
17
+ module Vagrant
18
+ module Openshift
19
+ module Action
20
+ class RunGeardTests
21
+ include CommandHelper
22
+
23
+ @@SSH_TIMEOUT = 4800
24
+
25
+ def initialize(app, env, options)
26
+ @app = app
27
+ @env = env
28
+ @options = options.clone
29
+ end
30
+
31
+ def call(env)
32
+ @options.delete :logs
33
+
34
+ cmd_opts = ''
35
+ if @options[:all]
36
+ cmd_opts += "-a "
37
+ end
38
+
39
+ # TODO: remove the need for permissive mode once we get through SELinux issues with docker 1.0 and geard
40
+ sudo(env[:machine], %{
41
+ set -e
42
+ if [[ $(cat /etc/sudoers | grep 'Defaults:root !requiretty') = "" ]]; then
43
+ echo "Disabling requiretty for root user for contrib/test sudo support"
44
+ echo -e '\\nDefaults:root !requiretty\\n' >> /etc/sudoers
45
+ fi
46
+ pushd #{Constants.build_dir}/geard
47
+ setenforce 0
48
+ contrib/test #{cmd_opts}
49
+ popd
50
+ }, {:timeout => 60*60})
51
+
52
+ @app.call(env)
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
@@ -0,0 +1,47 @@
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
+
17
+ module Vagrant
18
+ module Openshift
19
+ module Action
20
+ class RunTests
21
+ include CommandHelper
22
+
23
+ @@SSH_TIMEOUT = 4800
24
+
25
+ def initialize(app, env, options)
26
+ @app = app
27
+ @env = env
28
+ @options = options.clone
29
+ end
30
+
31
+ def call(env)
32
+ is_fedora = env[:machine].communicate.test("test -e /etc/fedora-release")
33
+ @options.delete :logs
34
+
35
+ cmd_opts = ''
36
+ @options.each do |k,v|
37
+ cmd_opts += "#{k}=#{v} "
38
+ end
39
+ cmd = "cd #{Constants.build_dir + 'builder'}; #{scl_wrapper(is_fedora,'rake run_tests ' + cmd_opts)} "
40
+ _,_,env[:test_exit_code] = sudo(env[:machine], cmd, {timeout: 0, fail_on_error: false})
41
+
42
+ @app.call(env)
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,43 @@
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
+
17
+ module Vagrant
18
+ module Openshift
19
+ module Action
20
+ class SetHostName
21
+ include CommandHelper
22
+
23
+ def initialize(app, env)
24
+ @app = app
25
+ @env = env
26
+ end
27
+
28
+ def call(env)
29
+ hostname = env[:machine].config.vm.hostname
30
+ remote_write(env[:machine], "/etc/sysconfig/network") {
31
+ "NETWORKING=yes\nNETWORKING_IPV6=no\nHOSTNAME=#{hostname}\n"
32
+ }
33
+ remote_write(env[:machine], "/etc/hostname") {
34
+ hostname
35
+ }
36
+ sudo(env[:machine],"restorecon -v /etc/sysconfig/network /etc/hostname")
37
+
38
+ @app.call(env)
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end