Skip to content
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

Fixes conditional for NetData Updater when checking for new updates #8028

Merged
merged 2 commits into from Feb 11, 2020

Conversation

gmeszaros
Copy link
Contributor

This commit changes the check for updated releases when running in manual mode

Fixes #8027

Summary

This PR provides a quick fix for running manual updates.

Component Name

Netdata-updater

This commit changes the check for updated releases when running in manual mode
@squash-labs
Copy link

squash-labs bot commented Feb 10, 2020

Manage this branch in Squash

Test this branch here: https://gmeszarosmanual-update-check-ibwci.squash.io

@claassistantio
Copy link

claassistantio commented Feb 10, 2020

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions bot added the area/packaging Packaging and operating systems support label Feb 10, 2020
@knatsakis knatsakis removed their request for review February 10, 2020 15:12
@ilyam8
Copy link
Member

ilyam8 commented Feb 10, 2020

btw

first of all

current_version="$(command -v netdata > /dev/null && parse_version "$(netdata -v | cut -f 2 -d ' ')")"

doesnt work because netdata is not in the PATH pretty often.

It means that following code

if [ "${latest_version}" -gt 0 ] && [ "${current_version}" -gt 0 ] && [ "${current_version}" -ge "${current_version}" ]; then
info "Newest version ${current_version} <= ${latest_version} is already installed"

doesnt work at all and only produces errors

./netdata-updater.sh: line 147: [: : integer expression expected

cc @Ferroin

@ilyam8
Copy link
Member

ilyam8 commented Feb 10, 2020

@Ferroin do we even need this check

if [ "${latest_version}" -gt 0 ] && [ "${current_version}" -gt 0 ] && [ "${current_version}" -ge "${current_version}" ]; then
info "Newest version ${current_version} <= ${latest_version} is already installed"

?

@Ferroin
Copy link
Member

Ferroin commented Feb 10, 2020

@Ferroin do we even need this check

if [ "${latest_version}" -gt 0 ] && [ "${current_version}" -gt 0 ] && [ "${current_version}" -ge "${current_version}" ]; then
info "Newest version ${current_version} <= ${latest_version} is already installed"

?

I'm not sure.

Realistically, we should be checking the version like this instead of checking SHA256 hashes of the tarbals to determine if we need to upgrade or not, but we appear to have issues with that working when the user doesn't install in a way that netdata ends up in their path.

@ilyam8
Copy link
Member

ilyam8 commented Feb 10, 2020

First check returns more detailed message and that is pretty much all. We do sha256 checking always anyway.

packaging/installer/netdata-updater.sh Outdated Show resolved Hide resolved
@prologic prologic changed the title Fix proposal for #8027 Fixes conditional for NetData Updater when checking for new updates Feb 10, 2020
@prologic prologic self-assigned this Feb 10, 2020
@ncmans ncmans removed their request for review February 11, 2020 01:54
@prologic
Copy link
Contributor

Test Plan:

Testing from master:

/netdata # /etc/periodic/daily/netdata-updater
Tue Feb 11 23:41:36 UTC 2020 : INFO:  Running on a terminal - (this script also supports running headless from crontab)
Tue Feb 11 23:41:37 UTC 2020 : INFO:  Current Version: 001019000482
Tue Feb 11 23:41:37 UTC 2020 : INFO:  Latest Version: 001019000481
Tue Feb 11 23:41:37 UTC 2020 : INFO:  Newest version 001019000482 <= 001019000481 is already installed

Testing from an older version:

/netdata # /etc/periodic/daily/netdata-updater
Tue Feb 11 23:50:45 UTC 2020 : INFO:  Running on a terminal - (this script also supports running headless from crontab)
Tue Feb 11 23:50:45 UTC 2020 : INFO:  Current Version: 001019000432
Tue Feb 11 23:50:45 UTC 2020 : INFO:  Latest Version: 001019000481
Tue Feb 11 23:50:45 UTC 2020 : INFO:  Newest version 001019000432 <= 001019000481 is already installed

@prologic prologic merged commit acaae73 into netdata:master Feb 11, 2020
Saruspete pushed a commit to Saruspete/netdata that referenced this pull request May 21, 2020
…etdata#8028)

* Fix proposal for netdata#8027

This commit changes the check for updated releases when running in manual mode

* Default (current|latest)_version to 0 and invert the logic

Co-authored-by: James Mills <prologic@shortcircuit.net.au>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/packaging Packaging and operating systems support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

manually executed updater compares current to current version, instead of current to latest
6 participants