Skip to content
This repository has been archived by the owner on Dec 27, 2022. It is now read-only.

LWRP "version" property is being ignored #460

Open
benjsmi opened this issue Sep 8, 2016 · 1 comment
Open

LWRP "version" property is being ignored #460

benjsmi opened this issue Sep 8, 2016 · 1 comment

Comments

@benjsmi
Copy link

benjsmi commented Sep 8, 2016

I was thinking I could use @version to set the desired version of Logstash using this cookbook because of https://github.com/lusis/chef-logstash/blob/master/resources/instance.rb#L17, which says:

# Encoding: utf-8
# Cookbook Name:: logstash
# Resource:: instance
# Author:: John E. Vincent
# Copyright 2014, John E. Vincent
# License:: Apache 2.0

actions :create, :delete

default_action :create if defined?(default_action)

attribute :name, kind_of: String, name_attribute: true
attribute :base_directory, kind_of: String
attribute :install_type, kind_of: String
attribute :auto_symlink, kind_of: [TrueClass, FalseClass], default: true
# version/checksum/source_url used by `jar`, `tarball` install_type
attribute :version, kind_of: String

The last line is the relevant one that made me think I could use it this way.

Well that, and README.md says that the order of precedence is:

  • the value directly in the resource block.
  • the value from the hash node['logstash']['instance'][name]
  • the value from the hash node['logstash']['instance_default']

In my recipe, I have:

logstash_instance 'logstash' do
  version "2.4.0"
  action :create
end

but I keep seeing Logstash 1.5.4 being installed:

$ ./logstash --version
logstash 1.5.4

Relevant Chef client-run output:

  * logstash_instance[logstash] action create (up to date)
  * user[logstash] action create
    - create user logstash
  * group[logstash] action create
    - alter group logstash
    - add missing member(s): logstash
Recipe: ark::default
  * apt_package[libtool] action install
    - install version 2.4.2-1.7ubuntu1 of package libtool
  * apt_package[autoconf] action install
    - install version 2.69-6 of package autoconf
  * apt_package[make] action install
    - install version 3.81-8.2ubuntu3 of package make
  * apt_package[unzip] action install
    - install version 6.0-9ubuntu1.5 of package unzip
  * apt_package[rsync] action install (up to date)
  * apt_package[gcc] action install (up to date)
  * apt_package[autogen] action install
    - install version 1:5.18-2ubuntu2 of package autogen
  * apt_package[shtool] action install
    - install version 2.0.8-6 of package shtool
  * apt_package[pkg-config] action install
    - install version 0.26-1ubuntu4 of package pkg-config
  * ark[logstash] action put
    * directory[/opt/logstash/logstash] action create
      - create new directory /opt/logstash/logstash
    * remote_file[/var/chef/cache/logstash.tar.gz] action create
      - create new file /var/chef/cache/logstash.tar.gz
      - update content in file /var/chef/cache/logstash.tar.gz from none to f03075
      (file sizes exceed 10000000 bytes, diff output suppressed)
    * execute[unpack /var/chef/cache/logstash.tar.gz] action nothing (skipped due to action :nothing)
    * execute[set owner on /opt/logstash/logstash] action nothing (skipped due to action :nothing)
    * execute[unpack /var/chef/cache/logstash.tar.gz] action run
      - execute /bin/tar xzf /var/chef/cache/logstash.tar.gz --strip-components=1
    * execute[set owner on /opt/logstash/logstash] action run
      - execute chown -R logstash:logstash /opt/logstash/logstash

  * directory[/opt/logstash/logstash/bin] action create (up to date)
  * directory[/opt/logstash/logstash/etc] action create
    - create new directory /opt/logstash/logstash/etc
    - change mode from '' to '0755'
    - change owner from '' to 'logstash'
    - change group from '' to 'logstash'
  * directory[/opt/logstash/logstash/lib] action create (up to date)
  * directory[/opt/logstash/logstash/log] action create
    - create new directory /opt/logstash/logstash/log
    - change mode from '' to '0755'
    - change owner from '' to 'logstash'
    - change group from '' to 'logstash'
  * directory[/opt/logstash/logstash/tmp] action create
    - create new directory /opt/logstash/logstash/tmp
    - change mode from '' to '0755'
    - change owner from '' to 'logstash'
    - change group from '' to 'logstash'
  * directory[/opt/logstash/logstash/etc/conf.d] action create
    - create new directory /opt/logstash/logstash/etc/conf.d
    - change mode from '' to '0755'
    - change owner from '' to 'logstash'
    - change group from '' to 'logstash'
  * directory[/opt/logstash/logstash/patterns] action create
    - create new directory /opt/logstash/logstash/patterns
    - change mode from '' to '0755'
    - change owner from '' to 'logstash'
    - change group from '' to 'logstash'
