Skip to content

Commit

Permalink
update lib
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros-k committed Jul 18, 2024
1 parent ea78cb9 commit aff5b5b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion ix-dev/community/clamav/app.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ keywords:
- anti-virus
- clamav
lib_version: 1.0.0
lib_version_hash: f65f60c3443d486c7750733f45b23233d9e40ba4f27cdee59af07d59817ceeb3
lib_version_hash: f96fef83d5ec9d220fb8215e56da7125ff4a27a8ee7e08a44cf09e89f7fc9e49
maintainers:
- email: [email protected]
name: truenas
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@


def resources(data):
cpus = str(data.get("limits", {}).get("cpus", "2.0"))
memory = str(data.get("limits", {}).get("memory", "4gb"))
cpus = str(data.get("limits", {}).get("cpus", 2.0))
memory = str(data.get("limits", {}).get("memory", 4096))
if not re.match(r"^[1-9][0-9]*(\.[0-9]+)?$", cpus):
utils.throw_error(f"Expected cpus to be a number or a float, got [{cpus}]")
if not re.match(r"^[1-9][0-9]*(([GMK]B?)|([gmk]b?))$", memory):
raise ValueError(f"Expected memory to be a number with unit, got [{memory}]")
if not re.match(r"^[1-9][0-9]*$", memory):
raise ValueError(f"Expected memory to be a number, got [{memory}]")

return {
"limits": {
"cpus": cpus,
"memory": memory,
},
"limits": {"cpus": cpus, "memory": f"{memory}M"},
}

0 comments on commit aff5b5b

Please sign in to comment.