Skip to content
Open
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
2 changes: 1 addition & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fixtures:
forge_modules:
stdlib: 'puppetlabs/stdlib'
wget: 'maestrodev/wget'
archive: 'puppet/archive'
symlinks:
nexus: "#{source_dir}"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Install and configure Sonatype Nexus.

## Requires
* maestrodev/wget
* puppet/archive
* puppetlabs/stdlib

## Usage
Expand Down
6 changes: 4 additions & 2 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@
$nexus_data_folder = $nexus::params::nexus_data_folder,
$download_folder = $nexus::params::download_folder,
$manage_config = $nexus::params::manage_config,
$md5sum = $nexus::params::md5sum,
$checksum = $nexus::params::checksum,
$checksum_type = $nexus::params::checksum_type,
) inherits nexus::params {
include stdlib

Expand Down Expand Up @@ -113,7 +114,8 @@
nexus_work_dir => $real_nexus_work_dir,
nexus_work_dir_manage => $nexus_work_dir_manage,
nexus_work_recurse => $nexus_work_recurse,
md5sum => $md5sum,
checksum => $checksum,
checksum_type => $checksum_type,
notify => Class['nexus::service']
}

Expand Down
14 changes: 8 additions & 6 deletions manifests/package.pp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
$nexus_work_recurse = $::nexus::nexus_work_recurse,
$nexus_selinux_ignore_defaults = $::nexus::nexus_selinux_ignore_defaults,
$download_folder = $::nexus::download_folder,
$md5sum = $::nexus::md5sum,
$checksum = $::nexus::checksum,
$checksum_type = $::nexus::checksum_type,
) {

$nexus_home = "${nexus_root}/${nexus_home_dir}"
Expand All @@ -68,11 +69,12 @@
# NOTE: I *think* this won't repeatedly download the file because it's
# linked to an exec resource which won't be realized if a directory
# already exists.
wget::fetch{ $nexus_archive:
source => $download_url,
destination => $dl_file,
source_hash => $md5sum,
before => Exec['nexus-untar'],
archive{ $nexus_archive:
source => $download_url,
path => $dl_file,
checksum => $checksum,
checksum_type => $checksum_type,
before => Exec['nexus-untar'],
}

exec{ 'nexus-untar':
Expand Down
3 changes: 2 additions & 1 deletion manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@
$nexus_data_folder = undef
$download_folder = '/srv'
$manage_config = true
$md5sum = undef
$checksum = undef
$checksum_type = 'none'
}
4 changes: 2 additions & 2 deletions metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@
"version_requirement": ">=0.0.0 <5.0.0"
},
{
"name": "maestrodev/wget",
"version_requirement": ">=1.0.0 <2.0.0"
"name": "puppet/archive",
"version_requirement": ">=0.4.4 <4.0.0"
}
]
}
3 changes: 2 additions & 1 deletion spec/acceptance/checksum_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
class{ '::nexus':
version => '2.8.0',
revision => '05',
md5sum => 'e1cece1ae5eb3a12f857e2368a3e9dbc',
checksum => 'e1cece1ae5eb3a12f857e2368a3e9dbc',
checksum_type => 'md5',
nexus_root => '/srv',
}
EOS
Expand Down
25 changes: 14 additions & 11 deletions spec/classes/package_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,18 +24,19 @@
'revision' => '01',
'version' => '2.11.2',
'download_folder' => '/srv',
'md5sum' => '',
'checksum' => '',
'checksum_type' => 'none'
}
}

context 'with default values' do
it { should contain_class('nexus::package') }

it { should contain_wget__fetch('nexus-2.11.2-01-bundle.tar.gz').with(
it { should contain_archive('nexus-2.11.2-01-bundle.tar.gz').with(
'source' => 'http://download.sonatype.com/nexus/oss/nexus-2.11.2-01-bundle.tar.gz',
'destination' => '/srv/nexus-2.11.2-01-bundle.tar.gz',
'path' => '/srv/nexus-2.11.2-01-bundle.tar.gz',
'before' => 'Exec[nexus-untar]',
'source_hash' => '',
'checksum' => ''
) }

it { should contain_exec('nexus-untar').with(
Expand Down Expand Up @@ -74,9 +75,9 @@
}
)

should contain_wget__fetch('nexus-professional-2.11.2-01-bundle.tar.gz').with(
should contain_archive('nexus-professional-2.11.2-01-bundle.tar.gz').with(
'source' => 'http://download.sonatype.com/nexus/professional-bundle/nexus-professional-2.11.2-01-bundle.tar.gz',
'destination' => '/srv/nexus-professional-2.11.2-01-bundle.tar.gz',
'path' => '/srv/nexus-professional-2.11.2-01-bundle.tar.gz',
)

should contain_exec('nexus-untar').with(
Expand All @@ -94,15 +95,17 @@
it 'should working with md5sum' do
params.merge!(
{
'md5sum' => '1234567890'
'checksum' => '1234567890',
'checksum_type' => 'md5',
}
)
should contain_wget__fetch('nexus-2.11.2-01-bundle.tar.gz').with(
should contain_archive('nexus-2.11.2-01-bundle.tar.gz').with(
'source' => 'http://download.sonatype.com/nexus/oss/nexus-2.11.2-01-bundle.tar.gz',
'destination' => '/srv/nexus-2.11.2-01-bundle.tar.gz',
'path' => '/srv/nexus-2.11.2-01-bundle.tar.gz',
'before' => 'Exec[nexus-untar]',
'source_hash' => '1234567890',
)
'checksum' => '1234567890',
'checksum_type' => 'md5',
)
should contain_exec('nexus-untar').with(
'command' => 'tar zxf /srv/nexus-2.11.2-01-bundle.tar.gz --directory /srv',
'creates' => '/srv/nexus-2.11.2-01',
Expand Down
2 changes: 1 addition & 1 deletion spec/spec_helper_acceptance.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
shell("/bin/touch #{default['puppetpath']}/hiera.yaml")
shell('puppet module install puppetlabs-stdlib', { :acceptable_exit_codes => [0,1] })
shell('puppet module install puppetlabs-java', { :acceptable_exit_codes => [0,1] })
shell('puppet module install maestrodev-wget', { :acceptable_exit_codes => [0,1] })
shell('puppet module install puppet-archive', { :acceptable_exit_codes => [0,1] })
end
end
end