Recipe: logrotate::default
  * apt_package[logrotate] action upgrade (up to date)
  * directory[/etc/logrotate.d] action create (up to date)
  * logrotate_app[logstash_logstash] action enable
    * directory[/etc/logrotate.d] action create (up to date)
    * template[/etc/logrotate.d/logstash_logstash] action create
      - create new file /etc/logrotate.d/logstash_logstash
      - update content in file /etc/logrotate.d/logstash_logstash from none to 3e5e5c
      --- /etc/logrotate.d/logstash_logstash    2016-09-08 19:07:14.937252143 +0000
      +++ /etc/logrotate.d/.chef-logstash_logstash20160908-3476-282adx  2016-09-08 19:07:14.937252143 +0000
      @@ -1 +1,16 @@
      +# This file was generated by Chef for *******.
      +# Do not modify this file by hand!
      +
      +"/opt/logstash/logstash/log/*.log" {
      +  daily
      +  create 664 logstash logstash
      +  rotate 10
      +  missingok
      +  notifempty
      +  compress
      +  copytruncate
      +  postrotate
      +    service logstash_logstash restart
      +  endscript
      +}
      - change mode from '' to '0644'
      - change owner from '' to 'root'
      - change group from '' to 'root'

  * logstash_service[logstash] action enable (up to date)
