Skip to content

A device being assigned to a static group causes jobs to fail #1029

Description

@jeffkala

Environment

  • Python version: 3.11
  • Nautobot version: 2.4.20
  • nautobot-golden-config version: 1.0.0

Expected Behavior

Shouldn't affect Golden Config if a in scope device is assigned to a static group

Observed Behavior

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/celery/app/trace.py", line 453, in trace_task
    R = retval = fun(*args, **kwargs)
                 ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/celery/app/trace.py", line 736, in __protected_call__
    return self.run(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/jobs.py", line 1288, in run_job
    result = job(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/jobs.py", line 164, in __call__
    return self.run(*args, **deserialized_kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/source/nautobot_golden_config/jobs.py", line 170, in gc_repo_wrapper
    current_repos = gc_repo_prep(job=self, data=kwargs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/source/nautobot_golden_config/jobs.py", line 129, in gc_repo_prep
    current_repos = get_refreshed_repos(job_obj=job, repo_types=gitrepo_types, data=job.qs)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/source/nautobot_golden_config/jobs.py", line 74, in get_refreshed_repos
    if data.filter(group.generate_query()).exists():
                   ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/nautobot/extras/models/groups.py", line 804, in generate_query
    raise RuntimeError(f"generate_query not implemented for group_type {self.group_type}")
RuntimeError: generate_query not implemented for group_type static

Steps to Reproduce

  1. Create a second dynamic group type static
  2. Have a inscope device in it with higher dynamic group weight
  3. Run any GC job

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions