Skip to content
This repository has been archived by the owner on May 5, 2023. It is now read-only.

Release 1.0.7 #100

Merged
merged 2 commits into from
Jun 10, 2016
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
2 changes: 1 addition & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Lint/LiteralInInterpolation:
Enabled: true

Style/HashSyntax:
Enabled: true
EnforcedStyle: hash_rockets

Style/RedundantReturn:
Enabled: true
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
* Allow to pass in the full path to a file instead of specifying the file name explictly
* Revocation of 1.0.6 (wrong semver)

## 2016/06/10 - Release 1.0.7

* Last Release with Ruby1.8 support!

## 2016/03/20 - Release 1.0.6

* Publish the first version of this module in the puppet namespace.
* Accidently removed Ruby1.8 support
2 changes: 1 addition & 1 deletion lib/facter/staging_windir.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Facter.add(:staging_windir) do
confine osfamily: :windows
confine :osfamily => :windows
setcode do
program_data = `echo %SYSTEMDRIVE%\\ProgramData`.chomp
if File.directory? program_data
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/scope_defaults.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Puppet::Parser::Functions
newfunction(:scope_defaults, type: :rvalue, doc: <<-EOS
newfunction(:scope_defaults, :type => :rvalue, :doc => <<-EOS
Determine if specified resource defaults have a attribute defined in
current scope.
EOS
Expand Down
2 changes: 1 addition & 1 deletion lib/puppet/parser/functions/staging_parse.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
require 'uri'

module Puppet::Parser::Functions
newfunction(:staging_parse, type: :rvalue, doc: <<-EOS
newfunction(:staging_parse, :type => :rvalue, :doc => <<-EOS
Parse filepath to retrieve information about the file.
EOS
) do |arguments|
Expand Down
2 changes: 1 addition & 1 deletion metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
],
"name": "puppet-staging",
"description": "Manages compressed file staging and deployment.",
"version": "2.0.1-rc0",
"version": "1.0.7",
"author": "voxpupuli",
"summary": "Compressed file staging and deployment",
"license": "Apache-2.0",
Expand Down
62 changes: 31 additions & 31 deletions spec/defines/staging_deploy_spec.rb
Original file line number Diff line number Diff line change
@@ -1,56 +1,56 @@
require 'spec_helper'
describe 'staging::deploy', type: :define do
describe 'staging::deploy', :type => :define do
let(:facts) do
{
caller_module_name: '',
osfamily: 'RedHat',
staging_http_get: 'curl',
path: '/usr/local/bin:/usr/bin:/bin'
:caller_module_name => '',
:osfamily => 'RedHat',
:staging_http_get => 'curl',
:path => '/usr/local/bin:/usr/bin:/bin'
}
end

describe 'when deploying tar.gz' do
let(:title) { 'sample.tar.gz' }
let(:params) do
{
source: 'puppet:///modules/staging/sample.tar.gz',
target: '/usr/local'
:source => 'puppet:///modules/staging/sample.tar.gz',
:target => '/usr/local'
}
end

it { should contain_file('/opt/staging') }
it { should contain_file('/opt/staging//sample.tar.gz') }
it do
should contain_exec('extract sample.tar.gz').with(command: 'tar xzf /opt/staging//sample.tar.gz',
path: '/usr/local/bin:/usr/bin:/bin',
cwd: '/usr/local',
creates: '/usr/local/sample')
should contain_exec('extract sample.tar.gz').with(:command => 'tar xzf /opt/staging//sample.tar.gz',
:path => '/usr/local/bin:/usr/bin:/bin',
:cwd => '/usr/local',
:creates => '/usr/local/sample')
end
end

describe 'when deploying tar.gz with full path in title and no source' do
let(:title) { 'puppet:///modules/staging/sample.tar.gz' }
let(:params) do
{
target: '/usr/local'
:target => '/usr/local'
}
end

it { should contain_file('/opt/staging') }
it { should contain_file('/opt/staging//sample.tar.gz') }
it do
should contain_exec('extract sample.tar.gz').with(command: 'tar xzf /opt/staging//sample.tar.gz',
path: '/usr/local/bin:/usr/bin:/bin',
cwd: '/usr/local',
creates: '/usr/local/sample')
should contain_exec('extract sample.tar.gz').with(:command => 'tar xzf /opt/staging//sample.tar.gz',
:path => '/usr/local/bin:/usr/bin:/bin',
:cwd => '/usr/local',
:creates => '/usr/local/sample')
end
end

describe 'fail when deploying tar.gz with filename in title and no source' do
let(:title) { 'sample.tar.gz' }
let(:params) do
{
target: '/usr/local'
:target => '/usr/local'
}
end

Expand All @@ -65,36 +65,36 @@
let(:title) { 'sample.tar.gz' }
let(:params) do
{
source: 'puppet:///modules/staging/sample.tar.gz',
target: '/usr/local',
strip: 1
:source => 'puppet:///modules/staging/sample.tar.gz',
:target => '/usr/local',
:strip => 1
}
end

it { should contain_file('/opt/staging') }
it { should contain_file('/opt/staging//sample.tar.gz') }
it do
should contain_exec('extract sample.tar.gz').with(command: 'tar xzf /opt/staging//sample.tar.gz --strip=1',
path: '/usr/local/bin:/usr/bin:/bin',
cwd: '/usr/local',
creates: '/usr/local/sample')
should contain_exec('extract sample.tar.gz').with(:command => 'tar xzf /opt/staging//sample.tar.gz --strip=1',
:path => '/usr/local/bin:/usr/bin:/bin',
:cwd => '/usr/local',
:creates => '/usr/local/sample')
end
end

describe 'when deploying zip file with unzip_opts' do
let(:title) { 'sample.zip' }
let(:params) do
{ source: 'puppet:///modules/staging/sample.tar.gz',
target: '/usr/local',
unzip_opts: '-o -f' }
{ :source => 'puppet:///modules/staging/sample.tar.gz',
:target => '/usr/local',
:unzip_opts => '-o -f' }
end
it { should contain_file('/opt/staging') }
it { should contain_file('/opt/staging//sample.zip') }
it do
should contain_exec('extract sample.zip').with(command: 'unzip -o -f /opt/staging//sample.zip',
path: '/usr/local/bin:/usr/bin:/bin',
cwd: '/usr/local',
creates: '/usr/local/sample')
should contain_exec('extract sample.zip').with(:command => 'unzip -o -f /opt/staging//sample.zip',
:path => '/usr/local/bin:/usr/bin:/bin',
:cwd => '/usr/local',
:creates => '/usr/local/sample')
end
end
end
114 changes: 57 additions & 57 deletions spec/defines/staging_extract_spec.rb
Original file line number Diff line number Diff line change
@@ -1,156 +1,156 @@
require 'spec_helper'
describe 'staging::extract', type: :define do
describe 'staging::extract', :type => :define do
# forcing a more sane caller_module_name to match real usage.
let(:facts) do
{
osfamily: 'RedHat',
path: '/usr/local/bin:/usr/bin:/bin'
:osfamily => 'RedHat',
:path => '/usr/local/bin:/usr/bin:/bin'
}
end

describe 'when deploying tar.gz' do
let(:title) { 'sample.tar.gz' }
let(:params) { { target: '/opt' } }
let(:params) { { :target => '/opt' } }

it do
should contain_file('/opt/staging')
should contain_exec('extract sample.tar.gz').with(command: 'tar xzf /opt/staging//sample.tar.gz',
path: '/usr/local/bin:/usr/bin:/bin',
cwd: '/opt',
creates: '/opt/sample')
should contain_exec('extract sample.tar.gz').with(:command => 'tar xzf /opt/staging//sample.tar.gz',
:path => '/usr/local/bin:/usr/bin:/bin',
:cwd => '/opt',
:creates => '/opt/sample')
end
end

describe 'when deploying tar.gz with strip' do
let(:title) { 'sample.tar.gz' }
let(:params) do
{ target: '/opt',
strip: 1 }
{ :target => '/opt',
:strip => 1 }
end

it do
should contain_file('/opt/staging')
should contain_exec('extract sample.tar.gz').with(command: 'tar xzf /opt/staging//sample.tar.gz --strip=1',
path: '/usr/local/bin:/usr/bin:/bin',
cwd: '/opt',
creates: '/opt/sample')
should contain_exec('extract sample.tar.gz').with(:command => 'tar xzf /opt/staging//sample.tar.gz --strip=1',
:path => '/usr/local/bin:/usr/bin:/bin',
:cwd => '/opt',
:creates => '/opt/sample')
end
end

describe 'when deploying tbz2' do
let(:title) { 'sample.tbz2' }
let(:params) { { target: '/opt' } }
let(:params) { { :target => '/opt' } }

it do
should contain_file('/opt/staging')
should contain_exec('extract sample.tbz2').with(command: 'tar xjf /opt/staging//sample.tbz2',
path: '/usr/local/bin:/usr/bin:/bin',
cwd: '/opt',
creates: '/opt/sample')
should contain_exec('extract sample.tbz2').with(:command => 'tar xjf /opt/staging//sample.tbz2',
:path => '/usr/local/bin:/usr/bin:/bin',
:cwd => '/opt',
:creates => '/opt/sample')
end
end

describe 'when deploying zip' do
let(:title) { 'sample.zip' }
let(:params) { { target: '/opt' } }
let(:params) { { :target => '/opt' } }

it do
should contain_file('/opt/staging')
should contain_exec('extract sample.zip').with(command: 'unzip /opt/staging//sample.zip',
path: '/usr/local/bin:/usr/bin:/bin',
cwd: '/opt',
creates: '/opt/sample')
should contain_exec('extract sample.zip').with(:command => 'unzip /opt/staging//sample.zip',
:path => '/usr/local/bin:/usr/bin:/bin',
:cwd => '/opt',
:creates => '/opt/sample')
end
end

describe 'when deploying zip with unzip_opts' do
let(:title) { 'sample.zip' }
let(:params) do
{
target: '/opt',
unzip_opts: '-o -f'
:target => '/opt',
:unzip_opts => '-o -f'
}
end
it do
should contain_file('/opt/staging')
should contain_exec('extract sample.zip').with(command: 'unzip -o -f /opt/staging//sample.zip',
path: '/usr/local/bin:/usr/bin:/bin',
cwd: '/opt',
creates: '/opt/sample')
should contain_exec('extract sample.zip').with(:command => 'unzip -o -f /opt/staging//sample.zip',
:path => '/usr/local/bin:/usr/bin:/bin',
:cwd => '/opt',
:creates => '/opt/sample')
end
end

describe 'when deploying zip with strip (noop)' do
let(:title) { 'sample.zip' }
let(:params) do
{
target: '/opt',
strip: 1
:target => '/opt',
:strip => 1
}
end

it do
should contain_file('/opt/staging')
should contain_exec('extract sample.zip').with(command: 'unzip /opt/staging//sample.zip',
path: '/usr/local/bin:/usr/bin:/bin',
cwd: '/opt',
creates: '/opt/sample')
should contain_exec('extract sample.zip').with(:command => 'unzip /opt/staging//sample.zip',
:path => '/usr/local/bin:/usr/bin:/bin',
:cwd => '/opt',
:creates => '/opt/sample')
end
end

describe 'when deploying war' do
let(:title) { 'sample.war' }
let(:params) { { target: '/opt' } }
let(:params) { { :target => '/opt' } }
it do
should contain_file('/opt/staging')
should contain_exec('extract sample.war').with(command: 'jar xf /opt/staging//sample.war',
path: '/usr/local/bin:/usr/bin:/bin',
cwd: '/opt',
creates: '/opt/sample')
should contain_exec('extract sample.war').with(:command => 'jar xf /opt/staging//sample.war',
:path => '/usr/local/bin:/usr/bin:/bin',
:cwd => '/opt',
:creates => '/opt/sample')
end
end

describe 'when deploying war with strip (noop) and unzip_opts (noop)' do
let(:title) { 'sample.war' }
let(:params) do
{
target: '/opt',
strip: 1,
unzip_opts: '-o -f'
:target => '/opt',
:strip => 1,
:unzip_opts => '-o -f'
}
end
it do
should contain_file('/opt/staging')
should contain_exec('extract sample.war').with(command: 'jar xf /opt/staging//sample.war',
path: '/usr/local/bin:/usr/bin:/bin',
cwd: '/opt',
creates: '/opt/sample')
should contain_exec('extract sample.war').with(:command => 'jar xf /opt/staging//sample.war',
:path => '/usr/local/bin:/usr/bin:/bin',
:cwd => '/opt',
:creates => '/opt/sample')
end
end

describe 'when deploying deb on a Debian family system' do
let(:facts) do
{
osfamily: 'Debian',
path: '/usr/local/bin:/usr/bin:/bin'
:osfamily => 'Debian',
:path => '/usr/local/bin:/usr/bin:/bin'
}
end
let(:title) { 'sample.deb' }
let(:params) { { target: '/opt' } }
let(:params) { { :target => '/opt' } }

it do
should contain_file('/opt/staging')
should contain_exec('extract sample.deb').with(command: 'dpkg --extract /opt/staging//sample.deb .',
path: '/usr/local/bin:/usr/bin:/bin',
cwd: '/opt',
creates: '/opt/sample')
should contain_exec('extract sample.deb').with(:command => 'dpkg --extract /opt/staging//sample.deb .',
:path => '/usr/local/bin:/usr/bin:/bin',
:cwd => '/opt',
:creates => '/opt/sample')
end
end

describe 'when deploying deb on a non-Debian family system' do
let(:title) { 'sample.deb' }
let(:params) do
{ target: '/opt' }
{ :target => '/opt' }
end
it 'fails' do
should compile.and_raise_error(%r{The .deb filetype is only supported on Debian family systems.})
Expand All @@ -159,7 +159,7 @@

describe 'when deploying unknown' do
let(:title) { 'sample.zzz' }
let(:params) { { target: '/opt' } }
let(:params) { { :target => '/opt' } }

it { expect { should contain_exec('exec sample.zzz') }.to raise_error(Puppet::Error) }
end
Expand Down
Loading