possible to support "file" install method
Closed this issue · 5 comments
Hi,
Since the InfluxDB repository only store the latest version at the moment. Is it possible if we can support install_file method, so we can install multiple versions of InfluxDB.
I think it is important, since we can choose specific version if you don't want to upgrade at the moment.
I created the branch file-install_method for your reference.
My kitchen snippet is:
- name: file
run_list:
- recipe[influxdb-test::default]
attributes:
influxdb:
install_type: file
version: 0.10.3-1
@chrisduong from what I can see from the influxdata repo, they have influxdb as old as 0.9.4.2-1 ref: https://repos.influxdata.com/centos/7Server/x86_64/stable/ This is an example. Maybe other distros they don't.
Also, if you want to modify the current recipe not to download the latest, you can specify a version you want node['influxdb']['version'] = 0.10.3-1
ref: https://github.com/bdangit/chef-influxdb/blob/master/attributes/default.rb#L5-L6
BTW, I'm not opposed to a file-install method. If we were to do it, we should follow what telegraf-cookbook does to support this. However, they just stubbed it out for now. https://github.com/NorthPage/telegraf-cookbook/blob/master/resources/install.rb#L62-L64
@bdangit , ironically, this only work with RedHat family, in Ubuntu, the repo only store the latest version.
* apt_package[influxdb] action install
================================================================================
Error executing action `install` on resource 'apt_package[influxdb]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
Expected process to exit with [0], but received '100'
---- Begin output of apt-get -q -y install influxdb=0.10.3-1 ----
STDOUT: Reading package lists...
Building dependency tree...
Reading state information...
STDERR: E: Version '0.10.3-1' for 'influxdb' was not found
---- End output of apt-get -q -y install influxdb=0.10.3-1 ----
Ran apt-get -q -y install influxdb=0.10.3-1 returned 100
Cookbook Trace:
---------------
/opt/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider.rb:119:in `compile_and_converge_action'
Resource Declaration:
---------------------
# In /opt/kitchen/cache/cookbooks/influxdb/resources/install.rb
42: package 'influxdb' do
43: version node['influxdb']['version']
44: end
45: end
Compiled Resource:
------------------
# Declared in /opt/kitchen/cache/cookbooks/influxdb/resources/install.rb:42:in `block in class_from_file'
apt_package("influxdb") do
action [:install]
retries 0
retry_delay 2
default_guard_interpreter :default
package_name "influxdb"
version "0.10.3-1"
declared_type :package
cookbook_name "influxdb"
end
================================================================================
Error executing action `install` on resource 'influxdb_install[influxdb]'
================================================================================
Mixlib::ShellOut::ShellCommandFailed
------------------------------------
apt_package[influxdb] (/opt/kitchen/cache/cookbooks/influxdb/resources/install.rb line 42) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '100'
---- Begin output of apt-get -q -y install influxdb=0.10.3-1 ----
STDOUT: Reading package lists...
Building dependency tree...
Reading state information...
STDERR: E: Version '0.10.3-1' for 'influxdb' was not found
---- End output of apt-get -q -y install influxdb=0.10.3-1 ----
Ran apt-get -q -y install influxdb=0.10.3-1 returned 100
Cookbook Trace:
---------------
/opt/kitchen/cache/cookbooks/compat_resource/files/lib/chef_compat/copied_from_chef/chef/provider.rb:119:in `compile_and_converge_action'
Resource Declaration:
---------------------
# In /opt/kitchen/cache/cookbooks/influxdb/recipes/default.rb
13: influxdb_install 'influxdb' do
14: action [:install]
15: end
16:
Compiled Resource:
------------------
# Declared in /opt/kitchen/cache/cookbooks/influxdb/recipes/default.rb:13:in `from_file'
influxdb_install("influxdb") do
action [:install]
updated true
updated_by_last_action true
retries 0
retry_delay 2
default_guard_interpreter :default
declared_type :influxdb_install
cookbook_name "influxdb"
recipe_name "default"
arch_type "amd64"
influxdb_key "https://repos.influxdata.com/influxdb.key"
include_repository true
end
Hrmm looks like you are right. Weird. ref: https://repos.influxdata.com/ubuntu/dists/precise/stable/binary-amd64/Packages
Okay, if we're going to support this method, lets make it like https://github.com/NorthPage/telegraf-cookbook/blob/master/resources/install.rb#L62-L64
I'll add this to backlog. Otherwise, feel free to make a PR. 👍