Skip to content

Commit d5d200c

Browse files
committed
Use Python 3 for globus::cli and globus::sdk
1 parent a0aa7a4 commit d5d200c

12 files changed

Lines changed: 59 additions & 135 deletions

File tree

data/os/RedHat.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
globus::url_os: el
33
globus::repo_dependencies:
44
- yum-plugin-priorities
5+
globus::python::version: '3'
6+
globus::python::pip_provider: pip3
7+
globus::python::venv_python_version: '3.6'

data/os/RedHat/7.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

data/os/RedHat/8.yaml

Lines changed: 0 additions & 6 deletions
This file was deleted.

manifests/cli.pp

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,10 @@
99
# Path to install Globus CLI virtualenv
1010
# @param manage_python
1111
# Boolean to set if Python is managed by this class
12-
# @param virtualenv_provider
13-
# Virtualenv command to use
14-
# @param pip_provider
15-
# Pip command to use
1612
class globus::cli (
1713
String[1] $ensure = 'present',
1814
Stdlib::Absolutepath $install_path = '/opt/globus-cli',
1915
Boolean $manage_python = true,
20-
String $virtualenv_provider = 'virtualenv',
21-
String $pip_provider = 'pip',
2216
) {
2317

2418
if $facts.dig('os','name') == 'Ubuntu' and $facts.dig('os','release','major') == '20.04' {
@@ -27,36 +21,18 @@
2721

2822
if $manage_python {
2923
include globus::python
30-
$virtualenv_require = Package['virtualenv']
31-
} else {
32-
$virtualenv_require = undef
3324
}
3425

35-
if $facts['os']['family'] == 'RedHat' {
36-
python::virtualenv { 'globus-cli':
37-
ensure => 'present',
38-
version => $globus::python::version,
39-
virtualenv => $virtualenv_provider,
40-
venv_dir => $install_path,
41-
distribute => false,
42-
before => Python::Pip['globus-cli'],
43-
require => $virtualenv_require,
44-
}
45-
} elsif $facts['os']['family'] == 'Debian' {
46-
python::pyvenv { 'globus-cli':
47-
ensure => 'present',
48-
version => $globus::python::version,
49-
venv_dir => $install_path,
50-
before => Python::Pip['globus-cli'],
51-
require => $virtualenv_require,
52-
}
53-
} else {
54-
fail('globus::cli: Unsupported OS family')
26+
python::pyvenv { 'globus-cli':
27+
ensure => 'present',
28+
version => $globus::python::venv_python_version,
29+
venv_dir => $install_path,
30+
before => Python::Pip['globus-cli'],
5531
}
5632

5733
python::pip { 'globus-cli':
5834
ensure => $ensure,
59-
pip_provider => $pip_provider,
35+
pip_provider => $globus::python::pip_provider,
6036
virtualenv => $install_path,
6137
}
6238

manifests/python.pp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
# @summary Manage Globus Python dependency
22
# @api private
33
class globus::python (
4-
String $version = 'system',
4+
String $version = '3',
5+
String $pip_provider = 'pip',
6+
String $venv_python_version = 'system',
57
) {
68
class { 'python':
7-
version => $version,
8-
virtualenv => 'present',
9+
version => $version,
910
}
1011
}

manifests/sdk.pp

Lines changed: 6 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,10 @@
99
# Path to install Globus CLI virtualenv
1010
# @param manage_python
1111
# Boolean to set if Python is managed by this class
12-
# @param virtualenv_provider
13-
# Virtualenv command to use
14-
# @param pip_provider
15-
# Pip command to use
1612
class globus::sdk (
1713
String[1] $ensure = 'present',
1814
Stdlib::Absolutepath $install_path = '/opt/globus-sdk',
1915
Boolean $manage_python = true,
20-
String $virtualenv_provider = '/usr/bin/virtualenv',
21-
String $pip_provider = 'pip',
2216
) {
2317

2418
if $facts.dig('os','name') == 'Ubuntu' and $facts.dig('os','release','major') == '20.04' {
@@ -27,36 +21,18 @@
2721

2822
if $manage_python {
2923
include globus::python
30-
$virtualenv_require = Package['virtualenv']
31-
} else {
32-
$virtualenv_require = undef
3324
}
3425

35-
if $facts['os']['family'] == 'RedHat' {
36-
python::virtualenv { 'globus-sdk':
37-
ensure => 'present',
38-
version => $globus::python::version,
39-
virtualenv => $virtualenv_provider,
40-
venv_dir => $install_path,
41-
distribute => false,
42-
before => Python::Pip['globus-sdk'],
43-
require => $virtualenv_require,
44-
}
45-
} elsif $facts['os']['family'] == 'Debian' {
46-
python::pyvenv { 'globus-sdk':
47-
ensure => 'present',
48-
version => $globus::python::version,
49-
venv_dir => $install_path,
50-
before => Python::Pip['globus-sdk'],
51-
require => $virtualenv_require,
52-
}
53-
} else {
54-
fail('globus::sdk: Unsupported OS family')
26+
python::pyvenv { 'globus-sdk':
27+
ensure => 'present',
28+
version => $globus::python::venv_python_version,
29+
venv_dir => $install_path,
30+
before => Python::Pip['globus-sdk'],
5531
}
5632

5733
python::pip { 'globus-sdk':
5834
ensure => $ensure,
59-
pip_provider => $pip_provider,
35+
pip_provider => $globus::python::pip_provider,
6036
virtualenv => $install_path,
6137
}
6238
}

spec/acceptance/globus_cli_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@
88
apply_manifest(pp, catch_failures: true)
99
apply_manifest(pp, catch_changes: true)
1010
end
11+
12+
describe command('globus --version') do
13+
its(:exit_status) { is_expected.to eq 0 }
14+
end
1115
end
1216
end

spec/acceptance/globus_sdk_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,9 @@
88
apply_manifest(pp, catch_failures: true)
99
apply_manifest(pp, catch_changes: true)
1010
end
11+
12+
describe command("/opt/globus-cli/bin/python -c 'import globus_sdk'") do
13+
its(:exit_status) { is_expected.to eq 0 }
14+
end
1115
end
1216
end

spec/classes/globus_cli_spec.rb

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,17 @@
1919
it do
2020
is_expected.to contain_class('python').with(
2121
version: platforms[platform_os][:python_version],
22-
virtualenv: 'present',
2322
)
2423
end
2524

26-
if facts[:os]['family'] == 'RedHat'
27-
it do
28-
is_expected.to contain_python__virtualenv('globus-cli').with(
29-
'ensure' => 'present',
30-
'version' => platforms[platform_os][:python_version],
31-
'virtualenv' => platforms[platform_os][:virtualenv_provider],
32-
'venv_dir' => '/opt/globus-cli',
33-
'distribute' => 'false',
34-
)
35-
end
36-
it { is_expected.to contain_python__virtualenv('globus-cli').that_comes_before('Python::Pip[globus-cli]') }
37-
it { is_expected.to contain_python__virtualenv('globus-cli').that_requires('Package[virtualenv]') }
38-
end
39-
if facts[:os]['family'] == 'Debian'
40-
it do
41-
is_expected.to contain_python__pyvenv('globus-cli').with(
42-
'ensure' => 'present',
43-
'version' => platforms[platform_os][:python_version],
44-
'venv_dir' => '/opt/globus-cli',
45-
)
46-
end
47-
it { is_expected.to contain_python__pyvenv('globus-cli').that_comes_before('Python::Pip[globus-cli]') }
48-
it { is_expected.to contain_python__pyvenv('globus-cli').that_requires('Package[virtualenv]') }
25+
it do
26+
is_expected.to contain_python__pyvenv('globus-cli').with(
27+
'ensure' => 'present',
28+
'version' => platforms[platform_os][:venv_python_version],
29+
'venv_dir' => '/opt/globus-cli',
30+
)
4931
end
32+
it { is_expected.to contain_python__pyvenv('globus-cli').that_comes_before('Python::Pip[globus-cli]') }
5033

5134
it do
5235
is_expected.to contain_python__pip('globus-cli').with(

spec/classes/globus_sdk_spec.rb

Lines changed: 7 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,34 +19,17 @@
1919
it do
2020
is_expected.to contain_class('python').with(
2121
version: platforms[platform_os][:python_version],
22-
virtualenv: 'present',
2322
)
2423
end
2524

26-
if facts[:os]['family'] == 'RedHat'
27-
it do
28-
is_expected.to contain_python__virtualenv('globus-sdk').with(
29-
'ensure' => 'present',
30-
'version' => platforms[platform_os][:python_version],
31-
'virtualenv' => platforms[platform_os][:virtualenv_provider],
32-
'venv_dir' => '/opt/globus-sdk',
33-
'distribute' => 'false',
34-
)
35-
end
36-
it { is_expected.to contain_python__virtualenv('globus-sdk').that_comes_before('Python::Pip[globus-sdk]') }
37-
it { is_expected.to contain_python__virtualenv('globus-sdk').that_requires('Package[virtualenv]') }
38-
end
39-
if facts[:os]['family'] == 'Debian'
40-
it do
41-
is_expected.to contain_python__pyvenv('globus-sdk').with(
42-
'ensure' => 'present',
43-
'version' => platforms[platform_os][:python_version],
44-
'venv_dir' => '/opt/globus-sdk',
45-
)
46-
end
47-
it { is_expected.to contain_python__pyvenv('globus-sdk').that_comes_before('Python::Pip[globus-sdk]') }
48-
it { is_expected.to contain_python__pyvenv('globus-sdk').that_requires('Package[virtualenv]') }
25+
it do
26+
is_expected.to contain_python__pyvenv('globus-sdk').with(
27+
'ensure' => 'present',
28+
'version' => platforms[platform_os][:venv_python_version],
29+
'venv_dir' => '/opt/globus-sdk',
30+
)
4931
end
32+
it { is_expected.to contain_python__pyvenv('globus-sdk').that_comes_before('Python::Pip[globus-sdk]') }
5033

5134
it do
5235
is_expected.to contain_python__pip('globus-sdk').with(

0 commit comments

Comments
 (0)