-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nextcloud: fix ixvolume storage with deprecated layout (#1434)
* nextcloud: fix ixvolume storage with deprecated layout * empty space * bump * reset test file
- Loading branch information
Showing
127 changed files
with
357 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,8 +28,8 @@ keywords: | |
- http | ||
- web | ||
- php | ||
lib_version: 2.1.9 | ||
lib_version_hash: 6bd4d433db7dce2d4b8cc456a0f7874b45d52a6e2b145d5a1f48f327654a7125 | ||
lib_version: 2.1.13 | ||
lib_version_hash: 19a001bec1a3bede7f6f55a757b4088b81e31e92a48e8e89d23d064b059a65d0 | ||
maintainers: | ||
- email: [email protected] | ||
name: truenas | ||
|
@@ -66,4 +66,4 @@ sources: | |
- https://github.com/truenas/charts/tree/master/charts/nextcloud | ||
title: Nextcloud | ||
train: stable | ||
version: 1.5.14 | ||
version: 1.5.15 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from render import Render | ||
|
||
try: | ||
from .error import RenderError | ||
from .validations import valid_device_cgroup_rule_or_raise | ||
except ImportError: | ||
from error import RenderError | ||
from validations import valid_device_cgroup_rule_or_raise | ||
|
||
|
||
class DeviceCGroupRule: | ||
def __init__(self, rule: str): | ||
rule = valid_device_cgroup_rule_or_raise(rule) | ||
parts = rule.split(" ") | ||
major, minor = parts[1].split(":") | ||
|
||
self._type = parts[0] | ||
self._major = major | ||
self._minor = minor | ||
self._permissions = parts[2] | ||
|
||
def get_key(self): | ||
return f"{self._type}_{self._major}_{self._minor}" | ||
|
||
def render(self): | ||
return f"{self._type} {self._major}:{self._minor} {self._permissions}" | ||
|
||
|
||
class DeviceCGroupRules: | ||
def __init__(self, render_instance: "Render"): | ||
self._render_instance = render_instance | ||
self._rules: set[DeviceCGroupRule] = set() | ||
self._track_rule_combos: set[str] = set() | ||
|
||
def add_rule(self, rule: str): | ||
dev_group_rule = DeviceCGroupRule(rule) | ||
if dev_group_rule in self._rules: | ||
raise RenderError(f"Device Group Rule [{rule}] already added") | ||
|
||
rule_key = dev_group_rule.get_key() | ||
if rule_key in self._track_rule_combos: | ||
raise RenderError(f"Device Group Rule [{rule}] has already been added for this device group") | ||
|
||
self._rules.add(dev_group_rule) | ||
self._track_rule_combos.add(rule_key) | ||
|
||
def has_rules(self): | ||
return len(self._rules) > 0 | ||
|
||
def render(self): | ||
return sorted([rule.render() for rule in self._rules]) |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import ipaddress | ||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from render import Render | ||
|
||
try: | ||
from .error import RenderError | ||
except ImportError: | ||
from error import RenderError | ||
|
||
|
||
class ExtraHosts: | ||
def __init__(self, render_instance: "Render"): | ||
self._render_instance = render_instance | ||
self._extra_hosts: dict[str, str] = {} | ||
|
||
def add_host(self, host: str, ip: str): | ||
if not ip == "host-gateway": | ||
try: | ||
ipaddress.ip_address(ip) | ||
except ValueError: | ||
raise RenderError(f"Invalid IP address [{ip}] for host [{host}]") | ||
|
||
if host in self._extra_hosts: | ||
raise RenderError(f"Host [{host}] already added with [{self._extra_hosts[host]}]") | ||
self._extra_hosts[host] = ip | ||
|
||
def has_hosts(self): | ||
return len(self._extra_hosts) > 0 | ||
|
||
def render(self): | ||
return {host: ip for host, ip in self._extra_hosts.items()} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import pytest | ||
|
||
|
||
from render import Render | ||
|
||
|
||
@pytest.fixture | ||
def mock_values(): | ||
return { | ||
"images": { | ||
"test_image": { | ||
"repository": "nginx", | ||
"tag": "latest", | ||
} | ||
}, | ||
} | ||
|
||
|
||
def test_device_cgroup_rule(mock_values): | ||
render = Render(mock_values) | ||
c1 = render.add_container("test_container", "test_image") | ||
c1.healthcheck.disable() | ||
c1.add_device_cgroup_rule("c 13:* rwm") | ||
c1.add_device_cgroup_rule("b 10:20 rwm") | ||
output = render.render() | ||
assert output["services"]["test_container"]["device_cgroup_rules"] == [ | ||
"b 10:20 rwm", | ||
"c 13:* rwm", | ||
] | ||
|
||
|
||
def test_device_cgroup_rule_duplicate(mock_values): | ||
render = Render(mock_values) | ||
c1 = render.add_container("test_container", "test_image") | ||
c1.healthcheck.disable() | ||
c1.add_device_cgroup_rule("c 13:* rwm") | ||
with pytest.raises(Exception): | ||
c1.add_device_cgroup_rule("c 13:* rwm") | ||
|
||
|
||
def test_device_cgroup_rule_duplicate_group(mock_values): | ||
render = Render(mock_values) | ||
c1 = render.add_container("test_container", "test_image") | ||
c1.healthcheck.disable() | ||
c1.add_device_cgroup_rule("c 13:* rwm") | ||
with pytest.raises(Exception): | ||
c1.add_device_cgroup_rule("c 13:* rm") | ||
|
||
|
||
def test_device_cgroup_rule_invalid_device(mock_values): | ||
render = Render(mock_values) | ||
c1 = render.add_container("test_container", "test_image") | ||
c1.healthcheck.disable() | ||
with pytest.raises(Exception): | ||
c1.add_device_cgroup_rule("d 10:20 rwm") | ||
|
||
|
||
def test_device_cgroup_rule_invalid_perm(mock_values): | ||
render = Render(mock_values) | ||
c1 = render.add_container("test_container", "test_image") | ||
c1.healthcheck.disable() | ||
with pytest.raises(Exception): | ||
c1.add_device_cgroup_rule("a 10:20 rwd") | ||
|
||
|
||
def test_device_cgroup_rule_invalid_format(mock_values): | ||
render = Render(mock_values) | ||
c1 = render.add_container("test_container", "test_image") | ||
c1.healthcheck.disable() | ||
with pytest.raises(Exception): | ||
c1.add_device_cgroup_rule("a 10 20 rwd") | ||
|
||
|
||
def test_device_cgroup_rule_invalid_format_missing_major(mock_values): | ||
render = Render(mock_values) | ||
c1 = render.add_container("test_container", "test_image") | ||
c1.healthcheck.disable() | ||
with pytest.raises(Exception): | ||
c1.add_device_cgroup_rule("a 10 rwd") |
File renamed without changes.
File renamed without changes.
File renamed without changes.
Oops, something went wrong.