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 10, 2024
1 parent 58afd19 commit 0a229e8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 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: 45bebb95ba4848d8a8e79729bba7b0f24c77bf90fbf5baae5ebb4b1334500164
lib_version_hash: 9858e08ec7d40d21f5f69767787f50ae9737a4ad895fdc428ed94c2ea15947c2
maintainers:
- email: [email protected]
name: truenas
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,12 @@ def http_test(port, path, config={}):
host = config.get("host", "127.0.0.1")

return f"/bin/bash -c 'exec {{health_check_fd}}<>/dev/tcp/{host}/{port} && echo -e \"GET {path} HTTP/1.1\\r\\nHost: {host}\\r\\nConnection: close\\r\\n\\r\\n\" >&$${{health_check_fd}} && cat <&$${{health_check_fd}}'"


def tcp_test(port, config={}):
if not port:
utils.throw_error("Expected [port] to be set")

host = config.get("host", "127.0.0.1")

return f"nc -z -w 1 {host} {port}"
14 changes: 7 additions & 7 deletions ix-dev/community/clamav/templates/library/base_v1_0_0/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ def perms_item(data, ix_volumes, opts={}):
return {}

if data.get("type") == "host_path":
if data.get("host_path_config", {}).get("aclEnable", False):
if data.get("host_path_config", {}).get("acl_enable", False):
return {}
if data.get("type") == "ix_volume":
if data.get("ix_volume_config", {}).get("aclEnable", False):
if data.get("ix_volume_config", {}).get("acl_enable", False):
return {}

if not ix_volumes:
Expand Down Expand Up @@ -166,7 +166,7 @@ def host_path(data, ix_volumes=[]):
elif _is_ix_volume(data):
path = _process_ix_volume_config(data, ix_volumes)
else:
utils.throw_error(f"Expected [_host_path] to be called only for types [host_path, ix_volume], got [{data['type']}]")
utils.throw_error(f"Expected [host_path()] to be called only for types [host_path, ix_volume], got [{data['type']}]")

return valid_path(path)

Expand All @@ -188,7 +188,7 @@ def _get_docker_vol_type(data):


def _process_host_path_config(data):
if data.get("host_path_config", {}).get("aclEnable", False):
if data.get("host_path_config", {}).get("acl_enable", False):
if not data["host_path_config"].get("acl", {}).get("path"):
utils.throw_error("Expected [host_path_config.acl.path] to be set for [host_path] type with ACL enabled")
return data["host_path_config"]["acl"]["path"]
Expand All @@ -213,10 +213,10 @@ def _process_ix_volume_config(data, ix_volumes):

ds = data["ix_volume_config"]["dataset_name"]
for item in ix_volumes:
# TODO: verify the "hostPath" key is the correct from middleware side
# TODO: verify the "host_path" key is the correct from middleware side
# Ideally we would want to have the "dataset_name" in the dict, instead of doing this check below
if item.get("hostPath", "").split("/")[-1] == ds:
path = item["hostPath"]
if item.get("host_path", "").split("/")[-1] == ds:
path = item["host_path"]
break

if not path:
Expand Down

0 comments on commit 0a229e8

Please sign in to comment.