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

Fix(eos_cli_config_gen): Fix the schema and template for action in event-handler. #4007

Merged

Conversation

Shivani-gslab
Copy link
Contributor

@Shivani-gslab Shivani-gslab commented May 16, 2024

Change Summary

Fix the schema and template for action in event-handler

Related Issue(s)

Fixes #3899

Component(s) name

arista.avd.eos_cli_config_gen

Proposed changes

Currently, action_type key has three valid_values bash, log and increment but the combination of 2 keys can be implemented in config.

event-handler handler1
   action bash echo"action"
   action increment device-health metric metric1
event-handler handler1
   action log
   action increment device-health metric metric1

Deprecating the existing action_type and action key and adding new key -

actions:
   bash_command: <str>

   # Log a message when the event is triggered.
   log: <bool>

    # Name of device-health metric.
    increment_device_health_metric: <str>

Also the current template logic for action_type generates wrong config if action_type is log or increment, so fixing it.

How to test

Check the config in CLI.

Checklist

User Checklist

  • N/A

Repository Checklist

  • My code has been rebased from devel before I start
  • I have read the CONTRIBUTING document.
  • My change requires a change to the documentation and documentation have been updated accordingly.
  • I have updated molecule CI testing accordingly. (check the box if not applicable)

Copy link

Review docs on Read the Docs

To test this pull request:

# Create virtual environment for this testing below the current directory
python -m venv test-avd-pr-4007
# Activate the virtual environment
source test-avd-pr-4007/bin/activate
# Install all requirements including PyAVD
pip install "pyavd[ansible] @ git+https://github.com/Shivani-gslab/avd.git@event_handler_action#subdirectory=python-avd" --force
# Install Ansible collection
ansible-galaxy collection install git+https://github.com/Shivani-gslab/avd.git#/ansible_collections/arista/avd/,event_handler_action --force
# Optional: Install AVD examples
cd test-avd-pr-4007
ansible-playbook arista.avd.install_examples

@github-actions github-actions bot added role: eos_cli_config_gen issue related to eos_cli_config_gen role state: CI Updated CI scenario have been updated in the PR state: Documentation role Updated role: eos_designs issue related to eos_designs role labels May 16, 2024
@Shivani-gslab Shivani-gslab force-pushed the event_handler_action branch 6 times, most recently from e17db25 to f823b60 Compare May 20, 2024 07:01
Copy link
Contributor

@Vibhu-gslab Vibhu-gslab left a comment

Choose a reason for hiding this comment

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

LGTM!

@Vibhu-gslab Vibhu-gslab marked this pull request as ready for review May 21, 2024 06:09
@Vibhu-gslab Vibhu-gslab requested review from a team as code owners May 21, 2024 06:09
@ClausHolbechArista ClausHolbechArista merged commit 68a5a37 into aristanetworks:devel May 21, 2024
40 checks passed
@Shivani-gslab Shivani-gslab deleted the event_handler_action branch May 21, 2024 09:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rn: Fix(eos_cli_config_gen) role: eos_cli_config_gen issue related to eos_cli_config_gen role role: eos_designs issue related to eos_designs role state: CI Updated CI scenario have been updated in the PR state: Documentation role Updated
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix(eos_cli_config_gen): Fix the logic for action in event-handler
3 participants