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

Replace staging module with archive module #128

Merged
merged 3 commits into from
Sep 23, 2017
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ fixtures:
repositories:
stdlib: 'https://github.com/puppetlabs/puppetlabs-stdlib.git'
inifile: 'https://github.com/puppetlabs/puppetlabs-inifile.git'
staging: 'https://github.com/voxpupuli/puppet-staging.git'
concat: 'https://github.com/puppetlabs/puppetlabs-concat.git'
archive: 'https://github.com/voxpupuli/puppet-archive.git'
symlinks:
splunk: "#{source_dir}"
14 changes: 7 additions & 7 deletions manifests/forwarder.pp
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,16 @@
$path_delimiter = $splunk::params::path_delimiter
#no need for staging the source if we have yum or apt
if $pkg_provider != undef and $pkg_provider != 'yum' and $pkg_provider != 'apt' and $pkg_provider != 'chocolatey' {
include ::staging
include ::archive::staging

$src_pkg_filename = staging_parse($package_source)
$pkg_path_parts = [$staging::path, $staging_subdir, $src_pkg_filename]
$src_pkg_filename = basename($package_source)
$pkg_path_parts = [$archive::path, $staging_subdir, $src_pkg_filename]
$staged_package = join($pkg_path_parts, $path_delimiter)

staging::file { $src_pkg_filename:
source => $package_source,
subdir => $staging_subdir,
before => Package[$package_name],
archive { $staged_package:
source => $package_source,
extract => false,
before => Package[$package_name],
}
}

Expand Down
18 changes: 8 additions & 10 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# The source URL for the splunk installation media (typically an RPM, MSI,
# etc). If a $src_root parameter is set in splunk::params, this will be
# automatically supplied. Otherwise it is required. The URL can be of any
# protocol supported by the nanliu/staging module. On Windows, this can
# protocol supported by the puppet/archive module. On Windows, this can
# be a UNC path to the MSI.
#
# [*package_name*]
Expand Down Expand Up @@ -73,17 +73,15 @@
$path_delimiter = $splunk::params::path_delimiter

if $pkg_provider != undef and $pkg_provider != 'yum' and $pkg_provider != 'apt' and $pkg_provider != 'chocolatey' {
include ::staging

$src_pkg_filename = staging_parse($package_source)
$pkg_path_parts = [$staging::path, $staging_subdir, $src_pkg_filename]
include ::archive::staging
$src_pkg_filename = basename($package_source)
$pkg_path_parts = [$archive::path, $staging_subdir, $src_pkg_filename]
$staged_package = join($pkg_path_parts, $path_delimiter)

#no need for staging the source if we have yum or apt
staging::file { $src_pkg_filename:
source => $package_source,
subdir => $staging_subdir,
before => Package[$package_name],
archive { $staged_package:
source => $package_source,
extract => false,
before => Package[$package_name],
}
}

Expand Down
2 changes: 1 addition & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
# The root URL at which to find the splunk packages. The sane-default logic
# assumes that the packages are located under this URL in the same way that
# they are placed on download.splunk.com. The URL can be any protocol that
# the nanliu/staging module supports. This includes both puppet:// and
# the puppet/archive module supports. This includes both puppet:// and
# http://. The expected directory structure is:
#
# `-- $root_url
Expand Down
4 changes: 2 additions & 2 deletions manifests/platform/solaris.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
# Requires: nothing
#
class splunk::platform::solaris inherits splunk::virtual {
include ::staging
include ::archive
include ::splunk::params
include ::splunk::platform::posix

$path = $staging::path
$path = $archive::path
Copy link
Member

Choose a reason for hiding this comment

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

There's no such variable as $archive::path

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hey @alexjfisher It does work but i might be accessing this the wrong way from the puppet archive module

image

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

The staging module created $staging::path for you. With archive, I think you'll need to include ::archive::staging instead of just ::archive ??

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member

Choose a reason for hiding this comment

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

Also needed in forwarder.pp ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

$subdir = $splunk::params::staging_subdir
$responsefile = "${path}/${subdir}/response.txt"
$adminfile = '/var/sadm/install/admin/splunk-noask'
Expand Down
8 changes: 4 additions & 4 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@
"name": "puppetlabs-inifile",
"version_requirement": ">= 1.4.1 < 2.0.0"
},
{
"name": "puppet-staging",
"version_requirement": ">= 2.0.1 < 3.0.0"
},
{
"name": "puppetlabs-concat",
"version_requirement": "4.x"
},
{
"name": "puppet-archive",
"version_requirement": ">= 2.0.0 < 3.0.0"
}
]
}
2 changes: 0 additions & 2 deletions spec/default_module_facts.yml

This file was deleted.

14 changes: 3 additions & 11 deletions spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
require 'beaker-rspec/spec_helper'
require 'beaker-rspec/helpers/serverspec'
require 'beaker/puppet_install_helper'
require 'beaker/module_install_helper'

run_puppet_install_helper unless ENV['BEAKER_provision'] == 'no'
install_module
install_module_dependencies

RSpec.configure do |c|
# Project root
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))

# Readable test descriptions
c.formatter = :documentation

# Configure all nodes in nodeset
c.before :suite do
# Install module and dependencies
# Need to stage the Splunk/Splunkforwarder packages here.
puppet_module_install(source: proj_root, module_name: 'splunk')
hosts.each do |host|
on host, puppet('module', 'install', 'puppetlabs-stdlib'), acceptable_exit_codes: [0, 1]
on host, puppet('module', 'install', 'nanliu-staging'), acceptable_exit_codes: [0, 1]
on host, puppet('module', 'install', 'puppetlabs-inifile'), acceptable_exit_codes: [0, 1]
on host, puppet('module', 'install', 'puppetlabs-concat'), acceptable_exit_codes: [0, 1]
end
end
end
27 changes: 27 additions & 0 deletions spec/spec_helper_system.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require 'rspec-system/spec_helper'
Copy link
Member

Choose a reason for hiding this comment

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

I believe spec_helper_system.rb is no longer used. Nowadays we only use spec_helper_acceptance.rb

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll get that as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

require 'rspec-system-puppet/helpers'
require 'rspec-system-serverspec/helpers'
include RSpecSystemPuppet::Helpers

RSpec.configure do |c|
# Project root
proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..'))

# Enable colour
c.tty = true

c.include RSpecSystemPuppet::Helpers

# This is where we 'setup' the nodes before running our tests
c.before :suite do
# Install puppet
puppet_install

# Install modules and dependencies
puppet_module_install(source: proj_root, module_name: 'splunk')
shell('puppet module install puppet-archive --version 2.0.0')
Copy link
Contributor

Choose a reason for hiding this comment

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

btw, it seems like this is for https://github.com/puppetlabs/rspec-system, which is deprecated and presumably not in use now that the module has beaker based acceptance tests

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No Longer applicable

Copy link
Member

Choose a reason for hiding this comment

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

please take a look at the spec_helper_acceptance here:
voxpupuli/puppet-grafana@d09835a

install_module_dependencies installs all modules from the metadata.json, install_module_from_forge is for additional dependencies.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

After #136 is merged i can do this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@bastelfreak Done.

shell('puppet module install puppetlabs-stdlib --version 3.0.0')
shell('puppet module install puppetlabs-inifile --version 1.0.0')
shell('puppet module install puppetlabs-concat --version 4.0.0')
end
end