Skip to content

Directive examples in documentation does not work as expected #280

Closed

Description

@AliMickey

Deployment Type

Docker

Version

v2.0.4

Steps to Reproduce

  1. Copy contents of example from documentation into /etc/hyperglass/directives.yaml
  2. Start container and check logs

One example:

show-bgp-summary:
    name: BGP Summary
    rules:
        - condition: null
          command: show bgp all summary
    field: null

Expected Behavior

The directive should be parsed correctly and not throw errors.

Observed Behavior

Error shown.
Defining/undefining the directive on the device does not matter, same error.

Have tried many different custom directive configs but one way or another it throws a validation error.

Configuration

No response

Devices

No response

Logs

╭─────────────────────────────── locals ────────────────────────────────╮    │
│ │ data = {                                                              │    │
│ │        │   'id': 'show-bgp-summary',                                  │    │
│ │        │   'name': 'BGP Summary',                                     │    │
│ │        │   'rules': [                                                 │    │
│ │        │   │   {                                                      │    │
│ │        │   │   │   'condition': None,                                 │    │
│ │        │   │   │   'command': 'show bgp all summary'                  │    │
│ │        │   │   }                                                      │    │
│ │        │   ],                                                         │    │
│ │        │   'field': None                                              │    │
│ │        }                                                              │    │
│ │ self = Directive()                                                    │    │
│ ╰───────────────────────────────────────────────────────────────────────╯    │
╰──────────────────────────────────────────────────────────────────────────────╯
ValidationError: 3 validation errors for Directive
rules.condition
  Input should be a valid string [type=string_type, input_value=None, 
input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.8/v/string_type
field.Text
  Input should be a valid dictionary or instance of Text [type=model_type, 
input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.8/v/model_type
field.Select
  Input should be a valid dictionary or instance of Select [type=model_type, 
input_value=None, input_type=NoneType]
    For further information visit https://errors.pydantic.dev/2.8/v/model_type

Activity

  1. arhippa11 commented on Aug 10, 2024

    @arhippa11

    I am also receiving the same error.

  2. gondimcodes commented on Aug 13, 2024

    @gondimcodes

    Me too.

  3. enkrispi commented on Aug 21, 2024

    @enkrispi

    This works for me

    show-ip-bgp-summary:
        name: Show BGP Neighbor Summary
        rules:
            - condition: ""
              commands: show ip bgp summary
        field:
            description: ""
            options:
            - value: ""
    

    for FRR

    show-ip-bgp-summary:
        name: Show BGP Neighbor Summary
        rules:
            - condition: ""
              commands: vtysh -c "show ip bgp summary"
        field:
            description: ""
            options:
            - value: ""
    
  4. gondimcodes commented on Aug 24, 2024

    @gondimcodes

    The way you did it worked. The documentation has errors because look: you used "commands" and in the documentation it says "command". Another detail is how the "field" is defined. It only worked defining it the way you did.

  5. LucaTheHacker commented on Oct 29, 2024

    @LucaTheHacker

    If documentation has errors you can submit a PR to fix that

  6. Jimmy01240397 commented on Oct 31, 2024

    @Jimmy01240397
    Contributor

    I had submitted a PR to fix this bug. Can someone merge it?

  7. LucaTheHacker commented on Oct 31, 2024

    @LucaTheHacker

    We need to wait for @thatmattlove

  8. warriorsoul15 commented on Sep 5, 2025

    @warriorsoul15

    I still have an issue with this.

    show-ip-bgp-summary:
    name: Show BGP Neighbor Summary
    rules:
    - condition: ""
    commands: show ip bgp summary
    field:
    description: ""
    options:
    - value: ""

    This will still require entering a value in the GUI for me and as no values are declared I cant enter one. The command doesnt require any inputs or fields.

  9. jdhall75 commented on Sep 30, 2025

    @jdhall75
    Collaborator

    Fixed in #299.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions