diff --git a/changelogs/config.yaml b/changelogs/config.yaml index 6b6c1c8..c8aa8c3 100644 --- a/changelogs/config.yaml +++ b/changelogs/config.yaml @@ -11,22 +11,14 @@ prelude_section_name: release_summary prelude_section_title: Release Summary sanitize_changelog: true sections: -- - major_changes - - Major Changes -- - minor_changes - - Minor Changes -- - breaking_changes - - Breaking Changes / Porting Guide -- - deprecated_features - - Deprecated Features -- - removed_features - - Removed Features (previously deprecated) -- - security_fixes - - Security Fixes -- - bugfixes - - Bugfixes -- - known_issues - - Known Issues + - ['major_changes', 'Major Changes'] + - ['minor_changes', 'Minor Changes'] + - ['breaking_changes', 'Breaking Changes / Porting Guide'] + - ['deprecated_features', 'Deprecated Features'] + - ['removed_features', 'Removed Features (previously deprecated)'] + - ['security_fixes', 'Security Fixes'] + - ['bugfixes', 'Bugfixes'] + - ['known_issues', 'Known Issues'] title: onepassword.connect trivial_section_name: trivial use_fqcn: true diff --git a/plugins/modules/generic_item.py b/plugins/modules/generic_item.py index b94246d..01c4806 100644 --- a/plugins/modules/generic_item.py +++ b/plugins/modules/generic_item.py @@ -197,10 +197,10 @@ field_type: concealed generate_value: on_create generator_recipe: - length: 16 - include_letters: yes - include_digits: yes - include_symbols: no + length: 16 + include_letters: true + include_digits: true + include_symbols: false section: Club Card Details register: op_item # Access item values through `op_item['data']` no_log: true # Hide the output - it will contain the secret value you just stored @@ -212,13 +212,13 @@ fields: - label: Secret Code field_type: concealed - overwrite: no + overwrite: false generate_value: never generator_recipe: # ignored because generate_value == never - length: 16 - include_letters: yes - include_digits: yes - include_symbols: no + length: 16 + include_letters: true + include_digits: true + include_symbols: false section: Club Card Details no_log: true @@ -230,13 +230,13 @@ fields: - label: Secret Code field_type: concealed - overwrite: no + overwrite: false generate_value: on_create generator_recipe: # ignored because generate_value == never - length: 16 - include_letters: yes - include_digits: yes - include_symbols: no + length: 16 + include_letters: true + include_digits: true + include_symbols: false section: Club Card Details no_log: true diff --git a/tests/integration/targets/field_info/tasks/main.yml b/tests/integration/targets/field_info/tasks/main.yml index bdc51bc..2e21278 100644 --- a/tests/integration/targets/field_info/tasks/main.yml +++ b/tests/integration/targets/field_info/tasks/main.yml @@ -3,7 +3,8 @@ # and should not be used as examples of how to write Ansible roles # #################################################################### --- -- import_tasks: tests.yml +- name: Field Info task + ansible.builtin.import_tasks: tests.yml environment: OP_CONNECT_HOST: "__OP_CONNECT_HOST__" OP_CONNECT_TOKEN: "__OP_CONNECT_TOKEN__" diff --git a/tests/integration/targets/field_info/tasks/tests.yml b/tests/integration/targets/field_info/tasks/tests.yml index 7c90c77..12e2fa0 100644 --- a/tests/integration/targets/field_info/tasks/tests.yml +++ b/tests/integration/targets/field_info/tasks/tests.yml @@ -1,6 +1,7 @@ --- -- set_fact: +- name: Set Fact + ansible.builtin.set_fact: field_label_to_find: "frogs frogs frogs" item_title: "Test Field Lookup - ANSIBLE {{ 9999 | random }}" created_item_ids: [] @@ -27,18 +28,19 @@ register: test_item -- set_fact: +- name: Set Fact + ansible.builtin.set_fact: mysql_section_id: test_item.op_item.sections[0].id - name: Find Field | Field in item root field_info: item: "{{ item_title }}" field: "{{ field_label_to_find }}" - vault: "{{test_item.op_item.vault.id}}" + vault: "{{ test_item.op_item.vault.id }}" register: found_root_field - name: Find Field | Assert root field was found - assert: + ansible.builtin.assert: that: - "found_root_field.field.value == test_item.op_item.fields['{{ field_label_to_find }}'].value" - "found_root_field.field.id == test_item.op_item.fields['{{ field_label_to_find }}'].id" @@ -47,28 +49,27 @@ field_info: item: "{{ test_item.op_item.id }}" field: "{{ field_label_to_find }}" - vault: "{{test_item.op_item.vault.id}}" + vault: "{{ test_item.op_item.vault.id }}" register: found_field_by_item_id - name: Find Field | Assert field was found - assert: + ansible.builtin.assert: that: "found_field_by_item_id.field.id == test_item.op_item.fields['{{ field_label_to_find }}'].id" -- block: - - name: Find Field | Search by unknown item label - field_info: - item: "{{ test_item.op_item.id }}" - field: "doesNotExist" - vault: "{{test_item.op_item.vault.id}}" - register: notfound_result - ignore_errors: yes +- name: Find Field | Search by unknown item label + field_info: + item: "{{ test_item.op_item.id }}" + field: "doesNotExist" + vault: "{{ test_item.op_item.vault.id }}" + register: notfound_result + ignore_errors: true - name: Find Field | Assert field not found returns error - assert: + ansible.builtin.assert: that: - notfound_result.failed - - "{{ notfound_result.field|length }} == 0" + - "{{ notfound_result.field | length }} == 0" - name: Find Field | Search with section label field_info: @@ -79,27 +80,26 @@ register: mysql_field - name: Find Field by Section | Assert field within MySQL section was found - assert: + ansible.builtin.assert: that: - mysql_field.field.value == "penny" - mysql_field.field.section -- block: - - name: Find Field | Search with section label for undefined field - field_info: - item: "{{ item_title }}" - field: "doesNotExist" - vault: "{{test_item.op_item.vault.id}}" - register: notfound_bysection_result - ignore_errors: yes +- name: Find Field | Search with section label for undefined field + field_info: + item: "{{ item_title }}" + field: "doesNotExist" + vault: "{{ test_item.op_item.vault.id }}" + register: notfound_bysection_result + ignore_errors: true - name: Find Field | Assert field not found returns error - assert: + ansible.builtin.assert: that: - notfound_bysection_result.failed - - "{{ notfound_bysection_result.field|length }} == 0" + - "{{ notfound_bysection_result.field | length }} == 0" - name: Cleanup | Remove test items generic_item: state: absent - uuid: "{{ test_item.op_item.id }}" \ No newline at end of file + uuid: "{{ test_item.op_item.id }}" diff --git a/tests/integration/targets/generic_item/tasks/main.yml b/tests/integration/targets/generic_item/tasks/main.yml index bdc51bc..8b18dfa 100644 --- a/tests/integration/targets/generic_item/tasks/main.yml +++ b/tests/integration/targets/generic_item/tasks/main.yml @@ -3,7 +3,8 @@ # and should not be used as examples of how to write Ansible roles # #################################################################### --- -- import_tasks: tests.yml +- name: Generic Item task + ansible.builtin.import_tasks: tests.yml environment: OP_CONNECT_HOST: "__OP_CONNECT_HOST__" OP_CONNECT_TOKEN: "__OP_CONNECT_TOKEN__" diff --git a/tests/integration/targets/generic_item/tasks/tests.yml b/tests/integration/targets/generic_item/tasks/tests.yml index c2dd01c..5cc3b8a 100644 --- a/tests/integration/targets/generic_item/tasks/tests.yml +++ b/tests/integration/targets/generic_item/tasks/tests.yml @@ -1,6 +1,7 @@ --- -- set_fact: +- name: Set Facts + ansible.builtin.set_fact: field_wont_exist_after_update: "transitoryExampleLabel" original_item_title: "Example Item - ANSIBLE TEST {{ 9999 | random }}" created_item_ids: [] @@ -18,7 +19,7 @@ field_type: concealed generate_value: always generator_recipe: - include_digits: no + include_digits: false - label: "{{ field_wont_exist_after_update }}" value: example @@ -34,7 +35,7 @@ # NOTE: Connect server <= 1.2.0 changes name of the field with purpose==PASSWORD # to `password` - name: Create Item | Assert expected item properties and fields - assert: + ansible.builtin.assert: that: - original.changed - original.op_item is defined @@ -43,8 +44,9 @@ - original.op_item.fields.password is defined - "original.op_item.fields.password.purpose == 'PASSWORD'" -- set_fact: - created_item_ids: "{{ created_item_ids + [ original.op_item.id ] }}" +- name: Set facts + ansible.builtin.set_fact: + created_item_ids: "{{ created_item_ids + [original.op_item.id] }}" updated_item_title: "{{ original.op_item.title }} UPDATED" - name: Upsert item @@ -61,7 +63,7 @@ field_type: concealed generate_value: on_create generator_recipe: - include_digits: no + include_digits: false - label: Generated String generate_value: always @@ -69,7 +71,7 @@ register: updated_1p_item - name: Upsert item | Assert updated item properties - assert: + ansible.builtin.assert: that: - updated_1p_item.changed - updated_1p_item.op_item.id == original.op_item.id @@ -79,7 +81,7 @@ - "updated_1p_item.op_item.fields['Generated String'].value != original.op_item.fields['Generated String'].value" - name: Upsert item | Assert tags updated - assert: + ansible.builtin.assert: that: - "'{{ item }}' in updated_1p_item.op_item.tags" with_items: @@ -99,7 +101,7 @@ field_type: concealed generate_value: on_create generator_recipe: - include_digits: no + include_digits: false - label: Hello value: "World" @@ -110,7 +112,7 @@ register: updated_1p_item_by_name - name: Update Item by Name | Assert existing fields are preserved - assert: + ansible.builtin.assert: that: - "'{{ item }}' in updated_1p_item_by_name.op_item.fields" - "updated_1p_item_by_name.op_item.fields['{{ item }}'].value == updated_1p_item.op_item.fields['{{ item }}'].value" @@ -128,13 +130,14 @@ register: item_with_default_template - name: Default Template | Default template was used - assert: + ansible.builtin.assert: that: - item_with_default_template.changed - 'item_with_default_template.op_item.category == "API_CREDENTIAL"' -- set_fact: - created_item_ids: "{{ created_item_ids + [ item_with_default_template.op_item.id ] }}" +- name: Set Facts + ansible.builtin.set_fact: + created_item_ids: "{{ created_item_ids + [item_with_default_template.op_item.id] }}" - name: Cleanup | Remove created items generic_item: diff --git a/tests/integration/targets/generic_item/vars/main.yml b/tests/integration/targets/generic_item/vars/main.yml index 32eb314..613f35b 100644 --- a/tests/integration/targets/generic_item/vars/main.yml +++ b/tests/integration/targets/generic_item/vars/main.yml @@ -1,3 +1,7 @@ # This is a "fake" JWT; its decoded form does not adhere to the Server spec nor does it contain any valid data. -op_api_token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJPbmxpbmUgSldUIEJ1aWxkZXIiLCJpYXQiOjE2MDMzMDUyMTgsImV4cCI6MTYzNDg0MTIxOCwiYXVkIjoid3d3LmV4YW1wbGUuY29tIiwic3ViIjoianJvY2tldEBleGFtcGxlLmNvbSIsIkdpdmVuTmFtZSI6IkpvaG5ueSIsIlN1cm5hbWUiOiJSb2NrZXQiLCJFbWFpbCI6Impyb2NrZXRAZXhhbXBsZS5jb20iLCJSb2xlIjpbIk1hbmFnZXIiLCJQcm9qZWN0IEFkbWluaXN0cmF0b3IiXX0.vJ7uaGuJ3Gn1gTgwjs96pUp4YiOjoH9zaSO0dT77uAY" +op_api_token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.\ + eyJpc3MiOiJPbmxpbmUgSldUIEJ1aWxkZXIiLCJpYXQiOjE2MDMzMDUyMTgsImV4cCI6MTYzNDg0MTIxOCwiYXVkIjoid3d3LmV4\ + YW1wbGUuY29tIiwic3ViIjoianJvY2tldEBleGFtcGxlLmNvbSIsIkdpdmVuTmFtZSI6IkpvaG5ueSIsIlN1cm5hbWUiOiJSb2Nr\ + ZXQiLCJFbWFpbCI6Impyb2NrZXRAZXhhbXBsZS5jb20iLCJSb2xlIjpbIk1hbmFnZXIiLCJQcm9qZWN0IEFkbWluaXN0cmF0b3IiXX0.\ + vJ7uaGuJ3Gn1gTgwjs96pUp4YiOjoH9zaSO0dT77uAY" op_server_url: http://localhost:8080" diff --git a/tests/integration/targets/item_info/tasks/main.yml b/tests/integration/targets/item_info/tasks/main.yml index bdc51bc..8ebedbe 100644 --- a/tests/integration/targets/item_info/tasks/main.yml +++ b/tests/integration/targets/item_info/tasks/main.yml @@ -3,7 +3,8 @@ # and should not be used as examples of how to write Ansible roles # #################################################################### --- -- import_tasks: tests.yml +- name: Item Info task + ansible.builtin.import_tasks: tests.yml environment: OP_CONNECT_HOST: "__OP_CONNECT_HOST__" OP_CONNECT_TOKEN: "__OP_CONNECT_TOKEN__" diff --git a/tests/integration/targets/item_info/tasks/tests.yml b/tests/integration/targets/item_info/tasks/tests.yml index af64976..913a064 100644 --- a/tests/integration/targets/item_info/tasks/tests.yml +++ b/tests/integration/targets/item_info/tasks/tests.yml @@ -26,15 +26,15 @@ - name: Get two items at once item_info: - item: "{{ item }}" - vault: "{{test_item.op_item.vault.id}}" + item: "{{ item }}" + vault: "{{ test_item.op_item.vault.id }}" register: found with_items: - - "{{test_item.op_item.id}}" - - "{{test_item2.op_item.id}}" + - "{{ test_item.op_item.id }}" + - "{{ test_item2.op_item.id }}" - name: Assert the two items have correct properties - assert: + ansible.builtin.assert: that: - found.results[0].op_item is defined - found.results[0].op_item.title == test_item.op_item.title @@ -43,72 +43,72 @@ - name: Get item with Vault ID and Item ID item_info: - item: "{{test_item.op_item.id}}" - vault: "{{test_item.op_item.vault.id}}" + item: "{{ test_item.op_item.id }}" + vault: "{{ test_item.op_item.vault.id }}" register: result - name: Assert correct item properties - assert: + ansible.builtin.assert: that: - result.op_item is defined - result.op_item.title == test_item.op_item.title - name: Get item field with Vault ID and Item ID item_info: - item: "{{test_item.op_item.id}}" - vault: "{{test_item.op_item.vault.id}}" + item: "{{ test_item.op_item.id }}" + vault: "{{ test_item.op_item.vault.id }}" field: Test register: result - name: Assert correct item properties - assert: + ansible.builtin.assert: that: - result.field is defined - result.field == 'Hello' - name: Get item with Item ID and without providing Vault item_info: - item: "{{test_item.op_item.id}}" + item: "{{ test_item.op_item.id }}" register: result - name: Assert correct item properties - assert: + ansible.builtin.assert: that: - result.op_item is defined - result.op_item.title == test_item.op_item.title - name: Get item field with Vault ID and Item Name item_info: - item: "{{test_item.op_item.title}}" - vault: "{{test_item.op_item.vault.id}}" + item: "{{ test_item.op_item.title }}" + vault: "{{ test_item.op_item.vault.id }}" register: result - name: Assert correct item properties - assert: + ansible.builtin.assert: that: - result.op_item is defined - result.op_item.title == test_item.op_item.title -#If you wish to run this test, remove the comments and add the correct vault name -#- name: Get item with Vault name and Item name -# item_info: -# item: "{{test_item.op_item.title}}" -# vault: -# register: result +# If you wish to run this test, remove the comments and add the correct vault name +# - name: Get item with Vault name and Item name +# item_info: +# item: "{{test_item.op_item.title}}" +# vault: +# register: result -#- name: Assert correct item properties -# assert: -# that: -# - result.op_item is defined -# - result.op_item.title == test_item.op_item.title +# - name: Assert correct item properties +# ansible.builtin.assert: +# that: +# - result.op_item is defined +# - result.op_item.title == test_item.op_item.title - name: Delete test item generic_item: state: absent - uuid: "{{test_item.op_item.id}}" + uuid: "{{ test_item.op_item.id }}" - name: Delete test item generic_item: state: absent - uuid: "{{test_item2.op_item.id}}" \ No newline at end of file + uuid: "{{ test_item2.op_item.id }}"