Skip to content

Commit

Permalink
Support proxy_server for archive install method (#133)
Browse files Browse the repository at this point in the history
  • Loading branch information
deric committed Jun 27, 2019
1 parent 43efd98 commit d545245
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 1 deletion.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,16 @@ class { 'zookeeper':
}
```

Optionally you can specify a `proxy_server`:

```puppet
class { 'zookeeper':
install_method => 'archive',
archive_version => '3.4.8',
proxy_server => 'http://10.0.0.1:8080'
}
```

## Java installation

Default: `false`
Expand Down
1 change: 1 addition & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
Boolean $archive_symlink = $::zookeeper::params::archive_symlink,
String $archive_symlink_name = $::zookeeper::params::archive_symlink_name,
String $archive_version = $::zookeeper::params::archive_version,
Optional[String] $proxy_server = $::zookeeper::params::proxy_server,
Optional[String] $cdhver = $::zookeeper::params::cdhver,
Boolean $install_java = $::zookeeper::params::install_java,
String $install_method = $::zookeeper::params::install_method,
Expand Down
5 changes: 4 additions & 1 deletion manifests/install/archive.pp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,14 @@
default => $::zookeeper::archive_dl_url,
}

archive { "${::zookeeper::archive_install_dir}/${filename}.tar.gz":
$archive_file = "${::zookeeper::archive_install_dir}/${filename}.tar.gz"

archive { $archive_file:
ensure => present,
user => 'root',
group => 'root',
source => $download_url,
proxy_server => $::zookeeper::proxy_server,
checksum => $::zookeeper::archive_checksum['hash'],
checksum_type => $::zookeeper::archive_checksum['type'],
extract_path => $::zookeeper::archive_install_dir,
Expand Down
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
$java_opts = ''
$java_package = undef
$repo = undef
$proxy_server = undef

# service options
$manage_service = true
Expand Down
55 changes: 55 additions & 0 deletions spec/classes/install_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -429,4 +429,59 @@
})
end
end

context 'installing 3.4.8 from tar archive over proxy server' do
let(:install_dir) { '/opt' }
let(:zoo_dir) { '/opt/zookeeper' }
let(:vers) { '3.4.8' }
let(:mirror_url) { 'http://archive.apache.org/dist' }
let(:basefilename) { "zookeeper-#{vers}.tar.gz" }
let(:package_url) { "#{mirror_url}/zookeeper/zookeeper-#{vers}/zookeeper-#{vers}.tar.gz" }
let(:extract_path) { "#{zoo_dir}-#{vers}" }

let(:facts) {{
:operatingsystem => 'Ubuntu',
:osfamily => 'Debian',
:lsbdistcodename => 'bionic',
:operatingsystemmajrelease => '18.04',
:puppetversion => Puppet.version,
}}

let :pre_condition do
'class {"zookeeper":
install_method => "archive",
proxy_server => "http://10.0.0.1:8080",
archive_version => "3.4.8",
archive_install_dir => "/opt",
zoo_dir => "/opt/zookeeper",
}'
end

it do
is_expected.to contain_file(zoo_dir).with({
:ensure => 'link',
:target => extract_path,
})
end
it do
should contain_archive("#{install_dir}/#{basefilename}").with({
extract_path: install_dir,
source: package_url,
creates: extract_path,
proxy_server: 'http://10.0.0.1:8080',
user: 'root',
group: 'root',
})
end

it do
is_expected.to contain_file('/etc/zookeeper').with({
:ensure => 'directory',
:owner => 'zookeeper',
:group => 'zookeeper',
})
end
end


end

0 comments on commit d545245

Please sign in to comment.