Skip to content

Commit

Permalink
Merge "fix: clearing vlan via cli" into latest
Browse files Browse the repository at this point in the history
  • Loading branch information
sadsfae authored and gerritforge-ltd committed Oct 22, 2024
2 parents 64a3bea + 3861f54 commit 40a465d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 1 addition & 2 deletions src/quads/cli/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,8 +976,7 @@ def action_modcloud(self):
try:
clean_data["vlan"] = int(self.cli_args.get("vlan"))
except (TypeError, ValueError) as ཀʖ̯ཀ: # pragma: no cover
self.logger.debug(ཀʖ̯ཀ, exc_info=ཀʖ̯ཀ)
raise CliException("Could not parse vlan id. Only integers accepted.")
clean_data["vlan"] = None

if "wipe" in self.cli_args:
clean_data["wipe"] = self.cli_args.get("wipe")
Expand Down
5 changes: 4 additions & 1 deletion src/quads/server/blueprints/assignments.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ def update_assignment(assignment_id: str) -> Response:
update_fields = {}
for attr in obj_attrs:
value = data.get(attr.key)
if value is not None:
if value is not None or attr.key == "vlan":
if attr.key == "ccuser":
value = re.split(r"[, ]+", value)
value = [user.strip() for user in value]
Expand All @@ -238,6 +238,9 @@ def update_assignment(assignment_id: str) -> Response:
return make_response(jsonify(response), 400)
value = _cloud
if attr.key == "vlan":
if value is None:
update_fields[attr.key] = value
continue
_vlan = VlanDao.get_vlan(value)
if not _vlan:
response = {
Expand Down

0 comments on commit 40a465d

Please sign in to comment.