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

Missing "protocol" attribute for device.EmailServer #230

Closed
ntwrkguru opened this issue Jun 7, 2021 · 1 comment
Closed

Missing "protocol" attribute for device.EmailServer #230

ntwrkguru opened this issue Jun 7, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@ntwrkguru
Copy link
Contributor

Describe the bug

PanOS 10 changed the configuration of the email server slightly, now requiring the "protocol" attribute. This renders the panos_email_server.py module broken when dealing with PanOS 10+ devices.

Expected behavior

panos_email_server.py should properly configure an email server and allow it to commit without error or ignoring errors

Current behavior

Commit fails since the protocol attribute is missing.

PLAY [all] ****************************************************************************************************************************

TASK [Gathering Facts] ****************************************************************************************************************
ok: [fw1]

TASK [Get facts] **********************************************************************************************************************
ok: [fw1]

TASK [Print facts] ********************************************************************************************************************
ok: [fw1] => {
    "panos_facts.ansible_facts.ansible_net_version": "10.0.0"
}

TASK [Create email profile] ***********************************************************************************************************
changed: [fw1]

TASK [Create email server in an email profile] ****************************************************************************************
changed: [fw1]

TASK [Commit the changes] *************************************************************************************************************
fatal: [fw1]: FAILED! => {"changed": false, "msg": "Partial changes to commit: changes to configuration by all administrators | Changes to shared configuration | Validation Error: |  log-settings -> email -> default -> server -> default  is missing 'protocol' |  log-settings -> email -> default -> server is invalid"}

PLAY RECAP ****************************************************************************************************************************
fw1                        : ok=5    changed=2    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0  

Possible solution

  • Add support for the protocol attribute to pan-os-python - PR 348
  • Add support for the protocol attribute to pan-os-ansible

Steps to reproduce

---
- hosts: all
  connection: local

  vars:
    device:
      ip_address: '{{ ip_address }}'
      username: '{{ username | default(omit) }}'
      password: '{{ password | default(omit) }}'
      api_key: '{{ api_key | default(omit) }}'

  tasks:
    - name: Get facts
      paloaltonetworks.panos.panos_facts:
        provider: '{{ device }}'
      register: panos_facts
    
    - name: Print facts
      debug:
        var: panos_facts.ansible_facts.ansible_net_version

    - name: Create email profile
      paloaltonetworks.panos.panos_email_profile:
        provider: '{{ device }}'
        name: 'default'

    - name: Create email server in an email profile
      paloaltonetworks.panos.panos_email_server:
        provider: '{{ device }}'
        email_profile: 'default'
        name: 'default'
        from_email: '[email protected]'
        to_email: '[email protected]'
        email_gateway: 'smtp.example.com'

    - name: Commit the changes
      paloaltonetworks.panos.panos_commit_firewall:
        provider: '{{ device }}'

Screenshots

See current behavior section ^^

Context

Since upgrading to PanOS 10

Your Environment

  • Collection: 2.6.0
  • Python: 3.9.5
  • Ansible: 2.11.1
  • PAN-OS Python Library & version: pan-os-python==1.2.0, pan-python==0.16.0
@ntwrkguru ntwrkguru added the bug Something isn't working label Jun 7, 2021
@mrichardson03
Copy link
Contributor

Closed by #347.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants