-
Notifications
You must be signed in to change notification settings - Fork 28
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
Save Profile Properties to Config File & Secure Vault Storage (#73, #72) #201
Conversation
Signed-off-by: samadpls <[email protected]>
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.
Looks like a good start to me 👍 Left one comment
Signed-off-by: samadpls <[email protected]>
Signed-off-by: samadpls <[email protected]>
Codecov ReportAttention:
📢 Thoughts on this report? Let us know!. |
Signed-off-by: samadpls <[email protected]>
Signed-off-by: samadpls <[email protected]>
Signed-off-by: samadpls <[email protected]>
Signed-off-by: samadpls <[email protected]>
Signed-off-by: samadpls <[email protected]>
…nfig_file classes Signed-off-by: samadpls <[email protected]>
Signed-off-by: samadpls <[email protected]>
Signed-off-by: samadpls <[email protected]>
Signed-off-by: samadpls <[email protected]>
Signed-off-by: Timothy Johnson <[email protected]>
…_highest_priority_layer` functions Signed-off-by: samadpls <[email protected]>
Signed-off-by: samadpls <[email protected]>
…found Signed-off-by: samadpls <[email protected]>
Signed-off-by: samadpls <[email protected]>
Signed-off-by: Abdul Samad Siddiqui <[email protected]>
Signed-off-by: samadpls <[email protected]>
Signed-off-by: samadpls <[email protected]>
Signed-off-by: samadpls <[email protected]>
Signed-off-by: samadpls <[email protected]>
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.
Left a few comments 🙂 Also please address failing tests
Signed-off-by: samadpls <[email protected]>
Signed-off-by: samadpls <[email protected]>
Signed-off-by: samadpls <[email protected]>
…les. Signed-off-by: samadpls <[email protected]>
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'm having some issues when testing this PR using the following procedure:
- Using Zowe CLI, run
zowe config init --no-prompt
to create a zowe.config.json template. - Using the Python SDK, run a test script to update a profile property:
from zowe.core_for_zowe_sdk import ProfileManager pm = ProfileManager(show_warnings=False) pm.load(profile_type="zosmf") pm.set_property("profiles.zosmf.properties.port", 1443) pm.save()
- Receive an error because "zowe.config.user.json" is missing:
Traceback (most recent call last):
File "/Users/Timothy/Projects/zowe/zowe-client-python-sdk/test.py", line 9, in <module>
pm.set_property("profiles.zosmf.properties.port", 1443)
File "/Users/Timothy/Projects/zowe/zowe-client-python-sdk/src/core/zowe/core_for_zowe_sdk/profile_manager.py", line 362, in set_property
highest_priority_layer = self.get_highest_priority_layer(json_path)
File "/Users/Timothy/Projects/zowe/zowe-client-python-sdk/src/core/zowe/core_for_zowe_sdk/profile_manager.py", line 334, in get_highest_priority_layer
layer.init_from_file()
File "/Users/Timothy/Projects/zowe/zowe-client-python-sdk/src/core/zowe/core_for_zowe_sdk/config_file.py", line 119, in init_from_file
self.autodiscover_config_dir()
File "/Users/Timothy/Projects/zowe/zowe-client-python-sdk/src/core/zowe/core_for_zowe_sdk/config_file.py", line 234, in autodiscover_config_dir
raise FileNotFoundError(f"Could not find the file {self.filename}")
FileNotFoundError: Could not find the file zowe.config.user.json
Signed-off-by: samadpls <[email protected]>
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.
Nice work thus far @samadpls!
Regarding the error w/ a missing zowe.config.user.json
:
If I provide a zowe.config.user.json
in my working directory, the code continues, but it then tries to open a zowe.config.user.json
in my Zowe home directory. It fails here as it cannot find the file in my .zowe
folder.
However, the code looks good so far, so I think once the error handling is added for accessing zowe.config.user.json
, it should work as intended 🙂
@@ -42,6 +42,8 @@ | |||
|
|||
# Profile datatype is used by ConfigFile to return Profile Data along with | |||
# metadata such as profile_name and secure_props_not_found | |||
|
|||
|
|||
class Profile(NamedTuple): |
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.
For the autodiscover_config_dir
function, do we want to skip over zowe.config.user.json
if it does not exist? It is optional, so we should avoid throwing exceptions for a missing user-level config.
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.
This could be resolved by implementing a try-except block while invoking the function.
Signed-off-by: samadpls <[email protected]>
Signed-off-by: samadpls <[email protected]>
Signed-off-by: Abdul Samad Siddiqui <[email protected]>
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.
Tested w/ changes and LGTM, thanks @samadpls!
Signed-off-by: Timothy Johnson <[email protected]>
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, thanks @samadpls!
What It Does
Resolves #73 , #72
How to Test
Review Checklist
I certify that I have:
Additional Comments