Use td-agent-gem to install fluentd monasca plugin on ubuntu

If monasca is enabled on ubuntu, we see the following error in fluentd:

[error]: config error file="/etc/td-agent/td-agent.conf"
error_class=Fluent::ConfigError error="Unknown output plugin 'monasca'.
Run 'gem search -rd fluent-plugin' to find plugins"

This is because we use 'fluent-gem install' to install the gem, which
works on CentOS but on Ubuntu it is necessary to use 'td-agent-gem
install'.

Change-Id: I515f9764ca93a41a871e520696193a9298856d08
Closes-Bug: #1830147
This commit is contained in:
Mark Goddard 2019-05-23 10:25:28 +01:00
parent 3e9cf08ac5
commit c585ca5055
2 changed files with 10 additions and 9 deletions

View File

@ -100,7 +100,7 @@ RUN tar -xvf /tmp/fluentd-monasca.tar.gz -C /tmp \
&& cd /tmp/fluentd-monasca-* \
&& gem build fluentd-monasca-output.gemspec \
&& gem install fluentd-monasca-output-*.gem \
&& fluent-gem install fluentd-monasca-output-*.gem \
&& {{ macros.install_fluent_plugins(['fluentd-monasca-output-*.gem'], chain=True) }} \
&& rm -rf /tmp/fluentd*
{% endblock %}

View File

@ -105,16 +105,17 @@ RUN apt-get update \
&& chmod 755 /usr/bin/kubectl
{% endmacro %}
{% macro install_fluent_plugins(plugins) -%}
{% macro install_fluent_plugins(plugins, chain=False) -%}
{% if plugins is defined and plugins|length > 0 -%}
{% if base_distro in ['centos', 'oraclelinux', 'rhel'] -%}
RUN ulimit -n 65536 && gem install --minimal-deps {{ plugins | join(' ') }}
{% if not chain -%} RUN {% endif -%}
{%- if base_distro in ['centos', 'oraclelinux', 'rhel'] -%}
ulimit -n 65536 && gem install --minimal-deps {{ plugins | join(' ') }}
{%- elif base_distro in ['debian', 'ubuntu'] -%}
{% if base_arch == 'x86_64' %}
RUN ulimit -n 65536 && td-agent-gem install {{ plugins | join(' ') }}
{% else %}
RUN ulimit -n 65536 && gem install --minimal-deps {{ plugins | join(' ') }}
{% endif %}
{%- if base_arch == 'x86_64' -%}
ulimit -n 65536 && td-agent-gem install {{ plugins | join(' ') }}
{%- else -%}
ulimit -n 65536 && gem install --minimal-deps {{ plugins | join(' ') }}
{%- endif %}
{%- endif %}
{%- endif %}
{%- endmacro %}