Skip to content
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

feature(panos_object_facts): Added support for Custom URL Categories #249

Conversation

patrikkaren
Copy link
Contributor

Description

Added support for Custom URL Categories in panos_object_facts.py

Motivation and Context

Needed to be able to read from objects.CustomUrlCategory.

How Has This Been Tested?

Test task:

`

  • name: Get running config url categories
    paloaltonetworks.panos.panos_object_facts:
    provider: '{{ provider }}'
    object_type: 'custom-url-category'
    field: 'name'
    field_search_type: 'regex'
    field_search_value: '.*'
    register: running_custom_url_categories

  • name: Print all url categories
    debug:
    var: item
    with_items:

    • '{{ running_custom_url_categories }}'
      `

Test output:
`
$ ansible-playbook panos.yaml -l --tags url_test --ask-vault-pass
Vault password:

PLAY [panos playbook] **************************************************************************************
*

TASK [panos : load secret vars] ******************************************************************************
*
ok: []

TASK [panos : Get running config url categories] *************************************************************
*
ok: []

TASK [panos : Print all url categories] ************************************************************************
*
ok: [] => (item={'changed': False, 'ansible_module_results': {}, 'objects': [{'url_value': ['cat1.com'], 'description': 'The No 1 category', 'type': 'URL List', 'name': 'custom-url-category-1'}, {'url_value': ['.cat2.com', 'cat2.com', 'cat2.net'], 'description': None, 'type': 'URL List', 'name': 'custom-url-category-2'}, {'url_value': ['.cat3.com', 'host.cat3.com'], 'description': None, 'type': 'URL List', 'name': 'custom-url-category-3'}], 'failed': False}) => {
"ansible_loop_var": "item",
"item": {
"ansible_module_results": {},
"changed": false,
"failed": false,
"objects": [
{
"description": "The No 1 category",
"name": "custom-url-category-1",
"type": "URL List",
"url_value": [
"cat1.com"
]
},
{
"description": null,
"name": "custom-url-category-2",
"type": "URL List",
"url_value": [
".cat2.com",
"cat2.com",
"cat2.net"
]
},
{
"description": null,
"name": "custom-url-category-3",
"type": "URL List",
"url_value": [
"
.cat3.com",
"host.cat3.com"
]
}
]
}
}

PLAY RECAP **************************************************************************************
*
: ok=3 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
`

Screenshots (if appropriate)

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • [ X ] I have updated the documentation accordingly.
  • [ X ] I have read the CONTRIBUTING document.
  • [ - ] I have added tests to cover my changes if appropriate.
  • [ - ] All new and existing tests passed.

@welcome-to-palo-alto-networks

🎉 Thanks for opening this pull request! We really appreciate contributors like you! 🙌

Copy link
Collaborator

@shinmog shinmog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@shinmog shinmog merged commit 30be003 into PaloAltoNetworks:develop Sep 21, 2021
@welcome-to-palo-alto-networks

🎉 Congrats on getting your first pull request merged! We here at Palo Alto Networks are so grateful! ❤️

github-actions bot pushed a commit that referenced this pull request Oct 5, 2021
## [2.9.0](v2.8.0...v2.9.0) (2021-10-05)

### Features

* **panos_object_facts:** Add support for Custom URL Categories ([#249](#249)) ([30be003](30be003))

### Bug Fixes

* Improve minimum package error message ([#271](#271)) ([a77a53d](a77a53d))
* **panos_nat_rule:** Correct KeyError for dynamic xlate ([#267](#267)) ([03071b4](03071b4))
@github-actions
Copy link

github-actions bot commented Oct 5, 2021

🎉 This PR is included in version 2.9.0 🎉

The release is available on Ansible Galaxy and GitHub release

Posted by semantic-release bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants