[Pkg-puppet-devel] [facter] 58/352: (#23135) Support deploying to Solaris and Windows vcloud machines
Stig Sandbeck Mathisen
ssm at debian.org
Sun Apr 6 22:21:31 UTC 2014
This is an automated email from the git hooks/post-receive script.
ssm pushed a commit to branch master
in repository facter.
commit 681de633d2250fd967816102b05e423fee30d1f3
Author: Branan Purvine-Riley <branan at puppetlabs.com>
Date: Tue Nov 12 11:22:29 2013 -0800
(#23135) Support deploying to Solaris and Windows vcloud machines
Previously, the acceptance suite could only target linux boxen. This
commit adds beaker configs for solaris and windows, and also makes the
setup steps more cross-platform-friendly.
---
acceptance/config/solaris-11.cfg | 22 +++++++++
acceptance/config/windows-2003.cfg | 22 +++++++++
acceptance/lib/puppet/acceptance/install_utils.rb | 54 +++++++++++++++++++++++
acceptance/setup/00_EnvSetup.rb | 38 ++++++++++++++++
acceptance/setup/00_install_git.rb | 13 ------
5 files changed, 136 insertions(+), 13 deletions(-)
diff --git a/acceptance/config/solaris-11.cfg b/acceptance/config/solaris-11.cfg
new file mode 100644
index 0000000..c9989fc
--- /dev/null
+++ b/acceptance/config/solaris-11.cfg
@@ -0,0 +1,22 @@
+HOSTS:
+ centos-6-x86_64:
+ roles:
+ - master
+ - database
+ - agent
+ - dashboard
+ platform: el-6-x86_64
+ hypervisor: vcloud
+ template: centos-6-x86_64
+ solaris-11-x86_64:
+ roles:
+ - agent
+ platform: solaris-11-x86_64
+ hypervisor: vcloud
+ template: solaris-11-x86_64
+CONFIG:
+ nfs_server: NONE
+ consoleport: 443
+ datastore: instance0
+ folder: Delivery/Quality Assurance/FOSS/Dynamic
+ resourcepool: delivery/Quality Assurance/FOSS/Dynamic
diff --git a/acceptance/config/windows-2003.cfg b/acceptance/config/windows-2003.cfg
new file mode 100644
index 0000000..e8fd2c9
--- /dev/null
+++ b/acceptance/config/windows-2003.cfg
@@ -0,0 +1,22 @@
+HOSTS:
+ centos-6-x86_64:
+ roles:
+ - master
+ - database
+ - agent
+ - dashboard
+ platform: el-6-x86_64
+ hypervisor: vcloud
+ template: centos-6-x86_64
+ win2003-32:
+ roles:
+ - agent
+ platform: windows-2003-32
+ hypervisor: vcloud
+ template: win-2003-i386
+CONFIG:
+ nfs_server: NONE
+ consoleport: 443
+ datastore: instance0
+ folder: Delivery/Quality Assurance/FOSS/Dynamic
+ resourcepool: delivery/Quality Assurance/FOSS/Dynamic
diff --git a/acceptance/lib/puppet/acceptance/install_utils.rb b/acceptance/lib/puppet/acceptance/install_utils.rb
new file mode 100644
index 0000000..cca5b77
--- /dev/null
+++ b/acceptance/lib/puppet/acceptance/install_utils.rb
@@ -0,0 +1,54 @@
+require 'open-uri'
+
+module Puppet
+ module Acceptance
+ module InstallUtils
+ PLATFORM_PATTERNS = {
+ :redhat => /fedora|el|centos/,
+ :debian => /debian|ubuntu/,
+ :solaris => /solaris/,
+ :windows => /windows/,
+ }.freeze
+
+ # Installs packages on the hosts.
+ #
+ # @param hosts [Array<Host>] Array of hosts to install packages to.
+ # @param package_hash [Hash{Symbol=>Array<String,Array<String,String>>}]
+ # Keys should be a symbol for a platform in PLATFORM_PATTERNS. Values
+ # should be an array of package names to install, or of two element
+ # arrays where a[0] is the command we expect to find on the platform
+ # and a[1] is the package name (when they are different).
+ # @param options [Hash{Symbol=>Boolean}]
+ # @option options [Boolean] :check_if_exists First check to see if
+ # command is present before installing package. (Default false)
+ # @return true
+ def install_packages_on(hosts, package_hash, options = {})
+ check_if_exists = options[:check_if_exists]
+ hosts = [hosts] unless hosts.kind_of?(Array)
+ hosts.each do |host|
+ package_hash.each do |platform_key,package_list|
+ if pattern = PLATFORM_PATTERNS[platform_key]
+ if pattern.match(host['platform'])
+ package_list.each do |cmd_pkg|
+ if cmd_pkg.kind_of?(Array)
+ command, package = cmd_pkg
+ else
+ command = package = cmd_pkg
+ end
+ if !check_if_exists || !host.check_for_package(command)
+ host.logger.notify("Installing #{package}")
+ additional_switches = '--allow-unauthenticated' if platform_key == :debian
+ host.install_package(package, additional_switches)
+ end
+ end
+ end
+ else
+ raise("Unknown platform '#{platform_key}' in package_hash")
+ end
+ end
+ end
+ return true
+ end
+ end
+ end
+end
diff --git a/acceptance/setup/00_EnvSetup.rb b/acceptance/setup/00_EnvSetup.rb
new file mode 100644
index 0000000..5794013
--- /dev/null
+++ b/acceptance/setup/00_EnvSetup.rb
@@ -0,0 +1,38 @@
+test_name "Setup environment"
+
+step "Ensure Git and Ruby"
+
+require 'puppet/acceptance/install_utils'
+extend Puppet::Acceptance::InstallUtils
+
+PACKAGES = {
+ :redhat => [
+ 'git',
+ 'ruby',
+ ],
+ :debian => [
+ ['git', 'git-core'],
+ 'ruby',
+ ],
+ :solaris => [
+ ['git', 'developer/versioning/git'],
+ ['ruby', 'runtime/ruby-18'],
+ ],
+ :windows => [
+ 'git',
+ ],
+}
+
+install_packages_on(hosts, PACKAGES, :check_if_exists => true)
+
+hosts.each do |host|
+ if host['platform'] =~ /windows/
+ on host, 'echo $PATH'
+ on host, 'git clone https://github.com/puppetlabs/puppet-win32-ruby'
+ on host, 'cp -r puppet-win32-ruby/ruby/* /'
+ on host, 'cd /lib; icacls ruby /grant "Everyone:(OI)(CI)(RX)"'
+ on host, 'cd /lib; icacls ruby /reset /T'
+ on host, 'ruby --version'
+ on host, 'cmd /c gem list'
+ end
+end
diff --git a/acceptance/setup/00_install_git.rb b/acceptance/setup/00_install_git.rb
deleted file mode 100644
index 21a3f14..0000000
--- a/acceptance/setup/00_install_git.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-test_name "Install Git"
-
-hosts.each do |host|
- case host['platform']
- when /el-|fc-/
- step 'Installing Git'
- on host, 'yum -y install git'
- when /debian-|ubuntu-/
- step 'Installing Git'
- on host, 'apt-get -y install git-core'
- else
- end
-end
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-puppet/facter.git
More information about the Pkg-puppet-devel
mailing list