Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(MOD-7655) SLES support for install_agent tasks #318

Merged
merged 1 commit into from
Aug 21, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions task_spec/spec/acceptance/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def inventory

it 'works with version and install tasks' do
# test the agent isn't already installed and that the version task works
results = run_task('puppet_agent::version', 'default', config: config, inventory: inventory)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing from default to target allows multiple targets defined in hosts.yaml to be tested.
For example:

  1. Generate multiple hosts
    beaker-hostgenerator sles11-64target.a-sles12-64target.a > hosts.yaml
    hosts.yaml
---
HOSTS:
  sles11-64-1:
    pe_dir: 
    pe_ver: 
    pe_upgrade_dir: 
    pe_upgrade_ver: 
    hypervisor: vmpooler
    platform: sles-11-x86_64
    packaging_platform: sles-11-x86_64
    template: sles-11-x86_64
    roles:
    - agent
    - target
  sles12-64-1:
    pe_dir: 
    pe_ver: 
    pe_upgrade_dir: 
    pe_upgrade_ver: 
    hypervisor: vmpooler
    platform: sles-12-x86_64
    packaging_platform: sles-12-x86_64
    template: sles-12-x86_64
    roles:
    - agent
    - target
CONFIG:
  nfs_server: none
  consoleport: 443
  pooling_api: http://vmpooler.delivery.puppetlabs.net/
  1. Run task acceptance tests against targets defined in hosts.yaml with BEAKER_setfile
    GEM_BOLT=true BEAKER_keyfile=~/.ssh/id_rsa-acceptance BEAKER_debug=true BEAKER_setfile=hosts.yaml bundle exec rake task_acceptance

When default is targeted instead of target the following error occurs:

     Failure/Error: expect(res).to include('status' => 'success')
       expected {"node" => "default", "result" => {"_error" => {"details" => {}, "issue_code" => "CONNECT_ERROR", "kind" => "pupp...msg" => "Failed to connect to default: getaddrinfo: Name or service not known"}}, "status" => "failure"} to include {"status" => "success"}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hadn't noticed this got rewritten to a single test case.

results = run_task('puppet_agent::version', 'target', config: config, inventory: inventory)
results.each do |res|
expect(res).to include('status' => 'success')
expect(res['result']['version']).to eq(nil)
Expand All @@ -35,7 +35,7 @@ def inventory
end

# It installed a version older than latest
results = run_task('puppet_agent::version', 'default', config: config, inventory: inventory)
results = run_task('puppet_agent::version', 'target', config: config, inventory: inventory)
results.each do |res|
expect(res).to include('status' => 'success')
expect(res['result']['version']).to eq('5.5.3')
Expand Down
13 changes: 13 additions & 0 deletions task_spec/spec/acceptance/nodesets/sles11-64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
HOSTS:
sles11-64-1:
hypervisor: vmpooler
platform: sles-11-x86_64
packaging_platform: sles-11-x86_64
template: sles-11-x86_64
roles:
- target
CONFIG:
nfs_server: none
consoleport: 443
pooling_api: http://vmpooler.delivery.puppetlabs.net/
13 changes: 13 additions & 0 deletions task_spec/spec/acceptance/nodesets/sles12-64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
HOSTS:
sles12-64-1:
hypervisor: vmpooler
platform: sles-12-x86_64
packaging_platform: sles-12-x86_64
template: sles-12-x86_64
roles:
- target
CONFIG:
nfs_server: none
consoleport: 443
pooling_api: http://vmpooler.delivery.puppetlabs.net/
19 changes: 19 additions & 0 deletions tasks/install_shell.sh
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,15 @@ install_file() {
yum install -y "puppet-agent-${puppet_agent_version}"
fi
;;
"noarch.rpm")
info "installing puppetlabs yum repo with zypper..."
zypper install --no-confirm "$2"
if test "$version" = "latest"; then
zypper install --no-confirm "puppet-agent"
else
zypper install --no-confirm --oldpackage --no-recommends --no-confirm "puppet-agent-${puppet_agent_version}"
fi
;;
"deb")
info "installing puppetlabs apt repo with dpkg..."
dpkg -i "$2"
Expand Down Expand Up @@ -445,6 +454,16 @@ case $platform in
*)
info "Downloading Puppet $version for ${platform}..."
case $platform in
"sles")
info "SLES platform! Lets get you an RPM..."
gpg_key="${tmp_dir}/RPM-GPG-KEY-puppet"
do_download "http://yum.puppetlabs.com/RPM-GPG-KEY-puppet" "$gpg_key"
rpm --import "$gpg_key"
rm -f "$gpg_key"
filetype="noarch.rpm"
filename="${collection}-release-sles-${platform_version}.noarch.rpm"
download_url="http://yum.puppetlabs.com/${collection}/${filename}"
;;
"el")
info "Red hat like platform! Lets get you an RPM..."
filetype="rpm"
Expand Down