Skip to content

Fix installation of newer pinned version by DNF #429

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions tasks/parse-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,27 @@
set_fact:
datadog_agent_major_version: "{{ datadog_major }}"

- name: Set helper variables
set_fact:
datadog_agent_linux_version: "{{ datadog_epoch }}:{{ datadog_major }}.{{ datadog_minor }}.{{ datadog_bugfix }}{{ datadog_suffix }}-{{ datadog_release }}"
datadog_rpm_version_finding_cmd: "rpm -q --qf '%{EPOCH}:%{VERSION}-%{RELEASE}' {{ datadog_agent_flavor }}"

- name: Set OS-specific versions
# NOTE: if changing these, make sure the format correspond with values in datadog_version_finding_cmds below
set_fact:
datadog_agent_debian_version: "{{ datadog_epoch }}:{{ datadog_major }}.{{ datadog_minor }}.{{ datadog_bugfix }}{{ datadog_suffix }}-{{ datadog_release }}"
datadog_agent_redhat_version: "{{ datadog_major }}.{{ datadog_minor }}.{{ datadog_bugfix }}{{ datadog_suffix }}-{{ datadog_release }}"
datadog_agent_suse_version: "{{ datadog_epoch }}:{{ datadog_major }}.{{ datadog_minor }}.{{ datadog_bugfix }}{{ datadog_suffix }}-{{ datadog_release }}"
datadog_agent_debian_version: "{{ datadog_agent_linux_version }}"
datadog_agent_redhat_version: "{{ datadog_agent_linux_version }}"
datadog_agent_suse_version: "{{ datadog_agent_linux_version }}"
datadog_agent_windows_version: "{{ datadog_major }}.{{ datadog_minor }}.{{ datadog_bugfix }}{{ datadog_suffix }}"

- name: Construct commands to find Agent version
set_fact:
datadog_version_finding_cmds:
Debian: "dpkg -s {{ datadog_agent_flavor }} | grep '^Version:' | awk '{print $2}'"
RedHat: "rpm -q --qf '%{VERSION}-%{RELEASE}' {{ datadog_agent_flavor }}"
Rocky: "rpm -q --qf '%{VERSION}-%{RELEASE}' {{ datadog_agent_flavor }}"
AlmaLinux: "rpm -q --qf '%{VERSION}-%{RELEASE}' {{ datadog_agent_flavor }}"
Suse: "rpm -q --qf '%{EPOCH}:%{VERSION}-%{RELEASE}' {{ datadog_agent_flavor }}"
RedHat: "{{ datadog_rpm_version_finding_cmd }}"
Rocky: "{{ datadog_rpm_version_finding_cmd }}"
AlmaLinux: "{{ datadog_rpm_version_finding_cmd }}"
Suse: "{{ datadog_rpm_version_finding_cmd }}"

- name: Create OS-specific version dict
set_fact:
Expand Down
3 changes: 2 additions & 1 deletion tasks/pkg-redhat/install-pinned.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@

- name: Install pinned datadog-agent package (yum)
yum:
name: "{{ datadog_agent_flavor }}-{{ datadog_agent_redhat_version }}"
# We have to add architecture, because yum only understands epoch when architecture is also specified
name: "{{ datadog_agent_flavor }}-{{ datadog_agent_redhat_version }}.{{ ansible_facts.architecture }}"
update_cache: yes
state: present
allow_downgrade: "{{ datadog_agent_allow_downgrade }}"
Expand Down