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

Check if remote server components actually needs an update #280

Merged
merged 4 commits into from
Oct 9, 2024

Conversation

sebjulliand
Copy link
Contributor

Related to this issue: codefori/vscode-ibmi#2267

If Config.getServerComponentName fails to return the currently installed version of the server component (probably happens when installing the extension on a new VSCode instance since it's taken from the extension global storage?), the update manager will try to overwrite the existing file that is not writable (because chmod 400 is run on it after it's uploaded).

To prevent the updater from failing, this PR adds a new check that will:

  • Check if the remote component already exists
  • If it exists, the local file's md5 hash is compared to the remote file's

If the md5 hashes are different, the remote file is made writable to ensure the upload will not fail.

This should prevent issues like codefori/vscode-ibmi#2267 from happening.

@SanjulaGanepola
Copy link
Contributor

Hello @sebjulliand. Just wondering if there was any update on this PR. We are hoping to update the DB2 extension in Merlin and would like this change as well since we were encountering similar issues.

@sebjulliand sebjulliand added the enhancement New feature or request label Oct 8, 2024
@sebjulliand
Copy link
Contributor Author

@SanjulaGanepola Nope, no news but I forgot to add reviewers back then. @worksofliam , @julesyan , have a look whenever you feel like it. Thanks!

@worksofliam
Copy link
Contributor

@sebjulliand sorry I missed this. I will review it today.

@sebjulliand
Copy link
Contributor Author

Lovely, thanks!

@worksofliam
Copy link
Contributor

worksofliam commented Oct 8, 2024

@sebjulliand I just tested this out. To be safe, I also deleted my ~/.vscode/* contents (not the directory), but then the install on this PR fails because the directory exists, even though the .jar doesn't exist.

When I checked back out to main, then it continued to install correctly.

@sebjulliand
Copy link
Contributor Author

@sebjulliand I just tested this out. To be safe, I also deleted my ~/.vscode/* contents (not the directory), but then the install on this PR fails because the directory exists, even though the .jar doesn't exist.

When I checked back out to main, then it continued to install correctly.

How did it fail for you?
I deleted the folder's content before connecting (before testing the PR actually) and it went fine. Did you get an error or anything? 😓

But I found an edge case: connecting, getting the install done, disconnecting, deleting the component, reconnecting: it does not reinstall the component. I'll fix that too.

@sebjulliand
Copy link
Contributor Author

@worksofliam turns out the ServerComponent installed flag was not reset after disconnecting - I fixed that!
I also made the dsc npm command OS agnostic while I was at it...it wasn't running fine on Windows 😛

@worksofliam
Copy link
Contributor

@sebjulliand Yup, that works now! Thanks for a lovely change.

Copy link
Contributor

@worksofliam worksofliam left a comment

Choose a reason for hiding this comment

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

Working as expected.

@worksofliam worksofliam merged commit ecb20dc into codefori:main Oct 9, 2024
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants