Skip to content

Commit 2cd6968

Browse files
author
Joyner, Jason
committed
added influxdb::source_url so you can pass this in instead of use amazon s3
1 parent dcf0b9e commit 2cd6968

5 files changed

Lines changed: 103 additions & 3 deletions

File tree

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,26 @@ puppet module to install and configure [influxdb](https://influxdb.org) (version
1212

1313
## Usage
1414

15+
16+
Basic default uses local package
17+
1518
`class { 'influxdb': }`
1619

20+
Install from amazon.s3 is default when not using repository
21+
```
22+
class { 'influxdb':
23+
install_from_repository => false,
24+
}
25+
```
26+
Install using your own url/proxy
27+
```
28+
class { 'influxdb':
29+
install_from_repository => false,
30+
source_url => 'https://download.test.com/proxy/influxdb/influxdb-1.0.0.rpm'
31+
}
32+
```
33+
34+
1735
These configuration parameter can be set:
1836
```
1937
$ensure = 'installed'

manifests/init.pp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
$meta_hostname = $influxdb::params::meta_hostname,
99
$meta_peers = $influxdb::params::meta_peers,
1010
$retention_replication = $influxdb::params::retention_replication,
11+
$source_url = $influxdb::params::source_url,
1112
) inherits influxdb::params {
1213

1314
class { 'influxdb::install': } ->

manifests/install.pp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,12 @@
2828
/386/ => "influxdb_${influxdb::version}_i386.deb",
2929
default => "influxdb_${influxdb::version}_amd64.deb",
3030
}
31-
$package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}"
31+
if $influxdb::source_url != undef {
32+
$package_source = $influxdb::source_url
33+
}
34+
else {
35+
$package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}"
36+
}
3237
exec {
3338
'influxdb_wget':
3439
command => "wget ${package_source} -O /tmp/${package_source_name}",
@@ -56,7 +61,12 @@
5661
/386/ => "influxdb-${influxdb::version}-1.i686.rpm",
5762
default => "influxdb-${influxdb::version}-1.x86_64.rpm",
5863
}
59-
$package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}"
64+
if $influxdb::source_url != undef {
65+
$package_source = $influxdb::source_url
66+
}
67+
else {
68+
$package_source = "http://influxdb.s3.amazonaws.com/${package_source_name}"
69+
}
6070
exec {
6171
'influxdb_rpm':
6272
command => "rpm -ivh ${package_source}",

manifests/params.pp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
$install_from_repository = true
77
$config_file = '/etc/opt/influxdb/influxdb.conf'
88

9+
$source_url = undef
910
# general section of influxdb.conf
1011
$reporting_disabled = false
1112

@@ -15,4 +16,5 @@
1516

1617
# [retention]
1718
$retention_replication = undef
19+
1820
}

spec/classes/influxdb_install_spec.rb

Lines changed: 70 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
describe 'influxdb::install', :type => :class do
44

55
it { should create_class('influxdb::install') }
6-
it { should contain_package('influxdb') }
6+
# it { should contain_package('influxdb') }
77

88
context 'installing from a repository' do
99
let(:pre_condition) {
@@ -35,4 +35,73 @@
3535
)}
3636
end
3737
end
38+
39+
context 'installing from web' do
40+
context 'with default preset url' do
41+
let(:pre_condition) {
42+
'class{"influxdb":
43+
ensure => "installed",
44+
install_from_repository => false,
45+
}'
46+
}
47+
context 'on Debian' do
48+
let(:facts) {
49+
{
50+
:osfamily => 'Debian',
51+
:architecture => 'x86_64',
52+
}
53+
}
54+
it { should contain_exec('influxdb_wget')
55+
.with_command(/influxdb.s3.amazonaws/)
56+
}
57+
end
58+
context 'on redhat' do
59+
let(:facts) {
60+
{
61+
:osfamily => 'RedHat',
62+
:architecture => 'x86_64',
63+
}
64+
}
65+
context 'with default preset url' do
66+
it { should contain_exec('influxdb_rpm')
67+
.with_command(/influxdb.s3.amazonaws/)
68+
}
69+
end
70+
end
71+
end
72+
73+
context 'with source_url set' do
74+
let(:pre_condition) {
75+
'class{"influxdb":
76+
ensure => "installed",
77+
install_from_repository => false,
78+
source_url => "https://download.test.com/proxy/influxdb/influxdb-1.0.0.rpm"
79+
}'
80+
}
81+
context 'on Debian' do
82+
let(:facts) {
83+
{
84+
:osfamily => 'Debian',
85+
:architecture => 'x86_64',
86+
}
87+
}
88+
it { should contain_exec('influxdb_wget')
89+
.with_command(/download.test.com/)
90+
}
91+
end
92+
context 'on redhat' do
93+
let(:facts) {
94+
{
95+
:osfamily => 'RedHat',
96+
:architecture => 'x86_64',
97+
}
98+
}
99+
context 'with default preset url' do
100+
it { should contain_exec('influxdb_rpm')
101+
.with_command(/download.test.com/)
102+
}
103+
end
104+
end
105+
end
106+
end
38107
end

0 commit comments

Comments
 (0)