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

Refactor(eos_cli_config_gen): Wildcard dict to list for event-handlers #1634

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
event_handlers:
tracking:
- name: tracking
action_type: bash
action: /mnt/flash/tracking.sh
delay: 300
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2047,7 +2047,7 @@ monitor_connectivity:
```yaml
### Event Handler ###
event_handlers:
< event_handler_name >:
- name: < event_handler_name >
action_type: < Type of action. [bash, increment, log] >
action: < Command to execute >
delay: < Event-handler delay in seconds >
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{# eos - event-handler #}
{% if event_handlers is defined and event_handlers is iterable %}
{% if event_handlers is arista.avd.defined %}

## Event Handler

### Event Handler Summary

| Handler | Action Type | Action | Trigger |
| ------- | ----------- | ------ | ------- |
{% for handler in event_handlers | arista.avd.natural_sort %}
| {{ handler }} | {{ event_handlers[handler].action_type }} | {{ event_handlers[handler].action }} | {{ event_handlers[handler].trigger }} |
{% for handler in event_handlers | arista.avd.convert_dicts('name') | arista.avd.natural_sort('name') %}
| {{ handler.name }} | {{ handler.action_type }} | {{ handler.action }} | {{ handler.trigger }} |
{% endfor %}

### Event Handler Device Configuration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
{# eos - Event handlers #}
{% if event_handlers is arista.avd.defined %}
{% for handler in event_handlers %}
{% for handler in event_handlers | arista.avd.convert_dicts('name') | arista.avd.natural_sort('name') %}
!
event-handler {{ handler }}
{% if event_handlers[handler].trigger is arista.avd.defined %}
trigger {{ event_handlers[handler].trigger }}
{% if event_handlers[handler].regex is arista.avd.defined %}
regex {{ event_handlers[handler].regex }}
event-handler {{ handler.name }}
{% if handler.trigger is arista.avd.defined %}
trigger {{ handler.trigger }}
{% if handler.regex is arista.avd.defined %}
regex {{ handler.regex }}
{% endif %}
{% endif %}
{% if event_handlers[handler].action is arista.avd.defined and event_handlers[handler].action_type is arista.avd.defined %}
action {{ event_handlers[handler].action_type }} {{ event_handlers[handler].action }}
{% if handler.action is arista.avd.defined and handler.action_type is arista.avd.defined %}
action {{ handler.action_type }} {{ handler.action }}
{% endif %}
{% if event_handlers[handler].delay is arista.avd.defined %}
delay {{ event_handlers[handler].delay }}
{% if handler.delay is arista.avd.defined %}
delay {{ handler.delay }}
{% endif %}
{% if event_handlers[handler].asynchronous is arista.avd.defined(true) %}
{% if handler.asynchronous is arista.avd.defined(true) %}
asynchronous
{% endif %}
{% endfor %}
Expand Down