Skip to content
Closed
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
3 changes: 2 additions & 1 deletion manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@
$katello_default_ca_cert = "${pki_dir}/certs/${default_ca_name}.crt"

if $tar_file {
certs::tar_extract { $tar_file:
class { 'certs::tar_extract':
path => $tar_file,
before => Class['certs::install'],
}
}
Expand Down
13 changes: 4 additions & 9 deletions manifests/tar_extract.pp
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
# Definition: certs::tar_extract
#
# This class extracts a tarball
#
# @summary This class extracts a tarball
# @api private
# Parameters:
# - The $path of the tarball to extract
#
# Actions:
# - Extracts a tarball
#
define certs::tar_extract (
Stdlib::Absolutepath $path = $title,
class certs::tar_extract (
Stdlib::Absolutepath $path,
) {
validate_file_exists($path)

Expand Down
31 changes: 31 additions & 0 deletions spec/classes/certs_tar_extract_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
require 'spec_helper'

describe 'certs::tar_extract' do
on_supported_os.each do |os, os_facts|
context "on #{os}" do
let :facts do
os_facts
end

let(:params) { { path: '/some/other/path/with/certs.tar' } }

describe 'with default parameters' do
it { should compile.with_all_deps }
end

it do
allow(File).to receive(:exist?).and_call_original
allow(File).to receive(:exist?).with('/some/other/path/with/certs.tar').and_return(true)

is_expected.to compile.with_all_deps
is_expected.to contain_exec('extract /some/other/path/with/certs.tar')
.with_cwd('/root')
.with_path(['/usr/bin', '/bin'])
.with_command('tar -xaf /some/other/path/with/certs.tar')

expect(File).not_to have_received(:exist?).with('/path/to/certs.tar')
expect(File).to have_received(:exist?).with('/some/other/path/with/certs.tar')
end
end
end
end
38 changes: 0 additions & 38 deletions spec/defines/tar_extract_spec.rb

This file was deleted.

Loading