Skip to content

Fix version checking for Debian repo for future versions. #20

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

Closed
wants to merge 1 commit into from
Closed
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
11 changes: 4 additions & 7 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@
url: https://deb.nodesource.com/gpgkey/nodesource.gpg.key
state: present

- name: Check if nodejs_version is 4.x or higher
set_fact: debian_repo_version="4.x"
when: "{{ nodejs_version | version_compare('4.0', '>=') }}"

- name: Check if nodejs_version is 5.x or higher
set_fact: debian_repo_version="5.x"
when: "{{ nodejs_version | version_compare('5.0', '>=') }}"
- name: Check if nodejs_version is 0.x
set_fact:
debian_repo_version: "{{ nodejs_version }}"
when: nodejs_version in nodejs_old_versions

- name: Add NodeSource deb repository
apt_repository:
Expand Down
3 changes: 2 additions & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# vars file for nodejs
debian_repo_version: "{{ nodejs_version }}"
nodejs_old_versions: ['0.10', '0.12']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we come up with another name for this?

Like zero_versions?

Cheers

debian_repo_version: '{{ nodejs_version | regex_replace("^([1-9]+)\.\d+$", "\\1.x") }}'