Skip to content

[Bug] beats_metricbeat_package newline character issue #357

@cbeaujoin-stellar

Description

@cbeaujoin-stellar

Please try to fill out as much of the information below as you can. Thank you!

Yes, I've searched similar issues on GitHub and didn't find any.

Which version contains the bug?
Current

Describe the bug

beats_metricbeat_package is being constructed with a newline character at the end (\n), which is causing a JSON parsing error. in the Install Metricbeat - * tasks.

This is happening because of the > YAML folded scalar operator used in the set_fact task.

We can manage it with the YAML scalar operator by using >- instead of >.
The minus sign tells YAML to strip the trailing newline.

- name: Construct exact name of Metricbeat package
  ansible.builtin.set_fact:
    beats_metricbeat_package: >-
      {{
      'metricbeat' +
      (elasticstack_versionseparator +
      elasticstack_version |
      string if elasticstack_version is defined else '') |
      replace(' ', '')
      }}

How to recreate the bug?

ansible_os_family == "Debian"
ansible_distribution_major_version: '12'
elasticstack_release: 7
elasticstack_version: 7.17.23
elasticstack_variant: 'oss'

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions