Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbonney committed Jan 3, 2024
1 parent 49ce0b8 commit 3f2af40
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
4 changes: 2 additions & 2 deletions magnum_cluster_api/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -1758,7 +1758,7 @@ def get_object(self) -> objects.ClusterClass:
"path": "/spec/template/spec/kubeadmConfigSpec/preKubeadmCommands",
"value": [
"systemctl daemon-reload",
"systemctl restart containerd"
"systemctl restart containerd",
],
},
],
Expand Down Expand Up @@ -1839,7 +1839,7 @@ def get_object(self) -> objects.ClusterClass:
"path": "/spec/template/spec/preKubeadmCommands",
"value": [
"systemctl daemon-reload",
"systemctl restart containerd"
"systemctl restart containerd",
],
},
],
Expand Down
21 changes: 17 additions & 4 deletions magnum_cluster_api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,10 @@ def generate_containerd_config(


def generate_systemd_proxy_config(cluster: magnum_objects.Cluster):
if cluster.cluster_template.http_proxy != "" or cluster.cluster_template.https_proxy != "":
if (
cluster.cluster_template.http_proxy != ""
or cluster.cluster_template.https_proxy != ""
):
return textwrap.dedent(
"""\
[Service]
Expand All @@ -211,19 +214,29 @@ def generate_systemd_proxy_config(cluster: magnum_objects.Cluster):
Environment="no_proxy={no_proxy}"
Environment="NO_PROXY={no_proxy}"
"""
).format(http_proxy=cluster.cluster_template.http_proxy, https_proxy=cluster.cluster_template.https_proxy, no_proxy=cluster.cluster_template.no_proxy)
).format(
http_proxy=cluster.cluster_template.http_proxy,
https_proxy=cluster.cluster_template.https_proxy,
no_proxy=cluster.cluster_template.no_proxy
)
else:
return ""


def generate_apt_proxy_config(cluster: magnum_objects.Cluster):
if cluster.cluster_template.http_proxy != "" or cluster.cluster_template.https_proxy != "":
if (
cluster.cluster_template.http_proxy != ""
or cluster.cluster_template.https_proxy != ""
):
return textwrap.dedent(
"""\
Acquire::http::Proxy "{http_proxy}";
Acquire::https::Proxy "{https_proxy}";
"""
).format(http_proxy=cluster.cluster_template.http_proxy, https_proxy=cluster.cluster_template.https_proxy)
).format(
http_proxy=cluster.cluster_template.http_proxy,
https_proxy=cluster.cluster_template.https_proxy
)
else:
return ""

Expand Down

0 comments on commit 3f2af40

Please sign in to comment.