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

Bug(eos_cli_config_gen): NTP authentication keys don't render if the hash_algorithm isn't defined, but it is not mandatory in the schema #4732

Open
1 task done
colinmacgiolla opened this issue Nov 15, 2024 · 1 comment
Labels
type: bug Something isn't working

Comments

@colinmacgiolla
Copy link
Contributor

Issue Summary

The currect schema specifies the following:

  authentication_keys:

      # Key identifier.
    - id: <int; 1-65534; required; unique>
      hash_algorithm: <str; "md5" | "sha1">

      # Obfuscated key.
      key: <str>
      key_type: <str; "0" | "7" | "8a">

However the code for that section requires the hash_algorithm.

{%     for authentication_key in ntp.authentication_keys | arista.avd.natural_sort('id') %}
{%         if authentication_key.id is arista.avd.defined and
              authentication_key.key is arista.avd.defined and
              authentication_key.hash_algorithm is arista.avd.defined %}
{%             set ntp_auth_key_cli = "ntp authentication-key " ~ authentication_key.id ~ " " ~ authentication_key.hash_algorithm %}
{%             if authentication_key.key_type is arista.avd.defined %}
{%                 set ntp_auth_key_cli = ntp_auth_key_cli ~ " " ~ authentication_key.key_type %}
{%             endif %}
{%             set ntp_auth_key_cli = ntp_auth_key_cli ~ " " ~ authentication_key.key | arista.avd.hide_passwords(hide_passwords) %}
{{ ntp_auth_key_cli }}
{%         endif %}
{%     endfor %}

As I see it, we could go 3 ways as a bug fix;

  1. Mark the hash_algorithm as required in the schema
  2. Set the default hash_algorithm as md5
  3. Redo the jinja2 template to render even if the hash_algorithm is unspecified

Which component(s) of AVD impacted

eos_cli_config_gen

How do you run AVD ?

Ansible CLI (with virtual-env or native python)

Steps to reproduce

No response

Relevant log output

No response

Contributing Guide

  • I agree to follow this project's Code of Conduct
@colinmacgiolla colinmacgiolla added the type: bug Something isn't working label Nov 15, 2024
@ClausHolbechArista
Copy link
Contributor

This is a general issue in eos_cli_config_gen. We currently don't enforce required models in the schema because that will also affect structured_config in eos_designs which would be annoying when you just want to update one key. We will try to figure out how to modify the validation so we don't enforce the "required" keys for structured config.

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

No branches or pull requests

2 participants