canonical / cos-configuration-k8s-operator

https://charmhub.io/cos-configuration-k8s
Apache License 2.0
4 stars 7 forks source link

fix cloning private repos #67

Closed lucabello closed 1 year ago

lucabello commented 1 year ago

Issue

Closes #66

Solution

The Key permission problem has been solved by simply changing the permissions of the private key file to 600.

For the known_hosts problem, (file missing and manual trust prompt), the charm is now parsing the git_repo for the remote (e.g., github.com, git.launchpad.net) and automatically adding the remote's public key to known_hosts through ssh-keyscan {remote}.
Note that this happens on config-changed, meaning that the charm will temporarily (until the first config-changed) fail the sync on juju deploy, but it's probably not an issue :)

I also updated the README to document the feature!

lucabello commented 1 year ago

All the problems pointed out in the issue have been addressed, and I've tested the charm locally, proving it works with private repos :)

Screenshot_20230728_122656

Additionally, I added some remarks/docs in the README pointing out how the feature should be used (including how to correctly specify the key through juju config)