Recipe: runit::default
  * service[runit] action nothing (skipped due to action :nothing)
  * execute[start-runsvdir] action nothing (skipped due to action :nothing)
  * apt_package[runit] action install
  Recipe: <Dynamically Defined Resource>
    * cookbook_file[/var/chef/cache/preseed/runit/runit-2.1.1-6.2ubuntu3.seed] action create
      - create new file /var/chef/cache/preseed/runit/runit-2.1.1-6.2ubuntu3.seed
      - update content in file /var/chef/cache/preseed/runit/runit-2.1.1-6.2ubuntu3.seed from none to 9c6758
      --- /var/chef/cache/preseed/runit/runit-2.1.1-6.2ubuntu3.seed 2016-09-08 19:07:15.505252143 +0000
      +++ /var/chef/cache/preseed/runit/.chef-runit-2.1.1-6.2ubuntu3.seed20160908-3476-bafb7b   2016-09-08 19:07:15.505252143 +0000
      @@ -1 +1,2 @@
      +runit   runit/signalinit        boolean true
    - preseed package runit
    - install version 2.1.1-6.2ubuntu3 of package runit
  * service[logstash] action nothing (skipped due to action :nothing)
  * runit_service[logstash] action enable
    * ruby_block[restart_service] action nothing (skipped due to action :nothing)
    * ruby_block[restart_log_service] action nothing (skipped due to action :nothing)
    * directory[/etc/sv/logstash] action create
      - create new directory /etc/sv/logstash
      - change mode from '' to '0755'
    * template[/etc/sv/logstash/run] action create
      - create new file /etc/sv/logstash/run
      - update content in file /etc/sv/logstash/run from none to 6c1710
      --- /etc/sv/logstash/run  2016-09-08 19:07:21.849252143 +0000
      +++ /etc/sv/logstash/.chef-run20160908-3476-15t4ydc   2016-09-08 19:07:21.849252143 +0000
      @@ -1 +1,18 @@
      +#!/bin/sh
      +
      +ulimit -Hn 65550
      +ulimit -Sn 65550
      +
      +cd //opt/logstash/logstash
      +exec 2>&1
      +# Need to set LOGSTASH_HOME and HOME so sincedb will work
      +export LS_HEAP_SIZE=593M
      +export LOGSTASH_HOME="/opt/logstash/logstash"
      +export GC_OPTS=""
      +export JAVA_OPTS="-server -Xms197M -Xmx593M -Djava.io.tmpdir=$LOGSTASH_HOME/tmp/  "
      +LOGSTASH_OPTS="agent -f $LOGSTASH_HOME/etc/conf.d"
      +LOGSTASH_OPTS="$LOGSTASH_OPTS --pluginpath $LOGSTASH_HOME/lib"
      +LOGSTASH_OPTS="$LOGSTASH_OPTS -l $LOGSTASH_HOME/log/logstash.log"
      +export LOGSTASH_OPTS="$LOGSTASH_OPTS -w 1"
      +HOME=$LOGSTASH_HOME exec chpst -u logstash:logstash $LOGSTASH_HOME/bin/logstash $LOGSTASH_OPTS
      - change mode from '' to '0755'
    * directory[/etc/sv/logstash/log] action create
      - create new directory /etc/sv/logstash/log
    * directory[/etc/sv/logstash/log/main] action create
      - create new directory /etc/sv/logstash/log/main
      - change mode from '' to '0755'
    * directory[/var/log/logstash] action create
      - create new directory /var/log/logstash
      - change mode from '' to '0755'
    * template[/etc/sv/logstash/log/config] action create
      - create new file /etc/sv/logstash/log/config
      - update content in file /etc/sv/logstash/log/config from none to e3b0c4
      (no diff)
      - change mode from '' to '0644'
    * link[/var/log/logstash/config] action create
      - create symlink at /var/log/logstash/config to /etc/sv/logstash/log/config
    * template[/etc/sv/logstash/log/run] action create
      - create new file /etc/sv/logstash/log/run
      - update content in file /etc/sv/logstash/log/run from none to e64148
      --- /etc/sv/logstash/log/run  2016-09-08 19:07:21.889252143 +0000
      +++ /etc/sv/logstash/log/.chef-run20160908-3476-y2ifrm    2016-09-08 19:07:21.889252143 +0000
      @@ -1 +1,3 @@
      +#!/bin/sh
      +exec svlogd -tt ./main
      - change mode from '' to '0755'
    * directory[/etc/sv/logstash/env] action create
      - create new directory /etc/sv/logstash/env
      - change mode from '' to '0755'
    * ruby_block[zap extra env files for logstash service] action run (skipped due to only_if)
    * template[/etc/sv/logstash/check] action create (skipped due to only_if)
    * template[/etc/sv/logstash/finish] action create (skipped due to only_if)
    * directory[/etc/sv/logstash/control] action create
      - create new directory /etc/sv/logstash/control
      - change mode from '' to '0755'
    * link[/etc/init.d/logstash] action create
      - create symlink at /etc/init.d/logstash to /usr/bin/sv
    * file[/etc/sv/logstash/down] action nothing (skipped due to action :nothing)
    * ruby_block[restart_service] action run
      * ruby_block[restart_service] action nothing (skipped due to action :nothing)
      * ruby_block[restart_log_service] action nothing (skipped due to action :nothing)
      * directory[/etc/sv/logstash] action create (up to date)
      * template[/etc/sv/logstash/run] action create (up to date)
      * directory[/etc/sv/logstash/log] action create (up to date)
      * directory[/etc/sv/logstash/log/main] action create (up to date)
      * directory[/var/log/logstash] action create (up to date)
      * template[/etc/sv/logstash/log/config] action create (up to date)
      * link[/var/log/logstash/config] action create (up to date)
      * template[/etc/sv/logstash/log/run] action create (up to date)
      * directory[/etc/sv/logstash/env] action create (up to date)
      * ruby_block[zap extra env files for logstash service] action run (skipped due to only_if)
      * template[/etc/sv/logstash/check] action create (skipped due to only_if)
      * template[/etc/sv/logstash/finish] action create (skipped due to only_if)
      * directory[/etc/sv/logstash/control] action create (up to date)
      * link[/etc/init.d/logstash] action create (up to date)
      * file[/etc/sv/logstash/down] action nothing (skipped due to action :nothing)
      * directory[/etc/service] action create (up to date)
      * link[/etc/service/logstash] action create
        - create symlink at /etc/service/logstash to /etc/sv/logstash
      * ruby_block[wait for logstash service socket] action run
        - execute the ruby block wait for logstash service socket
      - execute the ruby block restart_service
    * ruby_block[restart_log_service] action run
      * ruby_block[restart_service] action nothing (skipped due to action :nothing)
      * ruby_block[restart_log_service] action nothing (skipped due to action :nothing)
      * directory[/etc/sv/logstash] action create (up to date)
      * template[/etc/sv/logstash/run] action create (up to date)
      * directory[/etc/sv/logstash/log] action create (up to date)
      * directory[/etc/sv/logstash/log/main] action create (up to date)
      * directory[/var/log/logstash] action create (up to date)
      * template[/etc/sv/logstash/log/config] action create (up to date)
      * link[/var/log/logstash/config] action create (up to date)
      * template[/etc/sv/logstash/log/run] action create (up to date)
      * directory[/etc/sv/logstash/env] action create (up to date)
      * ruby_block[zap extra env files for logstash service] action run (skipped due to only_if)
      * template[/etc/sv/logstash/check] action create (skipped due to only_if)
      * template[/etc/sv/logstash/finish] action create (skipped due to only_if)
      * directory[/etc/sv/logstash/control] action create (up to date)
      * link[/etc/init.d/logstash] action create (up to date)
      * file[/etc/sv/logstash/down] action nothing (skipped due to action :nothing)
      * directory[/etc/service] action create (up to date)
      * link[/etc/service/logstash] action create (up to date)
      * ruby_block[wait for logstash service socket] action run
        - execute the ruby block wait for logstash service socket
      - execute the ruby block restart_log_service
    * directory[/etc/service] action create (up to date)
    * link[/etc/service/logstash] action create (up to date)
    * ruby_block[wait for logstash service socket] action run
      - execute the ruby block wait for logstash service socket
@benjsmi
Copy link
Author

benjsmi commented Sep 8, 2016

I was eventually able to get logstash to install the correct version once I set:

logstash_instance 'logstash' do
  action :create
  install_type "tarball"
  source_url "https://download.elasticsearch.org/logstash/logstash/logstash-2.4.0.tar.gz"
  version "2.4.0"
  checksum "622c435c5c0f40e205fd4d9411eb409cc52992cf62dde4c7cd46e480cd8247cc"
end

So I would have been helped by something in the docs that explains that there is no "package" installation and you have to declare the checksum and source_url of your desired version if you don't want 1.5.4.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant