-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move globus-timer-cli into dedicated class to avoid conflicts with gl…
…obus-cli (#30)
- Loading branch information
Showing
8 changed files
with
116 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# @summary Manage Globus Timer | ||
# | ||
# @example | ||
# include ::globus::timer | ||
# | ||
# @param ensure | ||
# The ensure parameter for PIP installed globus-timer-cli | ||
# @param install_path | ||
# Path to install Globus Timer CLI virtualenv | ||
# @param manage_python | ||
# Boolean to set if Python is managed by this class | ||
class globus::timer ( | ||
String[1] $ensure = 'present', | ||
Stdlib::Absolutepath $install_path = '/opt/globus-timer', | ||
Boolean $manage_python = true, | ||
) { | ||
|
||
if $manage_python { | ||
include globus::python | ||
} | ||
|
||
python::pyvenv { 'globus-timer': | ||
ensure => 'present', | ||
version => $globus::python::venv_python_version, | ||
venv_dir => $install_path, | ||
systempkgs => true, | ||
before => Python::Pip['globus-timer-cli'], | ||
} | ||
|
||
python::pip { 'globus-timer-cli': | ||
ensure => $ensure, | ||
pip_provider => $globus::python::pip_provider, | ||
virtualenv => $install_path, | ||
} | ||
file { '/usr/bin/globus-timer': | ||
ensure => 'link', | ||
target => "${install_path}/bin/globus-timer", | ||
require => Python::Pip['globus-timer-cli'], | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
require 'spec_helper_acceptance' | ||
|
||
describe 'globus::timer class:', unless: fact('os.name') == 'Debian' && fact('os.release.major') == '9' do | ||
context 'with default parameters' do | ||
it 'runs successfully' do | ||
pp = 'include globus::timer' | ||
|
||
apply_manifest(pp, catch_failures: true) | ||
apply_manifest(pp, catch_changes: true) | ||
end | ||
|
||
describe command('globus-timer --version') do | ||
its(:exit_status) { is_expected.to eq 0 } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
require 'spec_helper' | ||
|
||
describe 'globus::timer' do | ||
on_supported_os.each do |os, facts| | ||
context "on #{os}" do | ||
let(:facts) do | ||
facts | ||
end | ||
let(:platform_os) { "#{facts[:os]['family']}-#{facts[:os]['release']['major']}" } | ||
|
||
it { is_expected.to compile.with_all_deps } | ||
|
||
it { is_expected.to create_class('globus::timer') } | ||
|
||
it do | ||
is_expected.to contain_class('python').with( | ||
version: platforms[platform_os][:python_version], | ||
dev: 'present', | ||
) | ||
end | ||
|
||
it do | ||
is_expected.to contain_python__pyvenv('globus-timer').with( | ||
'ensure' => 'present', | ||
'version' => platforms[platform_os][:venv_python_version], | ||
'venv_dir' => '/opt/globus-timer', | ||
'systempkgs' => 'true', | ||
) | ||
end | ||
it { is_expected.to contain_python__pyvenv('globus-timer').that_comes_before('Python::Pip[globus-timer-cli]') } | ||
|
||
it do | ||
is_expected.to contain_python__pip('globus-timer-cli').with( | ||
'ensure' => 'present', | ||
'pip_provider' => platforms[platform_os][:pip_provider], | ||
'virtualenv' => '/opt/globus-timer', | ||
) | ||
end | ||
|
||
it do | ||
is_expected.to contain_file('/usr/bin/globus-timer').with( | ||
'ensure' => 'link', | ||
'target' => '/opt/globus-timer/bin/globus-timer', | ||
) | ||
end | ||
end | ||
end | ||
end |