-
Notifications
You must be signed in to change notification settings - Fork 27
EBS-1070 Fix #427 VSDK fix required to handle empty system password during Lua to VSDK upgrade #428
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
Conversation
mrburke
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good but can take another pass when the unit tests are updated as well
de103c9 to
c1b7672
Compare
7c0de1f to
486ec26
Compare
|
Able to reproduce this issue in-house, the suggested solution will definitely work. But one alternate decent solution could be simply checking below before returning "PasswordCredentials"
The actual bug is the engine was returning empty password [but not key_pair] while the plugin is returning "PasswordCredentials" only if non-empty password OR else returns "KeyPairCredentials". While in this case since the engine returns empty password plugin will return the "KeyPairCredentials" which won't have the "password" attribute. |
Would this work if, for some reason a KeyPairCredentials with a password field is returned since protobuf definition allows that? |
ravi-cm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm.
But protobuf also allow password along with KeyPairCredentials private and public keys. |
…sword during Lua to VSDK upgrade
Problem:
For EBS plugin implemented in vsdk, we use passwordCredentialsSupplier for System Password field which is retrieved from UI and used in our workflows. But this field is optional field, where user may not provide it in most of the cases. So when we upgrade the plugin from Lua to VSDK and empty password is passed in for System password field. After upgrade, when VSDK code retrieves it using retrieve_credentials() it fails with AttributeError as retrieve_credentials() returns the KeyPairCredentials() instead of PasswordCredentials().
Call the retrieve_credentials() with dict {'password': '', 'type': 'NamedPasswordCredential'},
Solution:
This is because there is a check credentials_result.password != "" which is incorrect as password in this failure is observed when an empty string used from plugin, instead we tried to check whether there is a attribute "password" in the
credentials_resultobject using the condition,But irrespective of whether it is
PasswordCredentialsorKeyPairCredentialsthe password attribute will be present even when it's a key pair result,This is the protobuf definition of that result object:
So we currently check whether
key_pair.private_keyandkey_pair.public_keyare empty to considercredentials_resultas PasswordCredentials otherwise it can be considered as KeyPairCredentials.Thanks to @rasantel for the help and suggestion.
Testing
EBS upgrade:
Tested EBS plugin with Datasets by performing upgrade from Lua to VSDK with empty system password with this change and Datasets are recovered successfully after upgrade.
Blackbox runs:
appdata_python_samples
QARunner -d dlpxdc.co group -g dlpx-master nightly -r appdata_python_samples remote --run-params='-p virt-sdk-repo=https://github.com/Balamuruhan/virtualization-sdk.git -p virt-sdk-branch=develop -p qa-plugin-repo=https://gitlab.delphix.com/balamuruhan.suriyakumar/qa-appdata-toolkits.git'
http://selfservice.jenkins.delphix.com/job/blackbox-self-service/15404/consoleFull
APPDATA_PYTHON_DIRECT_CENTOS73
QARunner -d dlpxdc.co group -g dlpx-master nightly -r appdata_basic --run-config APPDATA_PYTHON_DIRECT_CENTOS73 remote --run-params='-p virt-sdk-repo=https://github.com/Balamuruhan/virtualization-sdk.git -p virt-sdk-branch=develop -p qa-plugin-repo=https://gitlab.delphix.com/balamuruhan.suriyakumar/qa-appdata-toolkits.git'
http://selfservice.jenkins.delphix.com/job/blackbox-self-service/15401/consoleFull
APPDATA_PYTHON_STAGED_CENTOS73
QARunner -d dlpxdc.co group -g dlpx-master nightly -r appdata_basic --run-config APPDATA_PYTHON_STAGED_CENTOS73 remote --run-params='-p virt-sdk-repo=https://github.com/Balamuruhan/virtualization-sdk.git -p virt-sdk-branch=develop -p qa-plugin-repo=https://gitlab.delphix.com/balamuruhan.suriyakumar/qa-appdata-toolkits.git'
http://selfservice.jenkins.delphix.com/job/blackbox-self-service/15405/consoleFull
For unit tests:
Failure is due to the windows-latest image that doesn't support Python 2.7, I have submitted TOOLS ticket for the new image to be used.
https://delphix.atlassian.net/browse/TOOL-13254