├── .gitattributes ├── .gitignore ├── .travis.yml ├── Gemfile ├── LICENSE.txt ├── README.asciidoc ├── Rakefile ├── hack ├── test.sh └── update.sh ├── lib ├── vagrant-openshift.rb └── vagrant-openshift │ ├── action.rb │ ├── action │ ├── atomic_host_upgrade.rb │ ├── build_origin.rb │ ├── build_origin_base_images.rb │ ├── build_origin_images.rb │ ├── build_origin_rpm_test.rb │ ├── build_sti.rb │ ├── build_sti_base_windows.rb │ ├── checkout_repositories.rb │ ├── clean.rb │ ├── clean_network_setup.rb │ ├── clone_upstream_repositories.rb │ ├── create_ami.rb │ ├── create_local_yum_repo.rb │ ├── create_yum_repositories.rb │ ├── download_artifacts_origin.rb │ ├── download_artifacts_origin_aggregated_logging.rb │ ├── download_artifacts_origin_console.rb │ ├── download_artifacts_origin_metrics.rb │ ├── download_artifacts_sti.rb │ ├── generate_template.rb │ ├── install_docker.rb │ ├── install_golang.rb │ ├── install_origin.rb │ ├── install_origin_asset_dependencies.rb │ ├── install_origin_base_dependencies.rb │ ├── install_origin_rhel7.rb │ ├── local_origin_checkout.rb │ ├── modify_ami.rb │ ├── modify_instance.rb │ ├── prepare_ssh_config.rb │ ├── push_openshift_images.rb │ ├── push_openshift_release.rb │ ├── run_customer_diagnostics_tests.rb │ ├── run_origin_aggregated_logging_tests.rb │ ├── run_origin_asset_tests.rb │ ├── run_origin_metrics_tests.rb │ ├── run_origin_tests.rb │ ├── run_sti_tests.rb │ ├── run_systemctl.rb │ ├── set_host_name.rb │ ├── sync_local_repository.rb │ ├── test_exit_code.rb │ └── yum_update.rb │ ├── aws.rb │ ├── command │ ├── build_atomic_host.rb │ ├── build_origin.rb │ ├── build_origin_base.rb │ ├── build_origin_base_images.rb │ ├── build_origin_images.rb │ ├── build_origin_rpm_test.rb │ ├── build_sti.rb │ ├── build_sti_base_windows.rb │ ├── checkout_repositories.rb │ ├── clone_upstream_repositories.rb │ ├── create_ami.rb │ ├── create_local_yum_repo.rb │ ├── download_artifacts_origin.rb │ ├── download_artifacts_origin_aggregated_logging.rb │ ├── download_artifacts_origin_console.rb │ ├── download_artifacts_origin_metrics.rb │ ├── download_artifacts_sti.rb │ ├── install_docker.rb │ ├── install_golang.rb │ ├── install_origin.rb │ ├── install_origin_assets_base.rb │ ├── local_origin_setup.rb │ ├── modify_ami.rb │ ├── modify_instance.rb │ ├── origin_init.rb │ ├── push_openshift_images.rb │ ├── push_openshift_release.rb │ ├── repo_sync_customer_diagnostics.rb │ ├── repo_sync_jenkins.rb │ ├── repo_sync_origin.rb │ ├── repo_sync_origin_aggregated_logging.rb │ ├── repo_sync_origin_console.rb │ ├── repo_sync_origin_metrics.rb │ ├── repo_sync_sti.rb │ ├── test_customer_diagnostics.rb │ ├── test_origin.rb │ ├── test_origin_aggregated_logging.rb │ ├── test_origin_console.rb │ ├── test_origin_image.rb │ ├── test_origin_metrics.rb │ ├── test_sti.rb │ └── try_restart_origin.rb │ ├── config.rb │ ├── constants.rb │ ├── helper │ ├── command_helper.rb │ └── install_helper.rb │ ├── hooks │ ├── configure_aws.rb │ ├── find_ami.rb │ └── windows_wait.rb │ ├── plugin.rb │ ├── provisioner.rb │ ├── provisioner │ ├── configure_docker_client_windows.rb │ └── configure_docker_server_linux.rb │ ├── resources │ ├── configure_docker.sh │ ├── configure_system.sh │ ├── install_chrome.sh │ ├── install_dependencies.sh │ ├── install_local_epel_repos.sh │ ├── install_nonessential.sh │ ├── install_rhaos_repos.sh │ ├── local_epel.repo │ ├── reconfigure_network_fedora.sh │ ├── rhaos31.repo │ ├── rhaos32.repo │ ├── rhaos33.repo │ ├── rhaos34.repo │ ├── rhaos35.repo │ └── rhaos36.repo │ ├── templates │ ├── builder │ │ ├── Rakefile │ │ └── lib │ │ │ └── .gitkeep │ └── command │ │ └── init-openshift │ │ └── box_info.yaml │ └── version.rb └── vagrant-openshift.gemspec /.gitattributes: -------------------------------------------------------------------------------- 1 | * autocrlf=input eol=lf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.gem 2 | *.rbc 3 | *.swp 4 | .bundle 5 | .config 6 | .yardoc 7 | .project 8 | .idea/* 9 | Gemfile.lock 10 | InstalledFiles 11 | _yardoc 12 | coverage 13 | doc/ 14 | lib/bundler/man 15 | pkg 16 | rdoc 17 | spec/reports 18 | test/tmp 19 | test/version_tmp 20 | test/Vagrantfile 21 | tmp 22 | vendor 23 | .vagrant-openshift.json 24 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | before_install: 2 | - gem uninstall bundler -aIxq --force 3 | - gem uninstall -Ixq --force -i /home/travis/.rvm/gems/ruby-2.2.3@global bundler 4 | - gem install bundler -v '1.12.5' 5 | 6 | rvm: 7 | - 2.2.3 8 | 9 | gemfile: Gemfile 10 | 11 | sudo: false 12 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # Specify your gem's dependencies in vagrant-openshift.gemspec 4 | gemspec 5 | 6 | group :development do 7 | # We depend on Vagrant for development, but we don't add it as a 8 | # gem dependency because we expect to be installed within the 9 | # Vagrant environment itself using `vagrant plugin`. 10 | if File.exist?(File.expand_path("../../vagrant", __FILE__)) 11 | gem "vagrant", path: "../vagrant" 12 | else 13 | if Gem::Version.new(Bundler::VERSION) < Gem::Version.new("1.12.5") 14 | gem "vagrant", :git => "https://github.com/mitchellh/vagrant", :ref => "v1.7.4" 15 | else 16 | gem "vagrant", :git => "https://github.com/mitchellh/vagrant" 17 | end 18 | end 19 | gem "json" 20 | end 21 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2013 Red Hat, Inc. 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 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 | require 'rubygems' 18 | require 'bundler/setup' 19 | require 'pry' 20 | $stdout.sync = true 21 | $stderr.sync = true 22 | 23 | namespace :vagrant do 24 | 25 | desc "Install plugin into Vagrant" 26 | task :install do 27 | 28 | syntax_check_cmd = %{ 29 | set -e 30 | for f in `find lib -name *.rb` 31 | do 32 | ruby -c $f >/dev/null; 33 | done 34 | } 35 | `#{syntax_check_cmd}` 36 | if $?.exitstatus != 0 37 | exit 1 38 | end 39 | 40 | # We want to install our plugin on the system vagrant. Pull gem paths out of 41 | # $PATH so that we get the correct vagrant binary. 42 | dirty_path = `echo $PATH` 43 | clean_path = dirty_path.split(':').select{ |p| not p.include?('gem') }.join(':') 44 | sys_cmd = `PATH=#{clean_path} which vagrant`.chomp 45 | if $?.exitstatus != 0 46 | sys_cmd = `which vagrant`.chomp 47 | if not $?.exitstatus == 0 48 | $stderr.puts "ERROR: Could not find a Vagrant binary in your PATH.\nEnsure that Vagrant has been installed on this system." 49 | exit 1 50 | else 51 | $stderr.puts "WARNING: Could not find a Vagrant binary outside of your gem environments.\nEnsure that the Vagrant package has been installed from the official Vagrant packages and not a gem." 52 | end 53 | end 54 | 55 | system("rm -rf pkg") 56 | 57 | Rake::Task['build'].invoke 58 | name = Bundler::GemHelper.instance.send(:name) 59 | version = Bundler::GemHelper.instance.send(:version).to_s 60 | 61 | install_cmd = %{ 62 | #{sys_cmd} plugin install pkg/#{name}-#{version}.gem 63 | } 64 | system(install_cmd) 65 | end 66 | end 67 | 68 | Bundler::GemHelper.install_tasks 69 | task :default => "vagrant:install" 70 | -------------------------------------------------------------------------------- /hack/update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # This script will attempt to build the vagrant-openshift gem 4 | # from the current source tree and install it locally in the 5 | # vagrant plugin environment. 6 | 7 | set -o errexit 8 | set -o nounset 9 | set -o pipefail 10 | 11 | VAGRANT_OPENSHIFT_ROOT="$( cd "$( dirname "${BASH_SOURCE}" )/.."; pwd )" 12 | pushd "${VAGRANT_OPENSHIFT_ROOT}" >/dev/null 2>&1 13 | 14 | if ! git diff-index --quiet HEAD; then 15 | echo "[WARNING] Uncommited changes exist either in stage or in the working tree." 16 | echo "[WARNING] Commit them to proceed in building the plugin." 17 | exit 1 18 | fi 19 | 20 | echo "[INFO] Building vagrant-openshift gem using bundler..." 21 | { 22 | bundle 23 | bundle install 24 | bundle exec rake 25 | } >/tmp/vagrant-origin-update.log 2>&1 26 | echo "[INFO] Full build and install logs placed at /tmp/vagrant-openshift-update.log" 27 | 28 | vagrant plugin install pkg/vagrant-openshift-*.gem 29 | 30 | popd >/dev/null 2>&1 31 | 32 | echo "[INFO] Successfully built and installed vagrant-openshift plugin" 33 | -------------------------------------------------------------------------------- /lib/vagrant-openshift.rb: -------------------------------------------------------------------------------- 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 "vagrant-openshift/version" 17 | require "pathname" 18 | 19 | begin 20 | require "vagrant" 21 | rescue LoadError 22 | raise "Not running in vagrant environment" 23 | end 24 | 25 | module Vagrant 26 | module Openshift 27 | plugin_path = Pathname.new(File.expand_path("#{__FILE__}/../vagrant-openshift/")) 28 | 29 | autoload :CommandHelper, plugin_path + "helper/command_helper" 30 | autoload :InstallHelper, plugin_path + "helper/install_helper" 31 | autoload :Constants, plugin_path + "constants" 32 | end 33 | end 34 | 35 | require "vagrant-openshift/plugin" 36 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/atomic_host_upgrade.rb: -------------------------------------------------------------------------------- 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 AtomicHostUpgrade 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], "atomic host upgrade" 30 | 31 | @app.call(env) 32 | end 33 | end 34 | end 35 | end 36 | end 37 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/build_origin.rb: -------------------------------------------------------------------------------- 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 BuildOrigin 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 @options[:images] 31 | # Migrate the local epel repo to the host machine 32 | ssh_user = @env[:machine].ssh_info[:username] 33 | destination="/home/#{ssh_user}/" 34 | @env[:machine].communicate.upload(File.join(__dir__,"/../resources"), destination) 35 | home="#{destination}/resources" 36 | 37 | sudo(@env[:machine], "#{home}/install_local_epel_repos.sh") 38 | 39 | cmd = %{ 40 | echo "Performing origin release build with images..." 41 | set -e 42 | OS_BUILD_IMAGE_ARGS='--mount /etc/yum.repos.d/local_epel.repo:/etc/yum.repos.d/local_epel.repo' make release 43 | } 44 | else 45 | cmd = %{ 46 | echo "Performing origin release build..." 47 | set -e 48 | make release-binaries 49 | } 50 | end 51 | cmd += %{ 52 | 53 | if [ ! -d _output/etcd ] 54 | then 55 | hack/install-etcd.sh 56 | fi 57 | } 58 | if @options[:force] 59 | build_cmd = cmd 60 | cmd = %{ 61 | pushd /data/src/github.com/openshift/origin 62 | #{build_cmd} 63 | popd 64 | } 65 | else 66 | cmd = sync_bash_command('origin', cmd) 67 | end 68 | do_execute(env[:machine], cmd) 69 | @app.call(env) 70 | end 71 | end 72 | end 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/build_origin_base_images.rb: -------------------------------------------------------------------------------- 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 BuildOriginBaseImages 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 | # Migrate the local epel repo to the host machine 31 | ssh_user = @env[:machine].ssh_info[:username] 32 | destination="/home/#{ssh_user}/" 33 | @env[:machine].communicate.upload(File.join(__dir__,"/../resources"), destination) 34 | home="#{destination}/resources" 35 | 36 | sudo(@env[:machine], "#{home}/install_local_epel_repos.sh") 37 | 38 | do_execute(env[:machine], %{ 39 | echo "Building base images..." 40 | set -e 41 | pushd /data/src/github.com/openshift/origin 42 | OS_BUILD_IMAGE_ARGS='--mount /etc/yum.repos.d/local_epel.repo:/etc/yum.repos.d/local_epel.repo' hack/build-base-images.sh 43 | # note dind image does not have any epel related installs 44 | if [[ -f "hack/build-dind-images.sh" ]]; then 45 | hack/build-dind-images.sh 46 | fi 47 | popd 48 | }, 49 | { :timeout => 60*60*2, :verbose => false }) 50 | @app.call(env) 51 | end 52 | 53 | end 54 | end 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/build_origin_images.rb: -------------------------------------------------------------------------------- 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 BuildOriginImages 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 | ssh_user = env[:machine].ssh_info[:username] 31 | 32 | sudo(env[:machine], "mkdir -p #{Constants.build_dir}") 33 | sudo(env[:machine], "mkdir -p #{Constants.build_dir + "builder"} && chown -R #{ssh_user}:#{ssh_user} #{Constants.build_dir}") 34 | 35 | sudo(env[:machine], %{ 36 | set -e 37 | 38 | pushd #{Constants.build_dir}origin/images/base 39 | sudo cp -r #{Constants.build_dir}x86_64 . 40 | sudo cp /etc/yum.repos.d/origin_local.repo . 41 | docker build -t openshift/origin-base -f Dockerfile.rpm . 42 | popd 43 | }) 44 | 45 | images = @options[:images].split(",") 46 | images.each do |image| 47 | sudo(env[:machine], %{ 48 | pushd #{Constants.build_dir}origin/images/#{image} 49 | docker build -t openshift/#{image} -f Dockerfile . 50 | popd 51 | }) 52 | end 53 | 54 | 55 | @app.call(env) 56 | end 57 | end 58 | end 59 | end 60 | end 61 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/build_origin_rpm_test.rb: -------------------------------------------------------------------------------- 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 BuildOriginRpmTest 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 | ssh_user = env[:machine].ssh_info[:username] 31 | 32 | sudo(env[:machine], "mkdir -p #{Constants.build_dir}") 33 | sudo(env[:machine], "mkdir -p #{Constants.build_dir + "builder"} && chown -R #{ssh_user}:#{ssh_user} #{Constants.build_dir}") 34 | 35 | sudo(env[:machine], %{ 36 | set -e 37 | 38 | sudo yum install -y tito 39 | 40 | pushd #{Constants.build_dir}/origin 41 | sudo yum-builddep ./origin.spec 42 | sudo tito build --rpm --test -o #{Constants.build_dir} 43 | popd 44 | }) 45 | 46 | @app.call(env) 47 | end 48 | end 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/build_sti.rb: -------------------------------------------------------------------------------- 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 BuildSti 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 @options[:binary_only] 31 | 32 | cmd = %{ 33 | echo "Performing source-to-image build..." 34 | set -e 35 | hack/build-go.sh 36 | } 37 | else 38 | 39 | cmd = %{ 40 | echo "Performing source-to-image build..." 41 | set -e 42 | hack/verify-gofmt.sh 43 | hack/build-go.sh 44 | hack/build-test-images.sh 45 | } 46 | end 47 | 48 | if @options[:force] 49 | build_cmd = cmd 50 | cmd = %{ 51 | pushd /data/src/github.com/openshift/source-to-image 52 | #{build_cmd} 53 | popd 54 | } 55 | else 56 | cmd = sync_bash_command('source-to-image', cmd) 57 | end 58 | do_execute(env[:machine], cmd) 59 | @app.call(env) 60 | end 61 | end 62 | end 63 | end 64 | end 65 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/checkout_repositories.rb: -------------------------------------------------------------------------------- 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 CheckoutRepositories 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 | git_clone_commands = "set -e\n" 31 | repo_name = @options[:repo] 32 | bare_repo_name = repo_name + "-bare" 33 | bare_repo_path = Constants.build_dir + bare_repo_name 34 | repo_path = Constants.build_dir + repo_name 35 | 36 | git_clone_commands += %{ 37 | if [ -d #{bare_repo_path} ]; then 38 | rm -rf #{repo_path} 39 | echo 'Cloning #{repo_name} ...' 40 | git clone --quiet --recurse-submodules #{bare_repo_path} #{repo_path} 41 | } 42 | 43 | if @options[:branch] && @options[:branch][repo_name] 44 | git_clone_commands += "cd #{repo_path}; git checkout --quiet #{@options[:branch][repo_name]}; cd #{Constants.build_dir};\n" 45 | end 46 | git_clone_commands += %{ 47 | else 48 | MISSING_REPO+='#{bare_repo_name}' 49 | fi 50 | } 51 | 52 | git_clone_commands += %{ 53 | if [ -n \"$MISSING_REPO\" ]; then 54 | echo 'Missing required upstream repositories:' 55 | echo $MISSING_REPO 56 | echo 'To fix, execute command: vagrant clone-upstream-repos' 57 | fi 58 | } 59 | 60 | do_execute env[:machine], git_clone_commands 61 | 62 | @app.call(env) 63 | end 64 | end 65 | end 66 | end 67 | end 68 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/clean.rb: -------------------------------------------------------------------------------- 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 Clean 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 | git_clone_commands = "" 31 | repo_name = @options[:repo] 32 | bare_repo_name = repo_name + "-bare" 33 | wc_repo_name = repo_name + "-bare-working_copy" 34 | bare_repo_path = Constants.build_dir + bare_repo_name 35 | repo_path = Constants.build_dir + repo_name 36 | wc_repo_path = Constants.build_dir + wc_repo_name 37 | 38 | git_clone_commands += "rm -rf #{bare_repo_path}; \n" 39 | do_execute env[:machine], git_clone_commands 40 | 41 | @app.call(env) 42 | end 43 | end 44 | end 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/clean_network_setup.rb: -------------------------------------------------------------------------------- 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 CleanNetworkSetup 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 | 31 | unless is_fedora 32 | if env[:machine].communicate.test("test -e /etc/udev/rules.d/70-persistent-net.rules") 33 | remote_write(env[:machine], "/etc/udev/rules.d/70-persistent-net.rules") do 34 | %{# This file was automatically generated by the /lib/udev/write_net_rules 35 | # program, run by the persistent-net-generator.rules rules file. 36 | # 37 | # You can modify it, as long as you keep each rule on a single 38 | # line, and change only the value of the NAME= key. 39 | 40 | } 41 | end 42 | end 43 | end 44 | 45 | sudo env[:machine], "yum clean all" 46 | sudo env[:machine], "rm -f /var/lib/mlocate/mlocate.db" 47 | @app.call(env) 48 | end 49 | end 50 | end 51 | end 52 | end -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/clone_upstream_repositories.rb: -------------------------------------------------------------------------------- 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 CloneUpstreamRepositories 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 | ssh_user, ssh_group = get_ssh_user_and_group(env[:machine]) 31 | 32 | remote_write(env[:machine], "/#{ssh_user}/.ssh/config", "#{ssh_user}:#{ssh_group}", "0600") { 33 | %{Host github.com 34 | StrictHostKeyChecking no 35 | UserKnownHostsFile=/dev/null 36 | }} 37 | 38 | git_clone_commands = "set -e\n" 39 | repo_name = @options[:repo] 40 | bare_repo_name = repo_name + "-bare" 41 | bare_repo_path = Constants.build_dir + bare_repo_name 42 | 43 | if @options[:clean] 44 | git_clone_commands += "rm -fr #{bare_repo_path};\n" 45 | end 46 | 47 | git_clone_commands += %{ 48 | if [ ! -d #{bare_repo_path} ]; then 49 | git clone --quiet --bare #{Constants.repo_url_for_name(repo_name)} #{bare_repo_path} >/dev/null 50 | fi 51 | } 52 | 53 | sudo(env[:machine], "mkdir -p #{Constants.build_dir}") 54 | sudo(env[:machine], "mkdir -p #{Constants.build_dir + "builder"} && chown -R #{ssh_user}:#{ssh_group} #{Constants.build_dir}") 55 | do_execute env[:machine], git_clone_commands 56 | 57 | @app.call(env) 58 | end 59 | end 60 | end 61 | end 62 | end 63 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/create_ami.rb: -------------------------------------------------------------------------------- 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 | 18 | module Vagrant 19 | module Openshift 20 | module Action 21 | class CreateAMI 22 | include CommandHelper 23 | 24 | def initialize(app, env, options) 25 | @app = app 26 | @env = env 27 | @options = options 28 | end 29 | 30 | def call(env) 31 | raise VagrantPlugins::AWS::Errors::FogError, :message => "Error: EC2 Machine is not available" unless env[:machine].state.id == :running 32 | 33 | begin 34 | machine = env[:aws_compute].servers.get(env[:machine].id) 35 | image_req = env[:aws_compute].create_image(machine.identity, machine.tags["Name"], machine.tags["Name"], false) 36 | image = nil 37 | retries = 0 38 | while !image && retries < 12 39 | image = env[:aws_compute].images.get(image_req.body["imageId"]) 40 | if image 41 | break 42 | else 43 | retries += 1 44 | sleep 5 45 | end 46 | end 47 | env[:machine].ui.info "Creating AMI #{image.id}" 48 | retries = 0 49 | while retries < 90 50 | image = env[:aws_compute].images.get(image_req.body["imageId"]) 51 | if image.ready? 52 | break 53 | else 54 | retries += 1 55 | sleep 10 56 | end 57 | end 58 | env[:machine].ui.info("Done") 59 | rescue Excon::Errors::BadRequest => e 60 | doc = XMLSimple.xml_in(e.response.body) 61 | code = doc['Response']['Errors']['Error']['Code'][0] 62 | message = doc['Response']['Errors']['Error']['Message'][0] 63 | raise VagrantPlugins::AWS::Errors::FogError, :message => "#{message}. Code: #{code}" 64 | end 65 | @app.call(env) 66 | end 67 | end 68 | end 69 | end 70 | end 71 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/create_local_yum_repo.rb: -------------------------------------------------------------------------------- 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 CreateLocalYumRepo 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 @options[:rpmdir_loc] 31 | rpmdir_loc = @options[:rpmdir_loc] 32 | else 33 | rpmdir_loc = "#{Constants.build_dir}x86_64" 34 | end 35 | ssh_user = env[:machine].ssh_info[:username] 36 | 37 | sudo(env[:machine], %{ 38 | set -e 39 | 40 | sudo yum install -y createrepo 41 | sudo chmod -R og+w #{rpmdir_loc} /etc/yum.repos.d/ 42 | sudo createrepo #{rpmdir_loc} 43 | sudo printf "[origin_local]\nname=origin_local\nbaseurl=file://#{rpmdir_loc}\nenabled=1\ngpgcheck=0\n" > /etc/yum.repos.d/origin_local.repo 44 | sudo chmod -R og-w /etc/yum.repos.d/ 45 | sudo yum clean all 46 | sudo yum repolist all 47 | }) 48 | 49 | @app.call(env) 50 | end 51 | end 52 | end 53 | end 54 | end 55 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/create_yum_repositories.rb: -------------------------------------------------------------------------------- 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 CreateYumRepositories 21 | include CommandHelper 22 | 23 | def initialize(app, env) 24 | @app = app 25 | end 26 | 27 | def set_yum_repo(env, file, repo_name, baseurl) 28 | unless baseurl.nil? 29 | sudo(env[:machine], %{ 30 | ( 31 | echo "set /files#{file}/#{repo_name}/baseurl #{baseurl}" 32 | echo "set /files#{file}/#{repo_name}/gpgcheck 0" 33 | echo "set /files#{file}/#{repo_name}/name #{repo_name}" 34 | echo "rm /files#{file}/#{repo_name}/mirrorlist" 35 | echo save 36 | ) | augtool 37 | }) 38 | end 39 | end 40 | 41 | def call(env) 42 | options = env[:machine].config.openshift 43 | is_fedora = env[:machine].communicate.test("test -e /etc/fedora-release") 44 | is_centos = env[:machine].communicate.test("test -e /etc/centos-release") 45 | is_rhel = env[:machine].communicate.test("test -e /etc/redhat-release") && !is_centos && !is_fedora 46 | 47 | sudo(env[:machine], "yum -y install deltarpm", {fail_on_error: false}) 48 | sudo(env[:machine], "yum -y install augeas") 49 | 50 | if is_centos 51 | set_yum_repo(env, "/etc/yum.repos.d/openshift-deps.repo", "openshift-deps", "https://mirror.openshift.com/pub/openshift-v3/dependencies/centos7/x86_64/") 52 | end 53 | 54 | sudo(env[:machine], "yum clean all") 55 | 56 | unless is_fedora 57 | unless env[:machine].communicate.test("rpm -q epel-release") 58 | sudo(env[:machine], "yum install -y epel-release") 59 | 60 | #Workaround broken RHEL image which does not recover after restart. 61 | if "VagrantPlugins::AWS::Provider" == env[:machine].provider.class.to_s 62 | remote_write(env[:machine], "/etc/rc.local") { 63 | %{#!/bin/sh 64 | # 65 | # This script will be executed *after* all the other init scripts. 66 | # You can put your own initialization stuff in here if you don't 67 | # want to do the full Sys V style init stuff. 68 | 69 | touch /var/lock/subsys/local 70 | if [ ! -d /root/.ssh ] ; then 71 | mkdir -p /root/.ssh 72 | chmod 0700 /root/.ssh 73 | restorecon /root/.ssh 74 | fi 75 | 76 | # bz 707364 77 | if [ ! -f /etc/blkid/blkid.tab ] ; then 78 | blkid /dev/xvda &>/dev/null 79 | fi 80 | }} 81 | sudo env[:machine], "chmod og+x /etc/rc.local" 82 | end 83 | end 84 | end 85 | 86 | @app.call(env) 87 | end 88 | end 89 | end 90 | end 91 | end 92 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/download_artifacts_origin.rb: -------------------------------------------------------------------------------- 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 DownloadArtifactsOrigin 22 | include CommandHelper 23 | 24 | def initialize(app, env, options) 25 | @app = app 26 | @env = env 27 | @options = options.clone 28 | end 29 | 30 | def call(env) 31 | machine = @env[:machine] 32 | machine.ui.info "Downloading logs" 33 | ssh_info = machine.ssh_info 34 | private_key_path = ssh_info[:private_key_path].kind_of?(Array) ? ssh_info[:private_key_path][0] : ssh_info[:private_key_path] 35 | 36 | artifacts_dir = Pathname.new(File.expand_path(machine.env.root_path + "artifacts")) 37 | download_map = { 38 | "/var/log/yum.log" => artifacts_dir + "yum.log", 39 | "/var/log/secure" => artifacts_dir + "secure", 40 | "/var/log/audit/audit.log" => artifacts_dir + "audit.log", 41 | "/tmp/openshift/" => artifacts_dir 42 | } 43 | 44 | if @options[:download_release] 45 | download_map["/data/src/github.com/openshift/origin/_output/local/releases/"] = artifacts_dir + "release/" 46 | end 47 | 48 | download_map.each do |source,target| 49 | if ! machine.communicate.test("sudo ls #{source}") 50 | machine.ui.info "#{source} did not exist on the remote system. This is often the case for tests that were not run." 51 | next 52 | end 53 | 54 | machine.ui.info "Downloading artifacts from '#{source}' to '#{target}'" 55 | if target.to_s.end_with? '/' 56 | FileUtils.mkdir_p target.to_s 57 | else 58 | FileUtils.mkdir_p File.dirname(target.to_s) 59 | end 60 | 61 | command = "/usr/bin/rsync -az -e 'ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i #{private_key_path}' --rsync-path='sudo rsync' --exclude='volumes/*' --exclude='volumes/' #{ssh_info[:username]}@#{ssh_info[:host]}:#{source} #{target}" 62 | 63 | if not system(command) 64 | machine.ui.warn "Unable to download artifacts" 65 | end 66 | end 67 | @app.call(env) 68 | end 69 | end 70 | end 71 | end 72 | end 73 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/download_artifacts_origin_aggregated_logging.rb: -------------------------------------------------------------------------------- 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 DownloadArtifactsOriginAggregatedLogging 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 | "/tmp/origin-aggregated-logging/" => artifacts_dir, 41 | } 42 | 43 | download_map.each do |source,target| 44 | if ! machine.communicate.test("sudo ls #{source}") 45 | machine.ui.info "#{source} did not exist on the remote system. This is often the case for tests that were not run." 46 | next 47 | end 48 | 49 | machine.ui.info "Downloading artifacts from '#{source}' to '#{target}'" 50 | if target.to_s.end_with? '/' 51 | FileUtils.mkdir_p target.to_s 52 | else 53 | FileUtils.mkdir_p File.dirname(target.to_s) 54 | end 55 | 56 | command = "/usr/bin/rsync -az -e 'ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i #{private_key_path}' --rsync-path='sudo rsync' --exclude='volumes/*' --exclude='volumes/' #{ssh_info[:username]}@#{ssh_info[:host]}:#{source} #{target}" 57 | 58 | if not system(command) 59 | machine.ui.warn "Unable to download artifacts" 60 | end 61 | end 62 | @app.call(env) 63 | end 64 | end 65 | end 66 | end 67 | end 68 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/download_artifacts_origin_console.rb: -------------------------------------------------------------------------------- 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 DownloadArtifactsOriginConsole 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 any failure screenshots" 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 | 37 | _,_,exit_code = do_execute machine, "mkdir -p /tmp/openshift && journalctl -u openshift --no-pager > /tmp/openshift/openshift.log", :fail_on_error => false 38 | if exit_code != 0 39 | machine.ui.warn "Unable to dump openshift log from journalctl" 40 | end 41 | 42 | download_map = { 43 | "/var/log/yum.log" => artifacts_dir + "yum.log", 44 | "/var/log/secure" => artifacts_dir + "secure", 45 | "/var/log/audit/audit.log" => artifacts_dir + "audit.log", 46 | "/tmp/openshift/" => artifacts_dir, 47 | "/data/src/github.com/openshift/origin-web-console/test/tmp/screenshots/" => artifacts_dir + "screenshots/" 48 | } 49 | 50 | download_map.each do |source,target| 51 | if ! machine.communicate.test("sudo ls #{source}") 52 | machine.ui.info "#{source} did not exist on the remote system. This is often the case for tests that were not run." 53 | next 54 | end 55 | 56 | machine.ui.info "Downloading artifacts from '#{source}' to '#{target}'" 57 | if target.to_s.end_with? '/' 58 | FileUtils.mkdir_p target.to_s 59 | else 60 | FileUtils.mkdir_p File.dirname(target.to_s) 61 | end 62 | 63 | command = "/usr/bin/rsync -az -e 'ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i #{private_key_path}' --rsync-path='sudo rsync' --exclude='volumes/*' --exclude='volumes/' #{ssh_info[:username]}@#{ssh_info[:host]}:#{source} #{target}" 64 | 65 | if not system(command) 66 | machine.ui.warn "Unable to download artifacts" 67 | end 68 | end 69 | @app.call(env) 70 | end 71 | end 72 | end 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/download_artifacts_origin_metrics.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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 DownloadArtifactsOriginMetrics 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 | "/tmp/origin-metrics/" => artifacts_dir, 41 | } 42 | 43 | download_map.each do |source,target| 44 | if ! machine.communicate.test("sudo ls #{source}") 45 | machine.ui.info "#{source} did not exist on the remote system. This is often the case for tests that were not run." 46 | next 47 | end 48 | 49 | machine.ui.info "Downloading artifacts from '#{source}' to '#{target}'" 50 | if target.to_s.end_with? '/' 51 | FileUtils.mkdir_p target.to_s 52 | else 53 | FileUtils.mkdir_p File.dirname(target.to_s) 54 | end 55 | 56 | command = "/usr/bin/rsync -az -e 'ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i #{private_key_path}' --rsync-path='sudo rsync' --exclude='volumes/*' --exclude='volumes/' #{ssh_info[:username]}@#{ssh_info[:host]}:#{source} #{target}" 57 | 58 | if not system(command) 59 | machine.ui.warn "Unable to download artifacts" 60 | end 61 | end 62 | @app.call(env) 63 | end 64 | end 65 | end 66 | end 67 | end 68 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/download_artifacts_sti.rb: -------------------------------------------------------------------------------- 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 DownloadArtifactsSti 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 | "/tmp/sti/" => artifacts_dir + "sti/" 38 | } 39 | 40 | if !is_windows?(machine) 41 | download_map.merge!({ 42 | "/var/log/yum.log" => artifacts_dir + "yum.log", 43 | "/var/log/secure" => artifacts_dir + "secure", 44 | "/var/log/audit/audit.log" => artifacts_dir + "audit.log" 45 | }) 46 | end 47 | 48 | download_map.each do |source,target| 49 | machine.ui.info "Downloading artifacts from '#{source}' to '#{target}'" 50 | if target.to_s.end_with? '/' 51 | FileUtils.mkdir_p target.to_s 52 | else 53 | FileUtils.mkdir_p File.dirname(target.to_s) 54 | end 55 | 56 | command = "/usr/bin/rsync -az -e 'ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i #{private_key_path}' --rsync-path='sudo rsync' #{ssh_info[:username]}@#{ssh_info[:host]}:#{source} #{target}" 57 | 58 | if not system(command) 59 | machine.ui.warn "Unable to download artifacts" 60 | end 61 | end 62 | @app.call(env) 63 | end 64 | end 65 | end 66 | end 67 | end 68 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/install_docker.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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 InstallDocker 21 | include CommandHelper 22 | include InstallHelper 23 | 24 | def initialize(app, env, options) 25 | @app = app 26 | @env = env 27 | @options = options.clone 28 | end 29 | 30 | def call(env) 31 | # Migrate our install script to the host machine 32 | ssh_user = @env[:machine].ssh_info[:username] 33 | destination="/home/#{ssh_user}/" 34 | @env[:machine].communicate.upload(File.join(__dir__,"/../resources/configure_docker.sh"), destination) 35 | home="#{destination}/resources" 36 | 37 | isolated_install( 38 | @env[:machine], 39 | 'docker', 40 | @options[:"docker.version"], 41 | @options[:"docker.repourls"], 42 | @options[:"docker.reponames"], 43 | @options[:force] 44 | ) 45 | 46 | # Configure the Docker daemon 47 | sudo(@env[:machine], "SSH_USER='#{ssh_user}' #{home}/configure_docker.sh", :timeout=>60*30) 48 | 49 | @app.call(@env) 50 | end 51 | end 52 | end 53 | end 54 | end -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/install_golang.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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 InstallGolang 21 | include CommandHelper 22 | include InstallHelper 23 | 24 | def initialize(app, env, options) 25 | @app = app 26 | @env = env 27 | @options = options.clone 28 | end 29 | 30 | def call(env) 31 | isolated_install( 32 | @env[:machine], 33 | 'golang', 34 | @options[:"golang.version"], 35 | @options[:"golang.repourls"], 36 | @options[:"golang.reponames"], 37 | @options[:force] 38 | ) 39 | 40 | if @options[:"golang.version"] =~ %r"^1\.4.*" && ! env[:machine].communicate.test("test -e /etc/fedora-release") 41 | # Prior to go1.5, the cgo symbol tables were not provided in the base golang 42 | # package on RHEL and CentOS, so if we've installed go1.4.x and we're not on 43 | # Fedora, we need to also install `golang-pkg-linux-amd64' 44 | sudo(@env[:machine], "yum install -y #{format_versioned_package("golang-pkg-linux-amd64", @options[:"golang.version"])}", :timeout=>60*5) 45 | end 46 | 47 | @app.call(@env) 48 | end 49 | end 50 | end 51 | end 52 | end -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/install_origin.rb: -------------------------------------------------------------------------------- 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 InstallOrigin 21 | include CommandHelper 22 | def initialize(app, env) 23 | @app = app 24 | @env = env 25 | end 26 | 27 | def call(env) 28 | ssh_user = env[:machine].ssh_info[:username] 29 | sudo(env[:machine], %{ 30 | set -ex 31 | 32 | #systemctl enable firewalld 33 | #systemctl start firewalld 34 | #firewall-cmd --permanent --zone=public --add-port=8443/tcp 35 | #firewall-cmd --permanent --zone=public --add-port=8444/tcp 36 | #firewall-cmd --reload 37 | #firewall-cmd --list-all 38 | 39 | 40 | ORIGIN_PATH=/data/src/github.com/openshift/origin 41 | cat > /etc/profile.d/openshift.sh < /etc/sysconfig/openshift < /usr/bin/generate_openshift_service </dev/null | xargs echo -n\\` 62 | if [ -z "\\$HOST" ] 63 | then 64 | HOST=\\`ip -f inet addr show | grep -Po 'inet \\K[\\d.]+' | grep 10.245 | head -1\\` 65 | if [ -z "\\$HOST" ] 66 | then 67 | HOST=localhost 68 | fi 69 | fi 70 | 71 | echo Host: \\$HOST 72 | 73 | cat > /usr/lib/systemd/system/openshift.service < false) 99 | 100 | do_execute(env[:machine], %{ 101 | pushd /data/src/github.com/openshift/origin 102 | hack/install-etcd.sh 103 | popd 104 | }, :verbose => false) 105 | 106 | @app.call(env) 107 | end 108 | end 109 | end 110 | end 111 | end 112 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/install_origin_asset_dependencies.rb: -------------------------------------------------------------------------------- 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 InstallOriginAssetDependencies 21 | include CommandHelper 22 | 23 | def initialize(app, env, options) 24 | @app = app 25 | @env = env 26 | @options = options.clone 27 | end 28 | 29 | def call(env) 30 | cmd = %{ 31 | set -ex 32 | 33 | ORIGIN_CONSOLE_PATH=/data/src/github.com/openshift/origin-web-console 34 | ASSET_BACKUP_DIR=/data/asset_dependencies 35 | 36 | if ! which npm > /dev/null 2>&1 ; then 37 | sudo yum -y install npm 38 | if $(test -e /etc/fedora-release) 39 | then 40 | # Update npm, we need a newer version than is installed by yum 41 | sudo npm install npm@3.7.3 -g 42 | fi 43 | fi 44 | 45 | } 46 | if @options[:restore_assets] 47 | cmd += %{ 48 | # make sure the dirs always exist 49 | mkdir -p /data/asset_dependencies/node_modules 50 | mkdir -p /data/asset_dependencies/bower_components 51 | # copy them to the console repo 52 | cp -rf $ASSET_BACKUP_DIR/node_modules $ORIGIN_CONSOLE_PATH/node_modules 53 | cp -rf $ASSET_BACKUP_DIR/bower_components $ORIGIN_CONSOLE_PATH/bower_components 54 | 55 | } 56 | end 57 | 58 | cmd += %{ 59 | pushd $ORIGIN_CONSOLE_PATH 60 | hack/install-deps.sh 61 | popd 62 | 63 | } 64 | 65 | if @options[:backup_assets] 66 | cmd += %{ 67 | # Make sure tests pass before backing up this asset install 68 | pushd $ORIGIN_CONSOLE_PATH 69 | hack/test-headless.sh test 70 | popd 71 | mkdir -p $ASSET_BACKUP_DIR 72 | cp -rf $ORIGIN_CONSOLE_PATH/node_modules $ASSET_BACKUP_DIR/node_modules 73 | cp -rf $ORIGIN_CONSOLE_PATH/bower_components $ASSET_BACKUP_DIR/bower_components 74 | } 75 | end 76 | 77 | do_execute(env[:machine], cmd, :verbose => false, :timeout=>60*60*2) 78 | @app.call(env) 79 | end 80 | end 81 | end 82 | end 83 | end 84 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/install_origin_base_dependencies.rb: -------------------------------------------------------------------------------- 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 InstallOriginBaseDependencies 21 | include CommandHelper 22 | 23 | def initialize(app, env) 24 | @app = app 25 | @env = env 26 | end 27 | 28 | def call(env) 29 | # Migrate all of our scripts to the host machine 30 | ssh_user = @env[:machine].ssh_info[:username] 31 | destination="/home/#{ssh_user}/" 32 | @env[:machine].communicate.upload(File.join(__dir__,"/../resources"), destination) 33 | home="#{destination}/resources" 34 | 35 | # Workaround to vagrant inability to guess interface naming sequence: 36 | # Tell system to abandon the new naming scheme and use eth* instead if 37 | # we're communicating with a Fedora machine 38 | sudo(@env[:machine], "#{home}/reconfigure_network_fedora.sh") 39 | 40 | # Install base dependencies that we cannot continue without 41 | sudo(@env[:machine], "#{home}/install_dependencies.sh", :timeout=>60*30) 42 | 43 | # Install dependencies that are nice to have but we can live without 44 | sudo(@env[:machine], "#{home}/install_nonessential.sh", :timeout=>60*20, fail_on_error: false) 45 | 46 | # Install Chrome and chromedriver for headless UI testing 47 | sudo(@env[:machine], "#{home}/install_chrome.sh", :timeout=>60*60) 48 | 49 | # If we're on RHEL, install the OSE RPM repositories 50 | is_rhel = @env[:machine].communicate.test("test -e /etc/redhat-release && ! test -e /etc/fedora-release && ! test -e /etc/centos-release") 51 | if is_rhel 52 | sudo(@env[:machine], "#{home}/install_rhaos_repos.sh") 53 | end 54 | 55 | # Configure the machine system 56 | sudo(@env[:machine], "SSH_USER='#{ssh_user}' #{home}/configure_system.sh", :timeout=>60*30) 57 | 58 | @app.call(@env) 59 | end 60 | end 61 | end 62 | end 63 | end -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/install_origin_rhel7.rb: -------------------------------------------------------------------------------- 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 InstallOriginRhel7 21 | include CommandHelper 22 | def initialize(app, env) 23 | @app = app 24 | @env = env 25 | end 26 | 27 | def call(env) 28 | is_fedora = env[:machine].communicate.test("test -e /etc/fedora-release") 29 | is_centos = env[:machine].communicate.test("test -e /etc/centos-release") 30 | is_rhel = env[:machine].communicate.test("test -e /etc/redhat-release") && !is_centos && !is_fedora 31 | if is_rhel 32 | ssh_user = env[:machine].ssh_info[:username] 33 | sudo(env[:machine], %{ 34 | set -ex 35 | 36 | # inside temporary directory create docker build context for the new base image 37 | contextdir=$(mktemp -d) 38 | 39 | # copy the necessary files 40 | mkdir $contextdir/{certs,repos,vars,keys} 41 | cp /var/lib/yum/*.pem $contextdir/certs 42 | cp /etc/yum/vars/* $contextdir/vars 43 | cp /etc/yum.repos.d/* $contextdir/repos 44 | cp /etc/pki/rpm-gpg/* $contextdir/keys 45 | 46 | # Remove repositories we won't be needing and which require RH certs 47 | rm -rf $contextdir/repos/redhat-rhui* 48 | 49 | # remove google chrome repo 50 | rm -rf $contextdir/repos/*chrome*.repo 51 | 52 | # remove local openshift epel mirror - we will only temporarily mount this via imagebuilder during image builds 53 | rm -rf $contextdir/repos/local_epel.repo 54 | 55 | # create Dockerfile 56 | cat < $contextdir/Dockerfile 57 | FROM registry.access.redhat.com/rhel7.1:latest 58 | 59 | RUN yum remove -y subscription-manager 60 | 61 | ADD vars/* /etc/yum/vars/ 62 | ADD repos/* /etc/yum.repos.d/ 63 | ADD certs/* /var/lib/yum/ 64 | ADD keys/* /etc/pki/rpm-gpg/ 65 | 66 | # we're picking up 7.2 packages in our 7.1 image and these two conflict, so 67 | # first replace the 7.1 package with the new 7.2 package so later updates/dep 68 | # installations don't fail. 69 | RUN yum swap -y -- remove systemd-container\* -- install systemd systemd-libs 70 | 71 | RUN yum update -y && yum clean all 72 | 73 | EOF 74 | 75 | docker build --rm -t rhel7.1 $contextdir 76 | 77 | # create Dockerfile 78 | cat < $contextdir/Dockerfile 79 | FROM registry.access.redhat.com/rhel7.2:latest 80 | 81 | RUN yum remove -y subscription-manager 82 | 83 | ADD vars/* /etc/yum/vars/ 84 | ADD repos/* /etc/yum.repos.d/ 85 | ADD certs/* /var/lib/yum/ 86 | ADD keys/* /etc/pki/rpm-gpg/ 87 | 88 | RUN yum update -y && yum clean all 89 | 90 | EOF 91 | 92 | docker build --rm -t rhel7.2 $contextdir 93 | 94 | # make sure the new rhel7.2 image has valid certs 95 | docker run rhel7.2 yum install -y tar 96 | 97 | # create Dockerfile 98 | cat < $contextdir/Dockerfile 99 | FROM registry.access.redhat.com/rhel7.3:latest 100 | 101 | RUN yum remove -y subscription-manager 102 | 103 | ADD vars/* /etc/yum/vars/ 104 | ADD repos/* /etc/yum.repos.d/ 105 | ADD certs/* /var/lib/yum/ 106 | ADD keys/* /etc/pki/rpm-gpg/ 107 | 108 | RUN yum update -y && yum clean all 109 | 110 | EOF 111 | 112 | docker build --rm -t rhel7.3 $contextdir 113 | 114 | # make sure the new rhel7.3 image has valid certs 115 | docker run rhel7.3 yum install -y tar 116 | 117 | docker tag rhel7.3 rhel7 118 | 119 | # cleaning 120 | rm -rf $contextdir 121 | }) 122 | end 123 | @app.call(env) 124 | end 125 | end 126 | end 127 | end 128 | end 129 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/local_origin_checkout.rb: -------------------------------------------------------------------------------- 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 LocalOriginCheckout 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 | puts "You don't seem to have the GOPATH environment variable set on your system." 32 | puts "See: 'go help gopath' for more details about GOPATH." 33 | go_path = '.' 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 | commands += repo_checkout_bash_command(@options[:repo], Constants.repo_url_for_name(@options[:repo])) 42 | 43 | system(commands) 44 | puts "Origin repositories cloned into #{Dir.pwd}" 45 | end 46 | 47 | @app.call(env) 48 | end 49 | end 50 | end 51 | end 52 | end 53 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/modify_ami.rb: -------------------------------------------------------------------------------- 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 55 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/modify_instance.rb: -------------------------------------------------------------------------------- 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 72 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/prepare_ssh_config.rb: -------------------------------------------------------------------------------- 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 | 37 | vagrant_openshift_ssh_override_path = Constants.git_ssh 38 | vagrant_openshift_ssh_override_str = "/usr/bin/ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PasswordAuthentication=no -i #{ssh_id_file} $@" 39 | File.open(vagrant_openshift_ssh_override_path.to_s, "w") do |file| 40 | file.write(vagrant_openshift_ssh_override_str) 41 | end 42 | FileUtils.chmod(0744, vagrant_openshift_ssh_override_path.to_s) 43 | 44 | home_dir=File.join(ENV['HOME'], '.openshiftdev/home.d') 45 | if File.exists?(home_dir) 46 | Dir.glob(File.join(home_dir, '???*'), File::FNM_DOTMATCH).each {|file| 47 | puts "Installing ~/#{File.basename(file)}" 48 | puts "#{ssh_id_file} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null #{file} #{ssh_user}@#{ssh_host}:#{ssh_port}" 49 | system "scp -P #{ssh_port} -i #{ssh_id_file} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null #{file} #{ssh_user}@#{ssh_host}:~" 50 | } 51 | end 52 | 53 | @app.call(env) 54 | end 55 | end 56 | end 57 | end 58 | end 59 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/push_openshift_release.rb: -------------------------------------------------------------------------------- 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 PushOpenshiftRelease 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 | registry_name = @options[:registry_name] 31 | push_base = !!@options[:push_base_images] 32 | env[:machine].config.ssh.pty = true 33 | do_execute(env[:machine], %{ 34 | echo "Pushing release images" 35 | set -e 36 | pushd /data/src/github.com/openshift/origin 37 | OS_PUSH_BASE_IMAGES="#{push_base ? 'true' : ''}" OS_PUSH_BASE_REGISTRY="#{registry_name}" hack/push-release.sh 38 | popd 39 | }, 40 | { :timeout => 60*30, :verbose => false }) 41 | @app.call(env) 42 | end 43 | 44 | end 45 | end 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/run_customer_diagnostics_tests.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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 RunCustomerDiagnosticsTests 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 run_tests(env, cmds, as_root=true) 32 | tests = '' 33 | cmds.each do |cmd| 34 | tests += " 35 | echo '***************************************************' 36 | echo 'Running #{cmd}...' 37 | time #{cmd} 38 | echo 'Finished #{cmd}' 39 | echo '***************************************************' 40 | " 41 | end 42 | cmd = %{ 43 | set -e 44 | pushd #{Constants.build_dir}/openshift-ansible/ >/dev/null 45 | export PATH=$GOPATH/bin:$PATH 46 | #{tests} 47 | popd >/dev/null 48 | } 49 | exit_code = 0 50 | if as_root 51 | _,_,exit_code = sudo(env[:machine], cmd, {:timeout => 60*60*4, :fail_on_error => false, :verbose => false}) 52 | else 53 | _,_,exit_code = do_execute(env[:machine], cmd, {:timeout => 60*60*4, :fail_on_error => false, :verbose => false}) 54 | end 55 | exit_code 56 | end 57 | 58 | # 59 | # All env vars will be added to the beginning of the command like VAR=1 make test 60 | # 61 | def call(env) 62 | @options.delete :logs 63 | 64 | cmd_env = [] 65 | 66 | if @options[:envs] 67 | cmd_env += @options[:envs] 68 | end 69 | 70 | cmd_env << "make #{@options[:target]}" 71 | cmd = cmd_env.join(' ') 72 | env[:test_exit_code] = run_tests(env, [cmd], @options[:root]) 73 | 74 | @app.call(env) 75 | end 76 | end 77 | end 78 | end 79 | end 80 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/run_origin_aggregated_logging_tests.rb: -------------------------------------------------------------------------------- 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 RunOriginAggregatedLoggingTests 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 run_tests(env, cmds, as_root=true) 32 | tests = '' 33 | cmds.each do |cmd| 34 | tests += " 35 | echo '***************************************************' 36 | echo 'Running #{cmd}...' 37 | time #{cmd} 38 | echo 'Finished #{cmd}' 39 | echo '***************************************************' 40 | " 41 | end 42 | cmd = %{ 43 | set -e 44 | pushd #{Constants.build_dir}/origin-aggregated-logging/hack/testing >/dev/null 45 | export PATH=$GOPATH/bin:$PATH 46 | #{tests} 47 | popd >/dev/null 48 | } 49 | exit_code = 0 50 | if as_root 51 | _,_,exit_code = sudo(env[:machine], cmd, {:timeout => 60*60*4, :fail_on_error => false, :verbose => false}) 52 | else 53 | _,_,exit_code = do_execute(env[:machine], cmd, {:timeout => 60*60*4, :fail_on_error => false, :verbose => false}) 54 | end 55 | exit_code 56 | end 57 | 58 | # 59 | # Build and run the make commands 60 | # for testing all run make test 61 | # for testing unit tests only run make build check 62 | # for testing assets run hack/test-assets.sh 63 | # 64 | # All env vars will be added to the beginning of the command like VAR=1 make test 65 | # 66 | def call(env) 67 | @options.delete :logs 68 | 69 | cmd_env = [] 70 | 71 | if @options[:envs] 72 | cmd_env += @options[:envs] 73 | end 74 | 75 | if @options[:image_registry] 76 | cmd_env << "OPENSHIFT_TEST_IMAGE_REGISTRY=#{@options[:image_registry]}" 77 | end 78 | 79 | cmd_env << './logging.sh' 80 | cmd = cmd_env.join(' ') 81 | env[:test_exit_code] = run_tests(env, [cmd], @options[:root]) 82 | 83 | @app.call(env) 84 | end 85 | end 86 | end 87 | end 88 | end 89 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/run_origin_asset_tests.rb: -------------------------------------------------------------------------------- 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 RunOriginAssetTests 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 run_tests(env, cmds, as_root=true) 32 | tests = '' 33 | cmds.each do |cmd| 34 | tests += " 35 | echo '***************************************************' 36 | echo 'Running #{cmd}...' 37 | time #{cmd} 38 | echo 'Finished #{cmd}' 39 | echo '***************************************************' 40 | " 41 | end 42 | cmd = %{ 43 | set -e 44 | pushd #{Constants.build_dir}/origin-web-console >/dev/null 45 | export PATH=$GOPATH/bin:$PATH 46 | #{tests} 47 | popd >/dev/null 48 | } 49 | exit_code = 0 50 | if as_root 51 | _,_,exit_code = sudo(env[:machine], cmd, {:timeout => 60*60*4, :fail_on_error => false, :verbose => false}) 52 | else 53 | _,_,exit_code = do_execute(env[:machine], cmd, {:timeout => 60*60*4, :fail_on_error => false, :verbose => false}) 54 | end 55 | exit_code 56 | end 57 | 58 | # 59 | # All env vars will be added to the beginning of the commands 60 | # 61 | def call(env) 62 | @options.delete :logs 63 | 64 | cmds = [] 65 | 66 | if @options[:envs] 67 | cmds += @options[:envs] 68 | end 69 | 70 | cmds << 'make test -o build' 71 | cmd = cmds.join(' ') 72 | env[:test_exit_code] = run_tests(env, cmds, @options[:root]) 73 | 74 | @app.call(env) 75 | end 76 | 77 | end 78 | end 79 | end 80 | end 81 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/run_origin_metrics_tests.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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 RunOriginMetricsTests 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 run_tests(env, cmds, as_root=true) 32 | tests = '' 33 | cmds.each do |cmd| 34 | tests += " 35 | echo '***************************************************' 36 | echo 'Running #{cmd}...' 37 | time #{cmd} 38 | echo 'Finished #{cmd}' 39 | echo '***************************************************' 40 | " 41 | end 42 | cmd = %{ 43 | set -e 44 | pushd #{Constants.build_dir}/origin-metrics/hack/tests >/dev/null 45 | export PATH=$GOPATH/bin:$PATH 46 | #{tests} 47 | popd >/dev/null 48 | } 49 | exit_code = 0 50 | if as_root 51 | _,_,exit_code = sudo(env[:machine], cmd, {:timeout => 60*60*4, :fail_on_error => false, :verbose => false}) 52 | else 53 | _,_,exit_code = do_execute(env[:machine], cmd, {:timeout => 60*60*4, :fail_on_error => false, :verbose => false}) 54 | end 55 | exit_code 56 | end 57 | 58 | # 59 | # All env vars will be added to the beginning of the command like VAR=1 make test 60 | # 61 | def call(env) 62 | @options.delete :logs 63 | 64 | cmd_env = [] 65 | 66 | if @options[:envs] 67 | cmd_env += @options[:envs] 68 | end 69 | 70 | if @options[:image_registry] 71 | cmd_env << "OPENSHIFT_TEST_IMAGE_REGISTRY=#{@options[:image_registry]}" 72 | end 73 | 74 | cmd_env << './ci_test_every_pr.sh' 75 | cmd = cmd_env.join(' ') 76 | env[:test_exit_code] = run_tests(env, [cmd], @options[:root]) 77 | 78 | @app.call(env) 79 | end 80 | end 81 | end 82 | end 83 | end 84 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/run_sti_tests.rb: -------------------------------------------------------------------------------- 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 RunStiTests 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 | cmds = ['OUTPUT_COVERAGE=/tmp/sti/artifacts/coverage hack/test-go.sh'] 35 | 36 | if @options[:all] 37 | cmds << 'hack/test-integration.sh' 38 | cmds << 'hack/test-stirunimage.sh' 39 | end 40 | 41 | tests = '' 42 | cmds.each do |cmd| 43 | tests += " 44 | echo '***************************************************' 45 | echo 'Running #{cmd}...' 46 | time #{cmd} 47 | echo 'Finished #{cmd}' 48 | echo '***************************************************' 49 | " 50 | end 51 | 52 | # TODO: the PATH export below should be removed once 53 | # https://github.com/openshift/source-to-image/pull/625 merges. 54 | _,_,env[:test_exit_code] = sudo(env[:machine], %{ 55 | set -e 56 | pushd #{Constants.build_dir}/source-to-image >/dev/null 57 | export PATH=/data/src/github.com/openshift/source-to-image/_output/local/go/bin:/data/src/github.com/openshift/source-to-image/_output/local/bin/linux/amd64:$PATH 58 | #{tests} 59 | popd >/dev/null 60 | }, {:timeout => 60*60, :fail_on_error => false, :verbose => false}) 61 | 62 | @app.call(env) 63 | end 64 | end 65 | end 66 | end 67 | end 68 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/run_systemctl.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2013-2015 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 RunSystemctl 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 | unless @options[:action].nil? || @options[:service].nil? 31 | sudo(env[:machine], "systemctl #{@options[:action]} #{@options[:service]} #{@options[:argv]}") 32 | @app.call(env) 33 | end 34 | end 35 | end 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/set_host_name.rb: -------------------------------------------------------------------------------- 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", :verbose => false) 37 | 38 | @app.call(env) 39 | end 40 | end 41 | end 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/test_exit_code.rb: -------------------------------------------------------------------------------- 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 TestExitCode 21 | include CommandHelper 22 | 23 | def initialize(app, env) 24 | @app = app 25 | @env = env 26 | end 27 | 28 | def call(env) 29 | exit(env[:test_exit_code]) if env.has_key? :test_exit_code 30 | 31 | @app.call(env) 32 | end 33 | end 34 | end 35 | end 36 | end -------------------------------------------------------------------------------- /lib/vagrant-openshift/action/yum_update.rb: -------------------------------------------------------------------------------- 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 YumUpdate 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], "rm -rf /etc/yum.repos.d/openshift-origin.repo" 30 | sudo env[:machine], "yum clean all" 31 | sudo env[:machine], "yum -y update --exclude=kernel*", {fail_on_error: false, :timeout=>60*30} 32 | sudo env[:machine], "yum list installed" 33 | 34 | env[:machine].ui.warn "Increasing YUM cache timeout to 9999999. You will need manually clear cache to get additional updates." 35 | remote_write(env[:machine], "/etc/yum.conf") { 36 | %{ 37 | [main] 38 | cachedir=/var/cache/yum/$basearch/$releasever 39 | keepcache=0 40 | debuglevel=2 41 | logfile=/var/log/yum.log 42 | exactarch=1 43 | obsoletes=1 44 | gpgcheck=0 45 | plugins=1 46 | installonly_limit=3 47 | retries=20 48 | timeout=120 49 | 50 | 51 | 52 | # This is the default, if you make this bigger yum won't see if the metadata 53 | # is newer on the remote and so you'll "gain" the bandwidth of not having to 54 | # download the new metadata and "pay" for it by yum not having correct 55 | # information. 56 | # It is esp. important, to have correct metadata, for distributions like 57 | # Fedora which don't keep old packages around. If you don't like this checking 58 | # interrupting your command line usage, it's much better to have something 59 | # manually check the metadata once an hour (yum-updatesd will do this). 60 | metadata_expire=9999999 61 | 62 | # PUT YOUR REPOS HERE OR IN separate files named file.repo 63 | # in /etc/yum.repos.d 64 | } 65 | } 66 | 67 | @app.call(env) 68 | end 69 | end 70 | end 71 | end 72 | end 73 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/aws.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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 | require "pathname" 18 | require "fog" 19 | 20 | module Vagrant 21 | module Openshift 22 | class AWSCredentialsNotConfiguredError < RuntimeError 23 | def initialize(msg="AWS credentials not configured") 24 | super 25 | end 26 | end 27 | 28 | class AWS 29 | def self.aws_creds(ui) 30 | aws_creds_file = ENV["AWS_CREDS"].nil? || ENV["AWS_CREDS"] == "" ? "~/.awscred" : ENV["AWS_CREDS"] 31 | aws_creds_file = Pathname.new(File.expand_path(aws_creds_file)) 32 | ui.info("Reading AWS credentials from #{aws_creds_file.to_s}") 33 | 34 | raise AWSCredentialsNotConfiguredError if !aws_creds_file.exist? 35 | 36 | return Hash[*(aws_creds_file.open.readlines.map{|l| l.strip.split("=")}.flatten)] 37 | end 38 | 39 | def self.fog_config(aws_creds, region="us-east-1") 40 | { 41 | :provider => :aws, 42 | :aws_access_key_id => aws_creds["AWSAccessKeyId"], 43 | :aws_secret_access_key => aws_creds["AWSSecretKey"], 44 | :region => region 45 | } 46 | end 47 | 48 | def self.find_ami_from_tag(ui, compute, ami_tag_prefix, required_name_tag=nil) 49 | ui.info("Searching #{ami_tag_prefix}* for latest base AMI (required_name_tag=#{required_name_tag})") 50 | image_filter = {"Owner" => "self", "name" => "#{ami_tag_prefix}*", "state" => "available"} 51 | image_filter["tag:Name"] = required_name_tag unless required_name_tag.nil? 52 | images = compute.images.all(image_filter) 53 | latest_image = images.sort_by{|i| i.name.split("_")[-1].to_i}.last 54 | if !latest_image.nil? 55 | ui.info("Found: #{latest_image.id} (#{latest_image.name})") 56 | return latest_image.id 57 | end 58 | 59 | nil 60 | end 61 | end 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/build_atomic_host.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class BuildAtomicHost < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "Upgrade the atomic host to the latest OStree" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:clean] = false 31 | 32 | opts = OptionParser.new do |o| 33 | o.banner = "Usage: vagrant build-atomic-host [vm-name]" 34 | o.separator "" 35 | end 36 | 37 | # Parse the options 38 | argv = parse_options(opts) 39 | return if !argv 40 | 41 | with_target_vms(argv, :reverse => true) do |machine| 42 | actions = Vagrant::Openshift::Action.build_atomic_host(options) 43 | @env.action_runner.run actions, {:machine => machine} 44 | 0 45 | end 46 | end 47 | end 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/build_origin.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class BuildOrigin < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "builds origin" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:clean] = false 31 | options[:images] = false 32 | options[:force] = false 33 | 34 | opts = OptionParser.new do |o| 35 | o.banner = "Usage: vagrant build-origin [vm-name]" 36 | o.separator "" 37 | 38 | o.on("--images", "Build the images as well as core content.") do |c| 39 | options[:images] = true 40 | end 41 | o.on("--force", "Build regardless of whether there have been changes.") do |c| 42 | options[:force] = true 43 | end 44 | end 45 | 46 | # Parse the options 47 | argv = parse_options(opts) 48 | return if !argv 49 | 50 | with_target_vms(argv, :reverse => true) do |machine| 51 | actions = Vagrant::Openshift::Action.build_origin(options) 52 | @env.action_runner.run actions, {:machine => machine} 53 | 0 54 | end 55 | end 56 | end 57 | end 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/build_origin_base.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class BuildOriginBase < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "install the prereqs for origin" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:clean] = false 31 | 32 | opts = OptionParser.new do |o| 33 | o.banner = "Usage: vagrant build-origin-base [vm-name]" 34 | o.separator "" 35 | end 36 | 37 | # Parse the options 38 | argv = parse_options(opts) 39 | return if !argv 40 | 41 | with_target_vms(argv, :reverse => true) do |machine| 42 | actions = Vagrant::Openshift::Action.build_origin_base(options) 43 | @env.action_runner.run actions, {:machine => machine} 44 | 0 45 | end 46 | end 47 | end 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/build_origin_base_images.rb: -------------------------------------------------------------------------------- 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 | require_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class BuildOriginBaseImages < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "builds origin infrastructure images" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:clean] = false 31 | 32 | opts = OptionParser.new do |o| 33 | o.banner = "Usage: vagrant build-origin-base-images" 34 | o.separator "" 35 | end 36 | 37 | # Parse the options 38 | argv = parse_options(opts) 39 | return if !argv 40 | 41 | with_target_vms(argv, :reverse => true) do |machine| 42 | actions = Vagrant::Openshift::Action.build_origin_base_images(options) 43 | @env.action_runner.run actions, {:machine => machine} 44 | 0 45 | end 46 | end 47 | end 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/build_origin_images.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class BuildOriginImages < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "Build origin Dockerfiles from local generated RPMs" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:clean] = false 31 | 32 | opts = OptionParser.new do |o| 33 | o.banner = "Usage: vagrant build-origin-images [vm-name]" 34 | o.on("--images [list]", String, "List of images delimited by ','") do |i| 35 | options[:images] = i 36 | end 37 | o.separator "" 38 | end 39 | 40 | # Parse the options 41 | argv = parse_options(opts) 42 | return if !argv 43 | 44 | if options[:images].nil? 45 | @env.ui.warn "You must specify list of images to build, delimited by ','" 46 | exit 47 | end 48 | 49 | with_target_vms(argv, :reverse => true) do |machine| 50 | actions = Vagrant::Openshift::Action.build_origin_images(options) 51 | @env.action_runner.run actions, {:machine => machine} 52 | 0 53 | end 54 | end 55 | end 56 | end 57 | end 58 | end 59 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/build_origin_rpm_test.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class BuildOriginRpmTest < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "Build origin RPM with tito and test" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:clean] = false 31 | 32 | opts = OptionParser.new do |o| 33 | o.banner = "Usage: vagrant build-origin-rpm-test [vm-name]" 34 | o.separator "" 35 | end 36 | 37 | # Parse the options 38 | argv = parse_options(opts) 39 | return if !argv 40 | 41 | with_target_vms(argv, :reverse => true) do |machine| 42 | actions = Vagrant::Openshift::Action.build_origin_rpm_test(options) 43 | @env.action_runner.run actions, {:machine => machine} 44 | 0 45 | end 46 | end 47 | end 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/build_sti.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class BuildSti < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "builds source-to-image" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:clean] = false 31 | 32 | opts = OptionParser.new do |o| 33 | o.banner = "Usage: vagrant build-sti [vm-name]" 34 | o.separator "" 35 | 36 | o.on("--force", "Build regardless of whether there have been changes.") do |c| 37 | options[:force] = true 38 | end 39 | o.on("--binary-only", "Only build the sti binary, no test images") do |c| 40 | options[:binary_only] = true 41 | end 42 | end 43 | 44 | # Parse the options 45 | argv = parse_options(opts) 46 | return if !argv 47 | 48 | with_target_vms(argv, :reverse => true) do |machine| 49 | actions = Vagrant::Openshift::Action.build_sti(options) 50 | @env.action_runner.run actions, {:machine => machine} 51 | 0 52 | end 53 | end 54 | end 55 | end 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/build_sti_base_windows.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class BuildStiBaseWindows < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "install the prereqs for source-to-image on Windows" 26 | end 27 | 28 | def execute 29 | options = { 30 | :ami_prefix => ENV["USER"], 31 | :flavor_id => "m4.large", 32 | :instance_prefix => ENV["USER"] 33 | } 34 | 35 | opts = OptionParser.new do |o| 36 | o.banner = "Usage: vagrant build-sti-base-windows subnet_id" 37 | o.separator "" 38 | 39 | o.on("--ami-prefix prefix", "Prefix for AMI name.") do |prefix| 40 | options[:ami_prefix] = prefix 41 | end 42 | 43 | o.on("--flavor flavor", "Flavor of instance.") do |flavor| 44 | options[:flavor_id] = flavor 45 | end 46 | 47 | o.on("--instance-prefix prefix", "Prefix for instance name.") do |prefix| 48 | options[:instance_prefix] = prefix 49 | end 50 | end 51 | 52 | # Parse the options 53 | argv = parse_options(opts) 54 | return if !argv 55 | 56 | raise Errors::CLIInvalidOptions, help: opts.help.chomp if argv.length != 1 57 | options[:subnet_id] = argv[0] 58 | 59 | actions = Vagrant::Openshift::Action.build_sti_base_windows(options) 60 | @env.action_runner.run actions 61 | 0 62 | end 63 | end 64 | end 65 | end 66 | end 67 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/checkout_repositories.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class CheckoutRepositories < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "checkout specified branch from cloned upstream repository" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:repo] = 'origin' 31 | 32 | opts = OptionParser.new do |o| 33 | o.banner = "Usage: vagrant checkout-repos" 34 | o.separator "" 35 | 36 | o.on("-b [branch-name]", "--branch [branch-name]", String, "Check out the specified branch. If unset, no checkout happens and the default branch is used (e.g. master).") do |f| 37 | options[:branch] = {"origin-server" => f} 38 | end 39 | 40 | o.on("-r [repo-name]", "--repo [repo-name]", String, "Check out the specified repo. Default is 'origin'.") do |f| 41 | options[:repo] = f 42 | end 43 | end 44 | 45 | # Parse the options 46 | argv = parse_options(opts) 47 | return if !argv 48 | 49 | with_target_vms(argv, :reverse => true) do |machine| 50 | actions = Vagrant::Openshift::Action.checkout_repositories(options) 51 | @env.action_runner.run actions, {:machine => machine} 52 | 0 53 | end 54 | end 55 | end 56 | end 57 | end 58 | end 59 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/clone_upstream_repositories.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class CloneUpstreamRepositories < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "clones upstream repositories into vm" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:clean] = false 31 | options[:repo] = 'origin' 32 | 33 | opts = OptionParser.new do |o| 34 | o.banner = "Usage: vagrant clone-upstream-repositories" 35 | o.separator "" 36 | 37 | o.on("-c", "--clean", "Remove the current bare repositories on disk if present") do |c| 38 | options[:clean] = true 39 | end 40 | 41 | o.on("-r [repo-name]", "--repo [repo-name]", String, "Clone the specified repo. Default is 'origin'.") do |f| 42 | options[:repo] = f 43 | end 44 | end 45 | 46 | # Parse the options 47 | argv = parse_options(opts) 48 | return if !argv 49 | 50 | with_target_vms(argv, :reverse => true) do |machine| 51 | actions = Vagrant::Openshift::Action.clone_upstream_repositories(options) 52 | @env.action_runner.run actions, {:machine => machine} 53 | 0 54 | end 55 | end 56 | end 57 | end 58 | end 59 | end -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/create_ami.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class CreateAMI < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "registers an ami of the current instance with the same name as the instance" 26 | end 27 | 28 | def execute 29 | options = {} 30 | 31 | opts = OptionParser.new do |o| 32 | o.banner = "Usage: vagrant create-ami" 33 | o.separator "" 34 | end 35 | 36 | # Parse the options 37 | argv = parse_options(opts) 38 | return if !argv 39 | 40 | with_target_vms(argv, :reverse => true) do |machine| 41 | actions = Vagrant::Openshift::Action.create_ami(options) 42 | @env.action_runner.run actions, {:machine => machine} 43 | 0 44 | end 45 | end 46 | end 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/create_local_yum_repo.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | 22 | class CreateLocalYumRepo < Vagrant.plugin(2, :command) 23 | include CommandHelper 24 | 25 | def self.synopsis 26 | "create yum repo from locally generated RPMs" 27 | end 28 | 29 | def execute 30 | options = {} 31 | options[:rpmdir_loc] = nil 32 | 33 | opts = OptionParser.new do |o| 34 | o.banner = "Usage: vagrant create-local-yum-repo [vm-name]" 35 | o.separator "" 36 | 37 | o.on("--rpmdir_loc [directory]", String, "Directory where the RPMs exist on the vm.") do |f| 38 | options[:rpmdir_loc] = f 39 | end 40 | 41 | end 42 | 43 | # Parse the options 44 | argv = parse_options(opts) 45 | return if !argv 46 | 47 | with_target_vms(argv, :reverse => true) do |machine| 48 | actions = Vagrant::Openshift::Action.create_local_yum_repo(options) 49 | @env.action_runner.run actions, {:machine => machine} 50 | 0 51 | end 52 | end 53 | end 54 | end 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/download_artifacts_origin.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class DownloadArtifactsOrigin < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "download the origin test artifacts" 26 | end 27 | 28 | def execute 29 | options = {} 30 | 31 | opts = OptionParser.new do |o| 32 | o.banner = "Usage: vagrant download-artifacts-origin [machine-name]" 33 | o.separator "" 34 | 35 | o.on("", "--include-release-artifacts", String, "Include release binaries") do |f| 36 | options[:download_release] = true 37 | end 38 | end 39 | 40 | # Parse the options 41 | argv = parse_options(opts) 42 | return if !argv 43 | 44 | with_target_vms(argv, :reverse => true) do |machine| 45 | actions = Vagrant::Openshift::Action.download_origin_artifacts(options) 46 | @env.action_runner.run actions, {:machine => machine} 47 | 0 48 | end 49 | end 50 | end 51 | end 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/download_artifacts_origin_aggregated_logging.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class DownloadArtifactsOriginAggregatedLogging < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "download the origin-aggregated-logging test artifacts" 26 | end 27 | 28 | def execute 29 | options = {} 30 | 31 | opts = OptionParser.new do |o| 32 | o.banner = "Usage: vagrant download-artifacts-origin-aggregated-logging [machine-name]" 33 | o.separator "" 34 | end 35 | 36 | # Parse the options 37 | argv = parse_options(opts) 38 | return if !argv 39 | 40 | with_target_vms(argv, :reverse => true) do |machine| 41 | actions = Vagrant::Openshift::Action.download_origin_aggregated_logging_artifacts(options) 42 | @env.action_runner.run actions, {:machine => machine} 43 | 0 44 | end 45 | end 46 | end 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/download_artifacts_origin_console.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class DownloadArtifactsOriginConsole < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "download the origin-web-console test artifacts" 26 | end 27 | 28 | def execute 29 | options = {} 30 | 31 | opts = OptionParser.new do |o| 32 | o.banner = "Usage: vagrant download-artifacts-origin-console [machine-name]" 33 | o.separator "" 34 | end 35 | 36 | # Parse the options 37 | argv = parse_options(opts) 38 | return if !argv 39 | 40 | with_target_vms(argv, :reverse => true) do |machine| 41 | actions = Vagrant::Openshift::Action.download_origin_console_artifacts(options) 42 | @env.action_runner.run actions, {:machine => machine} 43 | 0 44 | end 45 | end 46 | end 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/download_artifacts_origin_metrics.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class DownloadArtifactsOriginMetrics < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "download the origin-metrics test artifacts" 26 | end 27 | 28 | def execute 29 | options = {} 30 | 31 | opts = OptionParser.new do |o| 32 | o.banner = "Usage: vagrant download-artifacts-origin-metrics [machine-name]" 33 | o.separator "" 34 | end 35 | 36 | # Parse the options 37 | argv = parse_options(opts) 38 | return if !argv 39 | 40 | with_target_vms(argv, :reverse => true) do |machine| 41 | actions = Vagrant::Openshift::Action.download_origin_metrics_artifacts(options) 42 | @env.action_runner.run actions, {:machine => machine} 43 | 0 44 | end 45 | end 46 | end 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/download_artifacts_sti.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class DownloadArtifactsSti < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "download the origin test artifacts" 26 | end 27 | 28 | def execute 29 | options = {} 30 | 31 | opts = OptionParser.new do |o| 32 | o.banner = "Usage: vagrant download-artifacts-sti [machine-name]" 33 | o.separator "" 34 | end 35 | 36 | # Parse the options 37 | argv = parse_options(opts) 38 | return if !argv 39 | 40 | with_target_vms(argv, :reverse => true) do |machine| 41 | actions = Vagrant::Openshift::Action.download_sti_artifacts(options) 42 | @env.action_runner.run actions, {:machine => machine} 43 | 0 44 | end 45 | end 46 | end 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/install_docker.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class InstallDocker < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "install docker" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:"docker.repourls"] = [] 31 | options[:"docker.reponames"] = [] 32 | 33 | opts = OptionParser.new do |o| 34 | o.banner = "Usage: vagrant install-docker [vm-name]" 35 | o.separator "" 36 | 37 | o.on("--repourl [name]", String, "URL of a repository file to use when installing Docker.") do |f| 38 | options[:"docker.repourls"] << f 39 | end 40 | 41 | o.on("--repo [name]", String, "Name of a repository to enable when installing Docker. Defaults to use all available repositories.") do |f| 42 | options[:"docker.reponames"] << f 43 | end 44 | 45 | o.on("--docker.version [version]", String, "Install the specified Docker version. Leave empty to install latest available.") do |f| 46 | options[:"docker.version"] = f 47 | end 48 | 49 | o.on("--force", String, "Uninstall Docker to swap in the new version, even if the uninstall is unclean.") do |f| 50 | options[:force] = true 51 | end 52 | 53 | end 54 | 55 | # Parse the options 56 | argv = parse_options(opts) 57 | return if !argv 58 | 59 | with_target_vms(argv, :reverse => true) do |machine| 60 | actions = Vagrant::Openshift::Action.install_docker(options) 61 | @env.action_runner.run actions, {:machine => machine} 62 | 0 63 | end 64 | end 65 | end 66 | end 67 | end 68 | end 69 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/install_golang.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class InstallGolang < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "install golang" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:"golang.repourls"] = [] 31 | options[:"golang.reponames"] = [] 32 | 33 | opts = OptionParser.new do |o| 34 | o.banner = "Usage: vagrant install-golang [vm-name]" 35 | o.separator "" 36 | 37 | o.on("--repourl [name]", String, "URL of a repository file to use when installing Golang.") do |f| 38 | options[:"golang.repourls"] << f 39 | end 40 | 41 | o.on("--repo [name]", String, "Name of a repository to enable when installing Golang. Defaults to use all available repositories.") do |f| 42 | options[:"golang.reponames"] << f 43 | end 44 | 45 | o.on("--golang.version [version]", String, "Install the specified Golang version. Leave empty to install latest available.") do |f| 46 | options[:"golang.version"] = f 47 | end 48 | 49 | o.on("--force", String, "Uninstall Golang to swap in the new version, even if the uninstall is unclean.") do |f| 50 | options[:force] = true 51 | end 52 | 53 | end 54 | 55 | # Parse the options 56 | argv = parse_options(opts) 57 | return if !argv 58 | 59 | with_target_vms(argv, :reverse => true) do |machine| 60 | actions = Vagrant::Openshift::Action.install_golang(options) 61 | @env.action_runner.run actions, {:machine => machine} 62 | 0 63 | end 64 | end 65 | end 66 | end 67 | end 68 | end 69 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/install_origin.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class InstallOrigin < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "installs origin" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:clean] = false 31 | options[:install_assets] = true 32 | 33 | opts = OptionParser.new do |o| 34 | o.banner = "Usage: vagrant install-origin [vm-name]" 35 | o.separator "" 36 | 37 | o.on("-s", "--skip-assets", "Don't install the asset dependencies.") do |f| 38 | options[:install_assets] = false 39 | end 40 | end 41 | 42 | # Parse the options 43 | argv = parse_options(opts) 44 | return if !argv 45 | 46 | with_target_vms(argv, :reverse => true) do |machine| 47 | actions = Vagrant::Openshift::Action.install_origin(options) 48 | @env.action_runner.run actions, {:machine => machine} 49 | 0 50 | end 51 | end 52 | end 53 | end 54 | end 55 | end 56 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/install_origin_assets_base.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class InstallOriginAssetsBase < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "installs origin asset dependencies" 26 | end 27 | 28 | def execute 29 | options = {} 30 | 31 | opts = OptionParser.new do |o| 32 | o.banner = "Usage: vagrant install-origin-assets-base [vm-name]" 33 | o.separator "" 34 | end 35 | 36 | # Parse the options 37 | argv = parse_options(opts) 38 | return if !argv 39 | 40 | with_target_vms(argv, :reverse => true) do |machine| 41 | actions = Vagrant::Openshift::Action.install_origin_assets_base(options) 42 | @env.action_runner.run actions, {:machine => machine} 43 | 0 44 | end 45 | end 46 | end 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/local_origin_setup.rb: -------------------------------------------------------------------------------- 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 | require_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class LocalOriginSetup < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "clones the origin repos into the current directory" 26 | end 27 | 28 | def execute 29 | options = { 30 | :branch => 'master', 31 | :replace => false, 32 | :repo => 'origin' 33 | } 34 | 35 | opts = OptionParser.new do |o| 36 | o.banner = "Usage: vagrant origin-local-checkout [options]" 37 | o.separator "" 38 | 39 | o.on("-b [branch-name]", "--branch [branch-name]", String, "Check out the specified branch. Default is 'master'.") do |f| 40 | options[:branch] = f 41 | end 42 | 43 | o.on("-u [username]", "--user [username]", String, "Your GitHub username. If provided, Vagrant will attempt to clone your forks of the Origin repos. If not provided, or if the forks cannot be found, Vagrant will clone read-only copies of the Origin repos.") do |f| 44 | options[:user] = f 45 | end 46 | 47 | o.on("-r", "--replace", "Delete existing cloned dirs first. Default is to skip repos that are already cloned.") do |f| 48 | options[:replace] = f 49 | end 50 | 51 | o.on("", "--repo [reponame]", "Repo to checkout. Default is 'origin'.") do |f| 52 | options[:repo] = f 53 | end 54 | end 55 | 56 | # Parse the options 57 | argv = parse_options(opts) 58 | return if !argv 59 | 60 | actions = Vagrant::Openshift::Action.local_origin_checkout(options) 61 | @env.action_runner.run actions 62 | 0 63 | end 64 | end 65 | end 66 | end 67 | end 68 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/modify_ami.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class ModifyAMI < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "modifies corresponding ami of the current instance" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:tag] = nil 31 | 32 | opts = OptionParser.new do |o| 33 | o.banner = "Usage: vagrant modify-ami [machine-name]" 34 | o.separator "" 35 | 36 | o.on("-t", "--tag [name]", String, "Tag the AMI") do |f| 37 | options[:tag] = f 38 | end 39 | end 40 | 41 | # Parse the options 42 | argv = parse_options(opts) 43 | return if !argv 44 | 45 | with_target_vms(argv, :reverse => true) do |machine| 46 | actions = Vagrant::Openshift::Action.modify_ami(options) 47 | @env.action_runner.run actions, {:machine => machine} 48 | 0 49 | end 50 | end 51 | end 52 | end 53 | end 54 | end 55 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/modify_instance.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class ModifyInstance < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "modifies the current instance" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:rename] = nil 31 | options[:stop] = false 32 | 33 | opts = OptionParser.new do |o| 34 | o.banner = "Usage: vagrant modify-instance [machine-name]" 35 | o.separator "" 36 | 37 | o.on("-r", "--rename [name]", String, "Rename the instance") do |f| 38 | options[:rename] = f 39 | end 40 | 41 | o.on("-s", "--stop", String, "Stop the instance") do |f| 42 | options[:stop] = true 43 | end 44 | 45 | o.on("-d", "--detach", String, "Detach the instance from local Vagrant") do |f| 46 | options[:detach] = true 47 | end 48 | end 49 | 50 | # Parse the options 51 | argv = parse_options(opts) 52 | return if !argv 53 | 54 | with_target_vms(argv, :reverse => true) do |machine| 55 | actions = Vagrant::Openshift::Action.modify_instance(options) 56 | @env.action_runner.run actions, {:machine => machine} 57 | 0 58 | end 59 | end 60 | end 61 | end 62 | end 63 | end 64 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/origin_init.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2013-2015 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class OriginInit < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "creates an .vagrant-openshift.json config file based on the options supplied" 26 | end 27 | 28 | def execute 29 | options = { 30 | :no_base => false, 31 | :os => 'centos7', 32 | :stage => 'inst', 33 | :instance_type => 't2.large', 34 | :volume_size => 25, 35 | :port_mappings => [], 36 | :no_synced_folders => false, 37 | :no_insert_key => false, 38 | :required_name_tag => nil 39 | } 40 | 41 | valid_stage = ['os','deps','inst'] 42 | valid_os = ['centos7','fedora','rhel7','rhel7next','rhelatomic7'] 43 | 44 | opts = OptionParser.new do |o| 45 | o.banner = "Usage: vagrant origin-init [vm or instance name]" 46 | o.separator "" 47 | 48 | o.on("-s [stage]", "--stage [stage]", String, "Specify what build state to start from:\n\tos = base operating system\n\tdeps = only dependencies installed\n\tinst = dev environment [default]") do |f| 49 | options[:stage] = f 50 | end 51 | 52 | o.on("-o [name]", "--os [name]", String, "Operating system:\n\tcentos7 [default]\n\tfedora\n\trhel7\n\trhel7next\n\trhelatomic7") do |f| 53 | options[:os] = f 54 | end 55 | 56 | o.on("-p [guest_port:host_port]", "--map-port [guest_port:host_port]", String, "When running on VirtualBox, map port from guest docker vm to host machine") do |f| 57 | options[:port_mappings].push(f.split(":")) 58 | end 59 | 60 | o.on('--no-synced-folders', 'Checkout source into image rather than mapping from host system') do |f| 61 | options[:no_synced_folders] = true 62 | end 63 | 64 | o.on('--no-insert-key', 'Insert a secure ssh key on vagrant up') do |f| 65 | options[:no_insert_key] = true 66 | end 67 | 68 | o.on('--instance-type', "--instance-type [type]", String, "Specify what type of instance to launch") do |f| 69 | options[:instance_type] = f 70 | end 71 | 72 | o.on('--volume-size', "--volume-size [size]", String, "Specify the volume size for the instance") do |f| 73 | options[:volume_size] = f.to_i 74 | end 75 | 76 | o.on("--required-name-tag [name]", String, "Specify name tag to match against images, if supported") do |f| 77 | name_tag = f.strip 78 | options[:required_name_tag] = name_tag unless name_tag.empty? 79 | end 80 | end 81 | 82 | # Parse the options 83 | argv = parse_options(opts) 84 | return if !argv 85 | 86 | unless valid_stage.include? options[:stage] 87 | @env.ui.warn "Unknown stage '#{options[:stage]}'. Please choose from #{valid_stage.join(', ')}" 88 | exit 89 | end 90 | 91 | unless valid_os.include? options[:os] 92 | @env.ui.warn "Unknown OS '#{options[:os]}'. Please choose from #{valid_os.join(', ')}" 93 | exit 94 | end 95 | 96 | options[:name] = argv[0] if argv[0] 97 | 98 | actions = Vagrant::Openshift::Action.gen_template(options) 99 | @env.action_runner.run actions 100 | 0 101 | end 102 | 103 | private 104 | 105 | 106 | end 107 | end 108 | end 109 | end 110 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/push_openshift_images.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | 22 | class PushOpenshiftImages < Vagrant.plugin(2, :command) 23 | include CommandHelper 24 | 25 | def self.synopsis 26 | "build and push openshift images" 27 | end 28 | 29 | def execute 30 | options = {} 31 | options[:registry] = nil 32 | 33 | opts = OptionParser.new do |o| 34 | o.banner = "Usage: vagrant push-openshift-images --registry DOCKER_REGISTRY [vm-name]" 35 | o.on("--registry [url]", String, "Docker Registry to push images to.") do |c| 36 | options[:registry] = c 37 | end 38 | o.on("--build_images [list]", String, "List of CENTOS_NAMESPACE;RHEL_NAMESPACE;IMAGE;VERSION;GIT_REPO;REF pairs, delimited by ','") do |i| 39 | options[:build_images] = i 40 | end 41 | o.on("--check_images [list]", String, "List of CENTOS_NAMESPACE;RHEL_NAMESPACE;IMAGE;VERSION;GIT_REPO;REF pairs, delimited by ','") do |ci| 42 | options[:check_images] = ci 43 | end 44 | o.separator "" 45 | end 46 | 47 | # Parse the options 48 | argv = parse_options(opts) 49 | return if !argv 50 | 51 | if options[:registry].nil? 52 | @env.ui.warn "You must specify target Docker registry" 53 | exit 54 | end 55 | 56 | if options[:build_images].nil? 57 | @env.ui.warn "You must specify list of images to build" 58 | exit 59 | end 60 | 61 | with_target_vms(argv, :reverse => true) do |machine| 62 | actions = Vagrant::Openshift::Action.push_openshift_images(options) 63 | @env.action_runner.run actions, {:machine => machine} 64 | 0 65 | end 66 | end 67 | end 68 | end 69 | end 70 | end 71 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/push_openshift_release.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class PushOpenshiftRelease < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "pushes openshift docker images to a registry" 26 | end 27 | 28 | def execute 29 | options = {} 30 | 31 | opts = OptionParser.new do |o| 32 | o.banner = "Usage: vagrant push-openshift-release --registry [registry_name] --include-base [vm-name]" 33 | o.separator "" 34 | 35 | o.on("--registry [registry_name]", String, "A Docker registry to push images to (include a trailing slash)") do |f| 36 | options[:registry_name] = f 37 | end 38 | 39 | o.on("--include-base", "Include the base infrastructure images in the push.") do |c| 40 | options[:push_base_images] = true 41 | end 42 | end 43 | 44 | # Parse the options 45 | argv = parse_options(opts) 46 | return if !argv 47 | 48 | with_target_vms(argv, :reverse => true) do |machine| 49 | actions = Vagrant::Openshift::Action.push_openshift_release(options) 50 | @env.action_runner.run actions, {:machine => machine} 51 | 0 52 | end 53 | end 54 | end 55 | end 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/repo_sync_customer_diagnostics.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class RepoSyncCustomerDiagnostics < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "syncs your local repos to the current instance" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:images] = true 31 | options[:build] = true 32 | options[:clean] = false 33 | options[:source] = false 34 | options[:repo] = 'openshift-ansible' 35 | 36 | opts = OptionParser.new do |o| 37 | o.banner = "Usage: vagrant sync-customer-diagnostics [vm-name]" 38 | o.separator "" 39 | 40 | o.on("-s", "--source", "Sync the source (not required if using synced folders)") do |f| 41 | options[:source] = f 42 | end 43 | 44 | o.on("-c", "--clean", "Delete existing repo before syncing source") do |f| 45 | options[:clean] = f 46 | end 47 | 48 | o.on("--dont-install", "Don't build and install updated source") do |f| 49 | options[:build] = false 50 | end 51 | 52 | o.on("--no-images", "Don't build updated component Docker images") do |f| 53 | options[:images] = false 54 | end 55 | 56 | end 57 | 58 | # Parse the options 59 | argv = parse_options(opts) 60 | return if !argv 61 | 62 | with_target_vms(argv, :reverse => true) do |machine| 63 | actions = Vagrant::Openshift::Action.repo_sync(options) 64 | @env.action_runner.run actions, {:machine => machine} 65 | 0 66 | end 67 | end 68 | end 69 | end 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/repo_sync_jenkins.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class RepoSyncJenkins < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "syncs your local repos to the current instance" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:images] = true 31 | options[:build] = true 32 | options[:clean] = false 33 | options[:source] = false 34 | options[:repo] = 'jenkins' 35 | 36 | opts = OptionParser.new do |o| 37 | o.banner = "Usage: vagrant sync-jenkins [vm-name]" 38 | o.separator "" 39 | 40 | o.on("-s", "--source", "Sync the source (not required if using synced folders)") do |f| 41 | options[:source] = f 42 | end 43 | 44 | o.on("-c", "--clean", "Delete existing repo before syncing source") do |f| 45 | options[:clean] = f 46 | end 47 | 48 | o.on("--dont-install", "Don't build and install updated source") do |f| 49 | options[:build] = false 50 | end 51 | 52 | o.on("--no-images", "Don't build updated component Docker images") do |f| 53 | options[:images] = false 54 | end 55 | 56 | end 57 | 58 | # Parse the options 59 | argv = parse_options(opts) 60 | return if !argv 61 | 62 | with_target_vms(argv, :reverse => true) do |machine| 63 | actions = Vagrant::Openshift::Action.repo_sync(options) 64 | @env.action_runner.run actions, {:machine => machine} 65 | 0 66 | end 67 | end 68 | end 69 | end 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/repo_sync_origin.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class RepoSyncOrigin < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "syncs your local repos to the current instance" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:images] = true 31 | options[:build] = true 32 | options[:clean] = false 33 | options[:source] = false 34 | options[:repo] = 'origin' 35 | 36 | opts = OptionParser.new do |o| 37 | o.banner = "Usage: vagrant sync-origin [vm-name]" 38 | o.separator "" 39 | 40 | o.on("-s", "--source", "Sync the source (not required if using synced folders)") do |f| 41 | options[:source] = f 42 | end 43 | 44 | o.on("-c", "--clean", "Delete existing repo before syncing source") do |f| 45 | options[:clean] = f 46 | end 47 | 48 | o.on("--dont-install", "Don't build and install updated source") do |f| 49 | options[:build] = false 50 | end 51 | 52 | o.on("--no-images", "Don't build updated component Docker images") do |f| 53 | options[:images] = false 54 | end 55 | 56 | end 57 | 58 | # Parse the options 59 | argv = parse_options(opts) 60 | return if !argv 61 | 62 | with_target_vms(argv, :reverse => true) do |machine| 63 | actions = Vagrant::Openshift::Action.repo_sync_origin(options) 64 | @env.action_runner.run actions, {:machine => machine} 65 | 0 66 | end 67 | end 68 | end 69 | end 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/repo_sync_origin_aggregated_logging.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class RepoSyncOriginAggregatedLogging < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "syncs your local repos to the current instance" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:images] = true 31 | options[:build] = true 32 | options[:clean] = false 33 | options[:source] = false 34 | options[:repo] = 'origin-aggregated-logging' 35 | 36 | opts = OptionParser.new do |o| 37 | o.banner = "Usage: vagrant sync-origin-aggregated-logging [vm-name]" 38 | o.separator "" 39 | 40 | o.on("-s", "--source", "Sync the source (not required if using synced folders)") do |f| 41 | options[:source] = f 42 | end 43 | 44 | o.on("-c", "--clean", "Delete existing repo before syncing source") do |f| 45 | options[:clean] = f 46 | end 47 | 48 | o.on("--dont-install", "Don't build and install updated source") do |f| 49 | options[:build] = false 50 | end 51 | 52 | o.on("--no-images", "Don't build updated component Docker images") do |f| 53 | options[:images] = false 54 | end 55 | 56 | end 57 | 58 | # Parse the options 59 | argv = parse_options(opts) 60 | return if !argv 61 | 62 | with_target_vms(argv, :reverse => true) do |machine| 63 | actions = Vagrant::Openshift::Action.repo_sync(options) 64 | @env.action_runner.run actions, {:machine => machine} 65 | 0 66 | end 67 | end 68 | end 69 | end 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/repo_sync_origin_console.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class RepoSyncOriginConsole < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "syncs your local repos to the current instance" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:images] = true 31 | options[:build] = true 32 | options[:clean] = false 33 | options[:source] = false 34 | options[:repo] = 'origin-web-console' 35 | 36 | opts = OptionParser.new do |o| 37 | o.banner = "Usage: vagrant sync-origin-console [vm-name]" 38 | o.separator "" 39 | 40 | o.on("-c", "--clean", "Delete existing repo before syncing") do |f| 41 | options[:clean] = f 42 | end 43 | 44 | o.on("-s", "--source", "Sync the source (not required if using synced folders)") do |f| 45 | options[:source] = f 46 | end 47 | 48 | o.on("--dont-install", "Don't build and install updated source") do |f| 49 | options[:build] = false 50 | end 51 | 52 | end 53 | 54 | # Parse the options 55 | argv = parse_options(opts) 56 | return if !argv 57 | 58 | with_target_vms(argv, :reverse => true) do |machine| 59 | actions = Vagrant::Openshift::Action.repo_sync_origin_console(options) 60 | @env.action_runner.run actions, {:machine => machine} 61 | 0 62 | end 63 | end 64 | end 65 | end 66 | end 67 | end 68 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/repo_sync_origin_metrics.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class RepoSyncOriginMetrics < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "syncs your local repos to the current instance" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:images] = true 31 | options[:build] = true 32 | options[:clean] = false 33 | options[:source] = false 34 | options[:repo] = 'origin-metrics' 35 | 36 | opts = OptionParser.new do |o| 37 | o.banner = "Usage: vagrant sync-origin-metrics [vm-name]" 38 | o.separator "" 39 | 40 | o.on("-s", "--source", "Sync the source (not required if using synced folders)") do |f| 41 | options[:source] = f 42 | end 43 | 44 | o.on("-c", "--clean", "Delete existing repo before syncing source") do |f| 45 | options[:clean] = f 46 | end 47 | 48 | o.on("--dont-install", "Don't build and install updated source") do |f| 49 | options[:build] = false 50 | end 51 | 52 | o.on("--no-images", "Don't build updated component Docker images") do |f| 53 | options[:images] = false 54 | end 55 | 56 | end 57 | 58 | # Parse the options 59 | argv = parse_options(opts) 60 | return if !argv 61 | 62 | with_target_vms(argv, :reverse => true) do |machine| 63 | actions = Vagrant::Openshift::Action.repo_sync(options) 64 | @env.action_runner.run actions, {:machine => machine} 65 | 0 66 | end 67 | end 68 | end 69 | end 70 | end 71 | end 72 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/repo_sync_sti.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class RepoSyncSti < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "syncs your local repos to the current instance" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:build] = true 31 | options[:clean] = false 32 | options[:source] = false 33 | options[:repo] = 'source-to-image' 34 | 35 | opts = OptionParser.new do |o| 36 | o.banner = "Usage: vagrant sync-sti [vm-name]" 37 | o.separator "" 38 | 39 | o.on("-c", "--clean", "Delete existing repo before syncing") do |f| 40 | options[:clean] = f 41 | end 42 | 43 | o.on("-s", "--source", "Sync the source (not required if using synced folders)") do |f| 44 | options[:source] = f 45 | end 46 | 47 | o.on("--dont-install", "Don't build and install updated source") do |f| 48 | options[:build] = false 49 | end 50 | 51 | end 52 | 53 | # Parse the options 54 | argv = parse_options(opts) 55 | return if !argv 56 | 57 | with_target_vms(argv, :reverse => true) do |machine| 58 | actions = Vagrant::Openshift::Action.repo_sync_sti(options) 59 | @env.action_runner.run actions, {:machine => machine} 60 | 0 61 | end 62 | end 63 | end 64 | end 65 | end 66 | end 67 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/test_customer_diagnostics.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class TestCustomerDiagnostics < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "run the customer diagnostics tests" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:download] = false 31 | options[:target] = 'test-integration' 32 | 33 | opts = OptionParser.new do |o| 34 | o.banner = "Usage: vagrant test-customer-diagnostics [machine-name]" 35 | o.separator "" 36 | 37 | o.on("", "--root", String, "Run tests as root") do |f| 38 | options[:root] = true 39 | end 40 | 41 | o.on("-d","--artifacts", String, "Download logs") do |f| 42 | options[:download] = true 43 | end 44 | 45 | o.on("", "--env ENV=VALUE", String, "Environment variable to execute tests with") do |f| 46 | options[:envs] = [] unless options[:envs] 47 | options[:envs] << f 48 | end 49 | 50 | o.on("-t", "--target MAKEFILE_TARGETS", String, "Arguments to pass to the repository Makefile") do |f| 51 | options[:target] = f 52 | end 53 | 54 | end 55 | 56 | # Parse the options 57 | argv = parse_options(opts) 58 | return if !argv 59 | 60 | with_target_vms(argv, :reverse => true) do |machine| 61 | actions = Vagrant::Openshift::Action.run_customer_diagnostics_tests(options) 62 | @env.action_runner.run actions, {:machine => machine} 63 | 0 64 | end 65 | end 66 | end 67 | end 68 | end 69 | end 70 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/test_origin.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class TestOrigin < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "run the origin tests" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:download] = false 31 | options[:all] = false 32 | options[:extended_test_packages] = "" 33 | 34 | opts = OptionParser.new do |o| 35 | o.banner = "Usage: vagrant test-origin [machine-name]" 36 | o.separator "" 37 | 38 | o.on("-t", "--target MAKEFILE_TARGETS", String, "Arguments to pass to the repository Makefile") do |f| 39 | options[:target] = f 40 | end 41 | 42 | o.on("", "--root", String, "Run tests as root") do |f| 43 | options[:root] = true 44 | end 45 | 46 | o.on("-a", "--all", String, "Run all tests") do |f| 47 | options[:all] = true 48 | end 49 | 50 | o.on("", "--skip-check", String, "Skip unit, integration and e2e tests") do |f| 51 | options[:skip_check] = true 52 | end 53 | 54 | o.on("-e", "--extended TEST_BUCKETS", String, "Comma delimited list of extended test packages to run") do |f| 55 | options[:extended_test_packages] = f 56 | end 57 | 58 | o.on("-d","--artifacts", String, "Download logs") do |f| 59 | options[:download] = true 60 | end 61 | 62 | o.on("", "--download-release-artifacts", String, "Download release binaries") do |f| 63 | options[:download_release] = true 64 | end 65 | 66 | o.on("-s","--skip-image-cleanup", String, "Skip Docker image teardown for E2E test") do |f| 67 | options[:skip_image_cleanup] = true 68 | end 69 | 70 | o.on("-c","--report-coverage", String, "Generate code coverage report") do |f| 71 | options[:report_coverage] = true 72 | end 73 | 74 | o.on("-j","--parallel", String, "Run parallel make") do |f| 75 | options[:parallel] = true 76 | end 77 | 78 | o.on("-r","--image-registry REGISTRY", String, "Image registry to configure tests with") do |f| 79 | options[:image_registry] = f 80 | end 81 | 82 | o.on("", "--env ENV=VALUE", String, "Environment variable to execute tests with") do |f| 83 | options[:envs] = [] unless options[:envs] 84 | options[:envs] << f 85 | end 86 | end 87 | 88 | # Parse the options 89 | argv = parse_options(opts) 90 | return if !argv 91 | 92 | with_target_vms(argv, :reverse => true) do |machine| 93 | actions = Vagrant::Openshift::Action.run_origin_tests(options) 94 | @env.action_runner.run actions, {:machine => machine} 95 | 0 96 | end 97 | end 98 | end 99 | end 100 | end 101 | end 102 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/test_origin_aggregated_logging.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class TestOriginAggregatedLogging < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "run the origin-aggregated-logging tests" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:download] = false 31 | 32 | opts = OptionParser.new do |o| 33 | o.banner = "Usage: vagrant test-origin-aggregated-logging [machine-name]" 34 | o.separator "" 35 | 36 | o.on("", "--root", String, "Run tests as root") do |f| 37 | options[:root] = true 38 | end 39 | 40 | o.on("-d","--artifacts", String, "Download logs") do |f| 41 | options[:download] = true 42 | end 43 | 44 | o.on("-r","--image-registry", String, "Image registry to configure tests with") do |f| 45 | options[:image_registry] = f 46 | end 47 | 48 | o.on("", "--env ENV=VALUE", String, "Environment variable to execute tests with") do |f| 49 | options[:envs] = [] unless options[:envs] 50 | options[:envs] << f 51 | end 52 | end 53 | 54 | # Parse the options 55 | argv = parse_options(opts) 56 | return if !argv 57 | 58 | with_target_vms(argv, :reverse => true) do |machine| 59 | actions = Vagrant::Openshift::Action.run_origin_aggregated_logging_tests(options) 60 | @env.action_runner.run actions, {:machine => machine} 61 | 0 62 | end 63 | end 64 | end 65 | end 66 | end 67 | end 68 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/test_origin_console.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class TestOriginConsole < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "run the origin web console tests" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:download] = false 31 | options[:all] = false 32 | options[:extended_test_packages] = "" 33 | 34 | opts = OptionParser.new do |o| 35 | o.banner = "Usage: vagrant test-origin-console [machine-name]" 36 | o.separator "" 37 | 38 | o.on("-d","--artifacts", String, "Download logs and screenshots") do |f| 39 | options[:download] = true 40 | end 41 | 42 | o.on("", "--env ENV=VALUE", String, "Environment variable to execute tests with") do |f| 43 | options[:envs] = [] unless options[:envs] 44 | options[:envs] << f 45 | end 46 | end 47 | 48 | # Parse the options 49 | argv = parse_options(opts) 50 | return if !argv 51 | 52 | with_target_vms(argv, :reverse => true) do |machine| 53 | actions = Vagrant::Openshift::Action.run_origin_asset_tests(options) 54 | @env.action_runner.run actions, {:machine => machine} 55 | 0 56 | end 57 | end 58 | end 59 | end 60 | end 61 | end 62 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/test_origin_metrics.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class TestOriginMetrics < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "run the origin-metrics tests" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:download] = false 31 | 32 | opts = OptionParser.new do |o| 33 | o.banner = "Usage: vagrant test-origin-metrics [machine-name]" 34 | o.separator "" 35 | 36 | o.on("", "--root", String, "Run tests as root") do |f| 37 | options[:root] = true 38 | end 39 | 40 | o.on("-d","--artifacts", String, "Download logs") do |f| 41 | options[:download] = true 42 | end 43 | 44 | o.on("-r","--image-registry", String, "Image registry to configure tests with") do |f| 45 | options[:image_registry] = f 46 | end 47 | 48 | o.on("", "--env ENV=VALUE", String, "Environment variable to execute tests with") do |f| 49 | options[:envs] = [] unless options[:envs] 50 | options[:envs] << f 51 | end 52 | end 53 | 54 | # Parse the options 55 | argv = parse_options(opts) 56 | return if !argv 57 | 58 | with_target_vms(argv, :reverse => true) do |machine| 59 | actions = Vagrant::Openshift::Action.run_origin_metrics_tests(options) 60 | @env.action_runner.run actions, {:machine => machine} 61 | 0 62 | end 63 | end 64 | end 65 | end 66 | end 67 | end 68 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/test_sti.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class TestSti < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "run the sti tests" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:download] = false 31 | options[:all] = false 32 | 33 | opts = OptionParser.new do |o| 34 | o.banner = "Usage: vagrant test-sti [machine-name]" 35 | o.separator "" 36 | 37 | o.on("-a", "--all", String, "Run all tests") do |f| 38 | options[:all] = true 39 | end 40 | 41 | o.on("-d","--artifacts", String, "Download logs") do |f| 42 | options[:download] = true 43 | end 44 | end 45 | 46 | # Parse the options 47 | argv = parse_options(opts) 48 | return if !argv 49 | 50 | with_target_vms(argv, :reverse => true) do |machine| 51 | actions = Vagrant::Openshift::Action.run_sti_tests(options) 52 | @env.action_runner.run actions, {:machine => machine} 53 | 0 54 | end 55 | end 56 | end 57 | end 58 | end 59 | end 60 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/command/try_restart_origin.rb: -------------------------------------------------------------------------------- 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_relative "../action" 17 | 18 | module Vagrant 19 | module Openshift 20 | module Commands 21 | class TryRestartOrigin < Vagrant.plugin(2, :command) 22 | include CommandHelper 23 | 24 | def self.synopsis 25 | "restarts origin if it's already running" 26 | end 27 | 28 | def execute 29 | options = {} 30 | options[:clean] = false 31 | 32 | opts = OptionParser.new do |o| 33 | o.banner = "Usage: vagrant try-restart-origin [vm-name]" 34 | o.separator "" 35 | end 36 | 37 | # Parse the options 38 | argv = parse_options(opts) 39 | return if !argv 40 | 41 | with_target_vms(argv, :reverse => true) do |machine| 42 | actions = Vagrant::Openshift::Action.try_restart_origin(options) 43 | @env.action_runner.run actions, {:machine => machine} 44 | 0 45 | end 46 | end 47 | end 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/config.rb: -------------------------------------------------------------------------------- 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 | class Config < Vagrant.plugin(2, :config) 20 | attr_accessor :autoconfigure_aws 21 | 22 | def initialize 23 | @autoconfigure_aws = UNSET_VALUE 24 | end 25 | 26 | def finalize! 27 | @autoconfigure_aws = false if @autoconfigure_aws == UNSET_VALUE 28 | end 29 | end 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/constants.rb: -------------------------------------------------------------------------------- 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 | class Constants 21 | 22 | def self.repo_url_for_name(name) 23 | "https://github.com/openshift/#{name}.git" 24 | end 25 | 26 | def self.git_branch_current 27 | "$(git rev-parse --abbrev-ref HEAD)" 28 | end 29 | 30 | def self.plugins_conf_dir 31 | Pathname.new "/plugins" 32 | end 33 | 34 | def self.sync_dir 35 | Pathname.new "~/sync" 36 | end 37 | 38 | def self.build_dir 39 | Pathname.new "/data/src/github.com/openshift/" 40 | end 41 | 42 | def self.git_ssh 43 | Pathname.new(File.expand_path("~/.ssh/vagrant_openshift_ssh_override")) 44 | end 45 | 46 | end 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/hooks/configure_aws.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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 | require_relative "../aws" 18 | 19 | module Vagrant 20 | module Openshift 21 | module Hooks 22 | class ConfigureAWS 23 | def initialize(app, env) 24 | @app = app 25 | end 26 | 27 | def call(env) 28 | if env[:machine].config.openshift.autoconfigure_aws 29 | aws_creds = Vagrant::Openshift::AWS::aws_creds(env[:ui]) 30 | 31 | aws = env[:machine].config.vm.get_provider_config(:aws) 32 | aws.access_key_id = aws_creds["AWSAccessKeyId"] 33 | aws.secret_access_key = aws_creds["AWSSecretKey"] 34 | aws.keypair_name = aws_creds["AWSKeyPairName"] 35 | 36 | box_info = YAML.load_file(Pathname.new(File.expand_path("#{__FILE__}/../../templates/command/init-openshift/box_info.yaml"))) 37 | if !aws.ami.nil? && !aws.ami.start_with?("ami-") 38 | os, stage = aws.ami.split(":", 2) 39 | env[:machine].config.ssh.username = box_info[os.to_sym][stage.to_sym][:aws][:ssh_user] 40 | end 41 | env[:machine].config.ssh.private_key_path = [aws_creds["AWSPrivateKeyPath"]] 42 | env[:machine].config.vm.box = "https://github.com/mitchellh/vagrant-aws/raw/master/dummy.box" 43 | env[:machine].config.vm.synced_folders["/vagrant"] = {:disabled => true, :guestpath => "/vagrant", :hostpath => "."} 44 | end 45 | 46 | @app.call(env) 47 | end 48 | end 49 | end 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/hooks/find_ami.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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 | require_relative "../aws" 18 | 19 | module Vagrant 20 | module Openshift 21 | module Hooks 22 | class FindAMI 23 | def initialize(app, env) 24 | @app = app 25 | end 26 | 27 | def call(env) 28 | if env[:machine].config.openshift.autoconfigure_aws 29 | aws = env[:machine].config.vm.get_provider_config(:aws) 30 | if !aws.ami.nil? && !aws.ami.start_with?("ami-") 31 | box_info = YAML.load_file(Pathname.new(File.expand_path("#{__FILE__}/../../templates/command/init-openshift/box_info.yaml"))) 32 | os, stage = aws.ami.split(":", 2) 33 | aws.ami = Vagrant::Openshift::AWS::find_ami_from_tag(env[:ui], env[:aws_compute], box_info[os.to_sym][stage.to_sym][:aws][:ami_tag_prefix]) 34 | end 35 | end 36 | 37 | @app.call(env) 38 | end 39 | end 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/hooks/windows_wait.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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 | require_relative "../aws" 18 | 19 | module Vagrant 20 | module Openshift 21 | module Hooks 22 | class WindowsWait 23 | include CommandHelper 24 | 25 | def initialize(app, env) 26 | @app = app 27 | end 28 | 29 | def call(env) 30 | if env[:machine].config.openshift.autoconfigure_aws && is_windows?(env[:machine]) 31 | env[:ui].info 'Waiting for instance to report "Windows is Ready to use"...' 32 | Fog.wait_for(1200) { /Message: Windows is Ready to use/.match(env[:aws_compute].get_console_output(env[:machine].id).body["output"]) } 33 | end 34 | 35 | @app.call(env) 36 | end 37 | end 38 | end 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/provisioner.rb: -------------------------------------------------------------------------------- 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 | class Provisioner < Vagrant.plugin(2, :provisioner) 20 | include CommandHelper 21 | 22 | # Called with the root configuration of the machine so the provisioner 23 | # can add some configuration on top of the machine. 24 | # 25 | # During this step, and this step only, the provisioner should modify 26 | # the root machine configuration to add any additional features it 27 | # may need. Examples include sharing folders, networking, and so on. 28 | # This step is guaranteed to be called before any of those steps are 29 | # done so the provisioner may do that. 30 | # 31 | # No return value is expected. 32 | def configure(root_config) 33 | 34 | end 35 | 36 | # This is the method called when the actual provisioning should be 37 | # done. The communicator is guaranteed to be ready at this point, 38 | # and any shared folders or networks are already setup. 39 | # 40 | # No return value is expected. 41 | def provision 42 | ssh_user = machine.ssh_info[:username] 43 | sync_dir = Vagrant::Openshift::Constants.sync_dir 44 | ## pause to stabilize environment to try to correct odd sudo error on aws 45 | sleep 2 46 | sudo(machine, "mkdir -p #{sync_dir} && chown -R #{ssh_user}:#{ssh_user} #{sync_dir}") 47 | end 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/provisioner/configure_docker_client_windows.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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 Provisioner 20 | class ConfigureDockerClientWindows < Vagrant.plugin("2", :provisioner) 21 | def provision 22 | @machine.communicate.execute(%{mkdir -p /cygdrive/c/Users/Administrator/.docker}) 23 | @machine.communicate.upload(".vagrant/docker-config/ca.crt", "/cygdrive/c/Users/Administrator/.docker/ca.pem") 24 | @machine.communicate.upload(".vagrant/docker-config/client.crt", "/cygdrive/c/Users/Administrator/.docker/cert.pem") 25 | @machine.communicate.upload(".vagrant/docker-config/client.key", "/cygdrive/c/Users/Administrator/.docker/key.pem") 26 | @machine.communicate.upload(".vagrant/docker-config/dockerenv", ".dockerenv") 27 | 28 | cmd = %{ 29 | if ! grep -q dockerenv .bash_profile; then 30 | echo ". .dockerenv" >>.bash_profile 31 | fi 32 | } 33 | @machine.communicate.execute(cmd) 34 | end 35 | end 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/provisioner/configure_docker_server_linux.rb: -------------------------------------------------------------------------------- 1 | #-- 2 | # Copyright 2016 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 Provisioner 20 | class ConfigureDockerServerLinux < Vagrant.plugin("2", :provisioner) 21 | def provision 22 | begin 23 | Dir.mkdir(".vagrant/docker-config") 24 | rescue Errno::EEXIST 25 | end 26 | 27 | cmd = %{ 28 | IP=$(ifconfig eth0 | awk '/inet / { print $2; }') 29 | openssl genrsa -out /tmp/ca.key 30 | openssl req -new -key /tmp/ca.key -subj /CN=CA -x509 -sha1 -days 7 -set_serial 1 -out /tmp/ca.crt 31 | openssl genrsa -out /tmp/server.key 32 | openssl req -new -key /tmp/server.key -subj /CN=$IP -out /tmp/server.csr 33 | echo subjectAltName=IP:$IP | openssl x509 -req -in /tmp/server.csr -CA /tmp/ca.crt -CAkey /tmp/ca.key -days 7 -extfile /dev/stdin -set_serial 2 -out /tmp/server.crt 34 | rm -f /tmp/server.csr 35 | openssl genrsa -out /tmp/client.key 36 | openssl req -new -key /tmp/client.key -subj /CN=client -out /tmp/client.csr 37 | echo extendedKeyUsage=clientAuth | openssl x509 -req -in /tmp/client.csr -CA /tmp/ca.crt -CAkey /tmp/ca.key -days 7 -extfile /dev/stdin -set_serial 3 -out /tmp/client.crt 38 | rm -f /tmp/client.csr 39 | if ! grep -q tlsverify /etc/sysconfig/docker; then 40 | sed -i -e "s|^OPTIONS='|OPTIONS='--tlsverify --tlscacert=/tmp/ca.crt --tlscert=/tmp/server.crt --tlskey=/tmp/server.key -H unix:///var/run/docker.sock -H tcp://0.0.0.0:2376 |" /etc/sysconfig/docker 41 | fi 42 | systemctl restart docker.service 43 | echo -e "export DOCKER_HOST=tcp://$IP:2376\nexport DOCKER_TLS_VERIFY=1" >/tmp/dockerenv 44 | } 45 | @machine.communicate.sudo(cmd) 46 | @machine.communicate.download("/tmp/ca.crt", ".vagrant/docker-config/ca.crt") 47 | @machine.communicate.download("/tmp/client.crt", ".vagrant/docker-config/client.crt") 48 | @machine.communicate.download("/tmp/client.key", ".vagrant/docker-config/client.key") 49 | @machine.communicate.download("/tmp/dockerenv", ".vagrant/docker-config/dockerenv") 50 | end 51 | end 52 | end 53 | end 54 | end 55 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/resources/configure_docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | set -o pipefail 6 | 7 | groupadd -f docker 8 | usermod -a -G docker "${SSH_USER}" 9 | 10 | ADDITIONAL_OPTIONS='--insecure-registry=172.30.0.0/16 --insecure-registry=ci.dev.openshift.redhat.com:5000' 11 | sed -i "s,^OPTIONS='\\(.*\\)',OPTIONS='${ADDITIONAL_OPTIONS} \\1'," /etc/sysconfig/docker 12 | sed -i "s,^OPTIONS=-\\(.*\\),OPTIONS='${ADDITIONAL_OPTIONS} -\\1'," /etc/sysconfig/docker 13 | sed -i "s,^ADD_REGISTRY='\\(.*\\)',#ADD_REGISTRY='--add-registry=docker.io \\1'," /etc/sysconfig/docker 14 | 15 | if lvdisplay docker-vg >/dev/null 2>&1; then 16 | VG="docker-vg" 17 | elif lvdisplay vg_vagrant >/dev/null 2>&1; then 18 | VG="vg_vagrant" 19 | elif lvdisplay fedora >/dev/null 2>&1; then 20 | VG="fedora" 21 | elif lvdisplay centos >/dev/null 2>&1; then 22 | VG="centos" 23 | fi 24 | 25 | if [[ -n "${VG}" ]]; then 26 | lvcreate -n openshift-xfs-vol-dir -l 25%FREE /dev/${VG} 27 | mkfs.xfs /dev/${VG}/openshift-xfs-vol-dir 28 | mkdir -p /mnt/openshift-xfs-vol-dir 29 | echo /dev/${VG}/openshift-xfs-vol-dir /mnt/openshift-xfs-vol-dir xfs gquota 1 1 >> /etc/fstab 30 | mount /mnt/openshift-xfs-vol-dir 31 | chown -R "${SSH_USER}:${SSH_USER}" /mnt/openshift-xfs-vol-dir 32 | 33 | touch /etc/sysconfig/docker-storage-setup 34 | chown root:root /etc/sysconfig/docker-storage-setup 35 | chmod u+rw,g+r,o+r /etc/sysconfig/docker-storage-setup 36 | echo "VG=${VG}" >> /etc/sysconfig/docker-storage-setup 37 | docker-storage-setup 38 | fi 39 | 40 | # Docker 1.8.2 now sets a TimeoutStartSec of 1 minute. Unfortunately, for some 41 | # reason the initial docker start up is now taking > 5 minutes. Until that is fixed need this. 42 | sed -i 's,TimeoutStartSec=.*,TimeoutStartSec=10min,' /usr/lib/systemd/system/docker.service 43 | 44 | systemctl daemon-reexec 45 | systemctl daemon-reload 46 | systemctl enable docker 47 | time systemctl start docker 48 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/resources/configure_system.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | set -o nounset 5 | set -o pipefail 6 | 7 | if [[ ! -e /etc/fedora-release ]]; then 8 | sed -i 's,^SELINUX=.*,SELINUX=permissive,' /etc/selinux/config 9 | setenforce 0 10 | fi 11 | 12 | systemctl enable ntpd 13 | 14 | # Force socket reuse 15 | echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse 16 | 17 | mkdir -p /data/src 18 | mkdir -p /data/pkg 19 | mkdir -p /data/bin 20 | 21 | chown -R "${SSH_USER}:${SSH_USER}" /data 22 | 23 | sed -i "s,^#DefaultTimeoutStartSec=.*,DefaultTimeoutStartSec=240s," /etc/systemd/system.conf -------------------------------------------------------------------------------- /lib/vagrant-openshift/resources/install_chrome.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | 5 | cd /tmp 6 | 7 | # Add signing key for Chrome repo 8 | wget https://dl.google.com/linux/linux_signing_key.pub 9 | rpm --import linux_signing_key.pub 10 | 11 | # Add Chrome yum repo 12 | yum-config-manager --add-repo=http://dl.google.com/linux/chrome/rpm/stable/x86_64 13 | 14 | # Install chrome 15 | yum install -y google-chrome-stable 16 | 17 | # Install chromedriver 18 | wget https://chromedriver.storage.googleapis.com/2.16/chromedriver_linux64.zip 19 | unzip chromedriver_linux64.zip 20 | mv chromedriver /usr/bin/chromedriver 21 | chown root /usr/bin/chromedriver 22 | chmod 755 /usr/bin/chromedriver -------------------------------------------------------------------------------- /lib/vagrant-openshift/resources/install_dependencies.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | 5 | yum install -y \ 6 | augeas \ 7 | bind \ 8 | bind-utils \ 9 | bridge-utils \ 10 | bsdtar \ 11 | btrfs-progs-devel \ 12 | bzip2 \ 13 | bzr \ 14 | ctags \ 15 | device-mapper-devel \ 16 | e2fsprogs \ 17 | ethtool \ 18 | firefox \ 19 | fontconfig \ 20 | gcc \ 21 | gcc-c++ \ 22 | git \ 23 | glibc-static \ 24 | gnuplot \ 25 | gpgme \ 26 | gpgme-devel \ 27 | hg \ 28 | httpie \ 29 | iscsi-initiator-utils \ 30 | java-1.?.0-openjdk \ 31 | jq \ 32 | kernel-devel \ 33 | krb5-devel \ 34 | libassuan \ 35 | libassuan-devel \ 36 | libnetfilter_queue-devel \ 37 | libselinux-devel \ 38 | lsof \ 39 | make \ 40 | mlocate \ 41 | ntp \ 42 | openldap-clients \ 43 | openssl \ 44 | openvswitch \ 45 | rubygems \ 46 | screen \ 47 | ShellCheck \ 48 | socat \ 49 | sqlite-devel \ 50 | strace \ 51 | sysstat \ 52 | tcpdump \ 53 | tig \ 54 | tmux \ 55 | unzip \ 56 | vim \ 57 | wget \ 58 | xfsprogs \ 59 | xorg-x11-utils \ 60 | Xvfb \ 61 | yum-utils \ 62 | zip 63 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/resources/install_local_epel_repos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | 5 | # on RHEL machines, if we're installing or using OSE, we will need the 6 | # following repositories in order to fetch OSE-specific RPMs 7 | 8 | mv "$(dirname "${BASH_SOURCE}")/local_epel.repo" /etc/yum.repos.d/ 9 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/resources/install_nonessential.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | 5 | yum install -y \ 6 | facter -------------------------------------------------------------------------------- /lib/vagrant-openshift/resources/install_rhaos_repos.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | 5 | # on RHEL machines, if we're installing or using OSE, we will need the 6 | # following repositories in order to fetch OSE-specific RPMs 7 | 8 | mv "$(dirname "${BASH_SOURCE}")/rhaos31.repo" /etc/yum.repos.d/ 9 | mv "$(dirname "${BASH_SOURCE}")/rhaos32.repo" /etc/yum.repos.d/ 10 | mv "$(dirname "${BASH_SOURCE}")/rhaos33.repo" /etc/yum.repos.d/ 11 | mv "$(dirname "${BASH_SOURCE}")/rhaos34.repo" /etc/yum.repos.d/ 12 | mv "$(dirname "${BASH_SOURCE}")/rhaos35.repo" /etc/yum.repos.d/ 13 | mv "$(dirname "${BASH_SOURCE}")/rhaos36.repo" /etc/yum.repos.d/ 14 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/resources/local_epel.repo: -------------------------------------------------------------------------------- 1 | [local-epel] 2 | name=Extra Packages for Enterprise Linux 7 - $basearch 3 | baseurl=https://mirror.openshift.com/mirror/epel/7/x86_64 4 | #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-7&arch=$basearch 5 | failovermethod=priority 6 | enabled=1 7 | gpgcheck=1 8 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 9 | # according to note from sdodson in https://github.com/openshift/origin/issues/8571, default priority is 99, 10 | # but to ensure our local mirror is not overriden, setitng to 1 11 | priority=1 12 | 13 | [local-epel-debuginfo] 14 | name=Extra Packages for Enterprise Linux 7 - $basearch - Debug 15 | baseurl=https://mirror.openshift.com/mirror/epel/7/x86_64/debug 16 | #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-7&arch=$basearch 17 | failovermethod=priority 18 | enabled=0 19 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 20 | gpgcheck=1 21 | # according to note from sdodson in https://github.com/openshift/origin/issues/8571, default priority is 99, 22 | # but to ensure our local mirror is not overriden, setitng to 1 23 | priority=1 24 | 25 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/resources/reconfigure_network_fedora.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -o errexit 4 | 5 | if [[ -e /etc/fedora-release ]]; then 6 | if [[ ! -L /etc/udev/rules.d/80-net-setup-link.rules ]]; then 7 | # If it's not already done, we need to enforce the older eth* naming 8 | # sequence on Fedora machines as Vagrant isn't compatible with the 9 | # systemd197 name changes. 10 | ln -s /dev/null /etc/udev/rules.d/80-net-setup-link.rules 11 | rm -f /etc/sysconfig/network-scripts/ifcfg-enp0s3 12 | fi 13 | fi -------------------------------------------------------------------------------- /lib/vagrant-openshift/resources/rhaos31.repo: -------------------------------------------------------------------------------- 1 | [rhel-7-server-ose-3.1-rpms] 2 | name=RHEL7 Red Hat Atomic OpenShift 3.1 3 | baseurl=https://mirror.ops.rhcloud.com/enterprise/enterprise-3.1/RH7-RHAOS-3.1/x86_64/os/ 4 | https://use-mirror1.ops.rhcloud.com/enterprise/enterprise-3.1/RH7-RHAOS-3.1/x86_64/os/ 5 | https://use-mirror2.ops.rhcloud.com/enterprise/enterprise-3.1/RH7-RHAOS-3.1/x86_64/os/ 6 | https://euw-mirror1.ops.rhcloud.com/enterprise/enterprise-3.1/RH7-RHAOS-3.1/x86_64/os/ 7 | enabled=1 8 | gpgcheck=0 9 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-openshifthosted 10 | failovermethod=priority 11 | sslverify=0 12 | sslclientcert=/var/lib/yum/client-cert.pem 13 | sslclientkey=/var/lib/yum/client-key.pem -------------------------------------------------------------------------------- /lib/vagrant-openshift/resources/rhaos32.repo: -------------------------------------------------------------------------------- 1 | [rhel-7-server-ose-3.2-rpms] 2 | name=RHEL7 Red Hat Atomic OpenShift 3.2 3 | baseurl=https://mirror.ops.rhcloud.com/enterprise/enterprise-3.2/latest/RH7-RHAOS-3.2/x86_64/os/ 4 | https://use-mirror1.ops.rhcloud.com/enterprise/enterprise-3.2/latest/RH7-RHAOS-3.2/x86_64/os/ 5 | https://use-mirror2.ops.rhcloud.com/enterprise/enterprise-3.2/latest/RH7-RHAOS-3.2/x86_64/os/ 6 | https://euw-mirror1.ops.rhcloud.com/enterprise/enterprise-3.2/latest/RH7-RHAOS-3.2/x86_64/os/ 7 | enabled=1 8 | gpgcheck=0 9 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-openshifthosted 10 | failovermethod=priority 11 | sslverify=0 12 | sslclientcert=/var/lib/yum/client-cert.pem 13 | sslclientkey=/var/lib/yum/client-key.pem -------------------------------------------------------------------------------- /lib/vagrant-openshift/resources/rhaos33.repo: -------------------------------------------------------------------------------- 1 | [rhel-7-server-ose-3.3-rpms] 2 | name=RHEL7 Red Hat Atomic OpenShift 3.3 3 | baseurl=https://mirror.ops.rhcloud.com/enterprise/enterprise-3.3/latest/RH7-RHAOS-3.3/x86_64/os/ 4 | https://use-mirror1.ops.rhcloud.com/enterprise/enterprise-3.3/latest/RH7-RHAOS-3.3/x86_64/os/ 5 | https://use-mirror2.ops.rhcloud.com/enterprise/enterprise-3.3/latest/RH7-RHAOS-3.3/x86_64/os/ 6 | https://euw-mirror1.ops.rhcloud.com/enterprise/enterprise-3.3/latest/RH7-RHAOS-3.3/x86_64/os/ 7 | enabled=1 8 | gpgcheck=0 9 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-openshifthosted 10 | failovermethod=priority 11 | sslverify=0 12 | sslclientcert=/var/lib/yum/client-cert.pem 13 | sslclientkey=/var/lib/yum/client-key.pem -------------------------------------------------------------------------------- /lib/vagrant-openshift/resources/rhaos34.repo: -------------------------------------------------------------------------------- 1 | [rhel-7-server-ose-3.4-rpms] 2 | name=RHEL7 Red Hat Atomic OpenShift 3.4 3 | baseurl=https://mirror.ops.rhcloud.com/enterprise/enterprise-3.4/latest/RH7-RHAOS-3.4/x86_64/os/ 4 | https://use-mirror1.ops.rhcloud.com/enterprise/enterprise-3.4/latest/RH7-RHAOS-3.4/x86_64/os/ 5 | https://use-mirror2.ops.rhcloud.com/enterprise/enterprise-3.4/latest/RH7-RHAOS-3.4/x86_64/os/ 6 | https://euw-mirror1.ops.rhcloud.com/enterprise/enterprise-3.4/latest/RH7-RHAOS-3.4/x86_64/os/ 7 | enabled=1 8 | gpgcheck=0 9 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-openshifthosted 10 | failovermethod=priority 11 | sslverify=0 12 | sslclientcert=/var/lib/yum/client-cert.pem 13 | sslclientkey=/var/lib/yum/client-key.pem -------------------------------------------------------------------------------- /lib/vagrant-openshift/resources/rhaos35.repo: -------------------------------------------------------------------------------- 1 | [rhel-7-server-ose-3.5-rpms] 2 | name=RHEL7 Red Hat Atomic OpenShift 3.5 3 | baseurl=https://mirror.ops.rhcloud.com/enterprise/enterprise-3.5/latest/RH7-RHAOS-3.5/x86_64/os/ 4 | https://use-mirror1.ops.rhcloud.com/enterprise/enterprise-3.5/latest/RH7-RHAOS-3.5/x86_64/os/ 5 | https://use-mirror2.ops.rhcloud.com/enterprise/enterprise-3.5/latest/RH7-RHAOS-3.5/x86_64/os/ 6 | https://euw-mirror1.ops.rhcloud.com/enterprise/enterprise-3.5/latest/RH7-RHAOS-3.5/x86_64/os/ 7 | enabled=1 8 | gpgcheck=0 9 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-openshifthosted 10 | failovermethod=priority 11 | sslverify=0 12 | sslclientcert=/var/lib/yum/client-cert.pem 13 | sslclientkey=/var/lib/yum/client-key.pem -------------------------------------------------------------------------------- /lib/vagrant-openshift/resources/rhaos36.repo: -------------------------------------------------------------------------------- 1 | [rhel-7-server-ose-3.6-rpms] 2 | name=RHEL7 Red Hat Atomic OpenShift 3.6 3 | baseurl=https://mirror.ops.rhcloud.com/enterprise/enterprise-3.6/latest/RH7-RHAOS-3.6/x86_64/os/ 4 | https://use-mirror1.ops.rhcloud.com/enterprise/enterprise-3.6/latest/RH7-RHAOS-3.6/x86_64/os/ 5 | https://use-mirror2.ops.rhcloud.com/enterprise/enterprise-3.6/latest/RH7-RHAOS-3.6/x86_64/os/ 6 | https://euw-mirror1.ops.rhcloud.com/enterprise/enterprise-3.6/latest/RH7-RHAOS-3.6/x86_64/os/ 7 | enabled=1 8 | gpgcheck=0 9 | gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,https://mirror.ops.rhcloud.com/libra/keys/RPM-GPG-KEY-redhat-openshifthosted 10 | failovermethod=priority 11 | sslverify=0 12 | sslclientcert=/var/lib/yum/client-cert.pem 13 | sslclientkey=/var/lib/yum/client-key.pem -------------------------------------------------------------------------------- /lib/vagrant-openshift/templates/builder/Rakefile: -------------------------------------------------------------------------------- 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 | require 'rubygems' 18 | require 'pathname' 19 | require 'yaml' 20 | require 'tsort' 21 | require_relative 'lib/constants' 22 | require_relative 'lib/options' 23 | $stdout.sync = true 24 | $stderr.sync = true 25 | 26 | VALID_IP_ADDR_RE = Regexp.new('^(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$') 27 | -------------------------------------------------------------------------------- /lib/vagrant-openshift/templates/builder/lib/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/openshift/vagrant-openshift/92ccc5753a12e311602f42c1026d28a21c47cc52/lib/vagrant-openshift/templates/builder/lib/.gitkeep -------------------------------------------------------------------------------- /lib/vagrant-openshift/version.rb: -------------------------------------------------------------------------------- 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 | VERSION = "3.0.9" 20 | end 21 | end 22 | -------------------------------------------------------------------------------- /vagrant-openshift.gemspec: -------------------------------------------------------------------------------- 1 | # -*- encoding: utf-8 -*- 2 | #-- 3 | # Copyright 2013 Red Hat, Inc. 4 | # 5 | # Licensed under the Apache License, Version 2.0 (the "License"); 6 | # you may not use this file except in compliance with the License. 7 | # You may obtain a copy of the License at 8 | # 9 | # http://www.apache.org/licenses/LICENSE-2.0 10 | # 11 | # Unless required by applicable law or agreed to in writing, software 12 | # distributed under the License is distributed on an "AS IS" BASIS, 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | # See the License for the specific language governing permissions and 15 | # limitations under the License. 16 | #++ 17 | 18 | lib = File.expand_path('../lib', __FILE__) 19 | $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) 20 | require 'vagrant-openshift/version' 21 | 22 | Gem::Specification.new do |gem| 23 | gem.name = %q{vagrant-openshift} 24 | gem.version = Vagrant::Openshift::VERSION 25 | gem.authors = %q{Red Hat} 26 | gem.email = %q{dev@lists.openshift.redhat.com} 27 | gem.description = %q{Vagrant plugin to manage OpenShift Origin environments} 28 | gem.summary = %q{Vagrant plugin to manage OpenShift Origin environments} 29 | gem.homepage = %q{https://github.com/openshift/vagrant-openshift} 30 | 31 | gem.files = `git ls-files`.split($/) 32 | gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } 33 | gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) 34 | gem.require_paths = ["lib"] 35 | 36 | gem.add_development_dependency("rake") 37 | gem.add_development_dependency("thor") 38 | gem.add_dependency("pry") 39 | gem.add_dependency("fog") 40 | gem.add_dependency("unf") 41 | gem.add_dependency("xml-simple") 42 | gem.add_dependency("vagrant-aws") 43 | end 44 | --------------------------------------------------------------------------------