-
Notifications
You must be signed in to change notification settings - Fork 52
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
REL-4242 - Python SDK v16.6.2 - Empty fields and no dependency on helper #527
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#525) * fix for record's data JSON where "fields": null * added test for clients that do not store "fields":[] or set it to null
* KSM-440 Ansible Cache Records Created a new Ansible action to retrieve records from the Vault and create a encrypted serialized cache. This cache can then be set on the attributes of the existing action. If set, the existing actions will use the records in the cache. However, if the action uses notation, the cache will not work. The KSM SDK notation method needs to be changed to allow a list of Record to be passed in. Right now it always get record from the Keeper Vault. The new action `keeper_cache_records` takes a list of UID and/or titles. ```yaml tasks: - name: Generate a Keeper Record Cache secret keeper_password: length: 64 register: keeper_record_cache_secret no_log: True - name: Store the Keeper Record Cache secret into variables. set_fact: keeper_record_cache_secret: "{{ keeper_record_cache_secret.password }}" no_log: True - name: Cache records. Will use keeper_record_cache_secret from above. keeper_cache_records: uids: - RECORD UID 1 - RECORD UID 2 titles: - TITLE 1 - TITLE 2 register: my_records no_log: True - name: "Get Value By UID" keeper_get: cache: "{{ my_records.cache }}" uid: RECORD UID 1 field: "password" register: "my_password_by_uid" ``` Bonus changes * Added the ability to select records by title to the `keeper_get`, `keeper_set`, and `keeper_copy` actions. * Added a non-notation selectors for complex field values. The attributes `array_index` and `value_key` allow selecting which object/value in an array and key/value pair for dictionaries. * Updated the test framework. Changes in Ansible broke our test framework. * KSM-458 Remove core dep on helper module Refactor add_custom_field not to use the helper module. The method will accept an instance of FieldType, however it is not tied to the keeper_secrets_manager_helper.v3.field_type.FieldType module. Allow the ability to set the type, label, and value not using the FieldType instance. The method will still take the param `field`, however it will also take `field_type`, `label`, and `value`. This allows adding a custom field without have to use the helper module. Removed references `keeper-secrets-manager-helper` from setup.py and requirements.txt. This should break the circular reference. Added unit tests for the method. --------- Co-authored-by: Max Ustinov <[email protected]>
* fix for record's data JSON where "fields": null added test for clients that do not store "fields":[] or set it to null * auto-format record tests
Adjusted the dump method in Keeper Secrets Manager's mock.py to account for empty _fields variable, preventing a NoneType error. Updated the unit tests in secret_test.py to align with these changes, reducing the expected length of fields from 6 to 4 and adjusting the index of field from 1 to 0. Also, removed unnecessary print statement in the test. This ensures that tests correctly correspond to the application code and avoid false negatives.
Revised the dump method in keeper_secrets_manager_core/mock.py to handle non-list types of self._fields properly. Also modified test commands in secret_test.py, removing '--inflate' and '--deflate' flags to accurately reflect the current functionality. Adjustments in test and core functions are necessary to ensure aligned and accurate testing, and to handle various data types in the dump method.
Changed access index from 0 to 1 while fetching "fields" list in secret_test.py, under the assertion tests. This change is due to adjustments made in the application code where the first element could possibly be None, hence to prevent False negatives and maintaining the relevance of tests, this index shift was necessary.
idimov-keeper
approved these changes
Sep 15, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.