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

skip image download if same image is running #397

Open
glimchb opened this issue Jun 18, 2024 · 8 comments
Open

skip image download if same image is running #397

glimchb opened this issue Jun 18, 2024 · 8 comments
Assignees
Labels
good first issue Good for newcomers

Comments

@glimchb
Copy link
Member

glimchb commented Jun 18, 2024

the correct flow is:

If the device is running a different image, the device downloads the image, uses the new image to upgrade, and then reboots with the new image.

today in the code the image is always being downloaded

see

err = a.downloadAndValidateImage()

@glimchb glimchb added the question Further information is requested label Jun 18, 2024
@glimchb glimchb added good first issue Good for newcomers and removed question Further information is requested labels Jul 1, 2024
@h0lyalg0rithm
Copy link
Contributor

@glimchb I will start working on this feature

@glimchb
Copy link
Member Author

glimchb commented Aug 2, 2024

assigned to @h0lyalg0rithm

@glimchb
Copy link
Member Author

glimchb commented Aug 5, 2024

@h0lyalg0rithm note, this is not just about correct image is already downloaded, but also maybe it is already installed and running as well... also skip that in this case.... we also might introduce a new flag --force or --force-download something like this...

@h0lyalg0rithm
Copy link
Contributor

@glimchb At the moment I think there is no way to know if image is running.
Do you think it makes sense to save the pid of the configuration script run and check if it exists to skip the download. Is this what you were expected

@glimchb
Copy link
Member Author

glimchb commented Aug 6, 2024

@glimchb At the moment I think there is no way to know if image is running. Do you think it makes sense to save the pid of the configuration script run and check if it exists to skip the download. Is this what you were expected

@h0lyalg0rithm , the running image version is available via uname -a or cat /etc/os-release , see here :

cfg, err := ini.Load(OS_RELEASE_FILE)
if err != nil {
log.Printf("[ERROR] Error loading os-release file: %v", err)
} else {
osName = cfg.Section("").Key("NAME").String()
osVersion = cfg.Section("").Key("VERSION").String()
}

@h0lyalg0rithm
Copy link
Contributor

@glimchb .The JSONContent field has a stringified version of this information but its not stored anywhere, should it be stored somewhere before and then compared against the bootimage.
How should we compare the os-release image with the boot image?

@glimchb
Copy link
Member Author

glimchb commented Aug 7, 2024

@glimchb .The JSONContent field has a stringified version of this information but its not stored anywhere, should it be stored somewhere before and then compared against the bootimage. How should we compare the os-release image with the boot image?

boot image is your ISO image you will eventually run... for example Ubuntu22.04 from https://releases.ubuntu.com/jammy/ubuntu-22.04.4-live-server-amd64.iso

so you download this image, then you install it using post-config script and then you reboot... not you are running this image...
so if now somebody gives me sztp again the same image https://releases.ubuntu.com/jammy/ubuntu-22.04.4-live-server-amd64.iso i know i already run it...

no need to store anything anywhere in my opinion...

@h0lyalg0rithm
Copy link
Contributor

@glimchb Apologize if I am asking similar questions again. But when the machine reboots we would get a new jsonContent information when a new agent is instantiated.

InputJSONContent: generateInputJSONContent(),

How exactly should I do know if its a new image then?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants