You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
juniper verify crashes with AttributeError when host's current cloud has no active assignment #751
Define hosts in the spare pool (e.g. cloud01), add interfaces (em1/em2) with switch_ip/switch_port on a Juniper switch.
Create an assignment/schedule for another cloud (e.g. cloud02).
Before the first move completes (host still in cloud01), run: quads --verify-switch-conf --host <hostname> --change
What happens
juniper.verify() resolves the host's current cloud and calls get_active_cloud_assignment("cloud01"), which returns None (no active assignment on the spare pool). For a fresh switch port (no VLAN membership yet), parsing show configuration vlans | display set | match <port>.0 raises IndexError, and the except block reaches the unguarded if not _assignment.vlan: (src/quads/plugins/builtin/switches/juniper.py, ~line 267):
AttributeError: 'NoneType' object has no attribute 'vlan'
The CLI exits with an error for every host, so on a new installation the very first --verify-switch-conf validation fails.
Expected behavior
Never crash. When there is no active assignment for the host's current cloud, warn/skip ("no active assignment for cloud X, cannot verify") and return False, or proceed with derived VLAN values and warnings.
Suggested fix
Guard the None assignment:
- if not _assignment.vlan:+ if _assignment and not _assignment.vlan:
Notes
Scope: manual CLI path (--host, or --cloud of a cloud without an active assignment).
The automated --validate-env path is not affected: by then the host is in the target cloud and an active assignment exists.
Confirmed on development. src/quads/plugins/builtin/switches/juniper.py:267 in the else branch still evaluates _assignment.vlan unguarded, so when get_active_cloud_assignment() returns None you get exactly 'NoneType' object has no attribute 'vlan'. The _assignment and _assignment.vlan guard is already on the if-branch at line 258 but not this one; your if _assignment and not _assignment.vlan fix is right.
This is the same crash as #740 (same line, same fix path). Worth consolidating one of the two. I'll circle back.
Activity
ttlogan commentedon Oct 18, 2026
Confirmed on development.
src/quads/plugins/builtin/switches/juniper.py:267in the else branch still evaluates_assignment.vlanunguarded, so whenget_active_cloud_assignment()returns None you get exactly'NoneType' object has no attribute 'vlan'. The_assignment and _assignment.vlanguard is already on the if-branch at line 258 but not this one; yourif _assignment and not _assignment.vlanfix is right.This is the same crash as #740 (same line, same fix path). Worth consolidating one of the two. I'll circle back.
fix: guard None assignment in juniper verify
fix: guard None assignment in juniper verify