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

Directive examples in documentation does not work as expected #280

Open
AliMickey opened this issue Jul 25, 2024 · 7 comments
Open

Directive examples in documentation does not work as expected #280

AliMickey opened this issue Jul 25, 2024 · 7 comments
Assignees
Labels
possible-bug Something isn't working

Comments

@AliMickey
Copy link

AliMickey commented Jul 25, 2024

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
@AliMickey AliMickey added the possible-bug Something isn't working label Jul 25, 2024
@arhippa11
Copy link

I am also receiving the same error.

@gondimcodes
Copy link

Me too.

@enkrispi
Copy link

enkrispi commented Aug 21, 2024

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: ""

@gondimcodes
Copy link

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.

@LucaTheHacker
Copy link

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

@Jimmy01240397
Copy link

Jimmy01240397 commented Oct 31, 2024

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

@LucaTheHacker
Copy link

We need to wait for @thatmattlove

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

No branches or pull requests

7 participants