Skip to content

Commit 952c432

Browse files
committed
chore: black linting errors
Signed-off-by: Chris Butler <chris.butler@redhat.com>
1 parent f46a708 commit 952c432

1 file changed

Lines changed: 28 additions & 22 deletions

File tree

rhdp/rhdp-cluster-define.py

Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os
66
import pathlib
77
import shutil
8-
from typing import List, Dict, Optional
8+
from typing import Dict, List, Optional
99

1010
import typer
1111
from jinja2 import Environment, FileSystemLoader, select_autoescape
@@ -15,13 +15,16 @@
1515

1616
def get_default_cluster_configs() -> List[Dict]:
1717
"""Get default cluster configurations"""
18-
return [{
19-
"name": "coco",
20-
"directory": "openshift-install",
21-
"cluster_network_cidr": "10.128.0.0/14",
22-
"machine_network_cidr": "10.0.0.0/16",
23-
"service_network_cidr": "172.30.0.0/16"
24-
}]
18+
return [
19+
{
20+
"name": "coco",
21+
"directory": "openshift-install",
22+
"cluster_network_cidr": "10.128.0.0/14",
23+
"machine_network_cidr": "10.0.0.0/16",
24+
"service_network_cidr": "172.30.0.0/16",
25+
}
26+
]
27+
2528

2629
def get_multicluster_configs() -> List[Dict]:
2730
"""Get multicluster configurations for hub and spoke"""
@@ -31,28 +34,29 @@ def get_multicluster_configs() -> List[Dict]:
3134
"directory": "openshift-install-hub",
3235
"cluster_network_cidr": "10.128.0.0/14",
3336
"machine_network_cidr": "10.0.0.0/16",
34-
"service_network_cidr": "172.30.0.0/16"
37+
"service_network_cidr": "172.30.0.0/16",
3538
},
3639
{
37-
"name": "coco-spoke",
40+
"name": "coco-spoke",
3841
"directory": "openshift-install-spoke",
3942
"cluster_network_cidr": "10.132.0.0/14",
4043
"machine_network_cidr": "10.4.0.0/16",
41-
"service_network_cidr": "172.34.0.0/16"
42-
}
44+
"service_network_cidr": "172.34.0.0/16",
45+
},
4346
]
4447

48+
4549
def cleanup(pattern_dir: pathlib.Path, cluster_configs: List[Dict]) -> None:
4650
"""Cleanup directories for all clusters"""
47-
51+
4852
azure_dir = pathlib.Path.home() / ".azure"
49-
53+
5054
for config in cluster_configs:
5155
install_dir = pattern_dir / config["directory"]
5256
if install_dir.exists() and install_dir.is_dir():
5357
shutil.rmtree(install_dir)
5458
install_dir.mkdir()
55-
59+
5660
if azure_dir.exists() and azure_dir.is_dir():
5761
shutil.rmtree(azure_dir)
5862

@@ -77,7 +81,7 @@ def setup_install(
7781
except KeyError as e:
7882
rprint("Unable to get azure environment details")
7983
raise e
80-
84+
8185
# Read ssh_public_key and pull_secret
8286
ssh_key = ssh_key_path.expanduser().read_text()
8387
pull_secret = pull_secret_path.expanduser().read_text()
@@ -86,7 +90,7 @@ def setup_install(
8690
loader=FileSystemLoader(searchpath=rhdp_dir), autoescape=select_autoescape()
8791
)
8892
config_template = jinja_env.get_template("install-config.yaml.j2")
89-
93+
9094
# Create install config for each cluster
9195
for config in cluster_configs:
9296
rprint(f"Creating install config for cluster: {config['name']}")
@@ -98,7 +102,7 @@ def setup_install(
98102
region=region,
99103
cluster_name=config["name"],
100104
cluster_network_cidr=config["cluster_network_cidr"],
101-
machine_network_cidr=config["machine_network_cidr"],
105+
machine_network_cidr=config["machine_network_cidr"],
102106
service_network_cidr=config["service_network_cidr"],
103107
)
104108
install_config = pattern_dir / config["directory"] / "install-config.yaml"
@@ -128,24 +132,26 @@ def print():
128132

129133
def run(
130134
region: Annotated[str, typer.Argument(help="Azure region code")],
131-
multicluster: Annotated[bool, typer.Option("--multicluster", help="Deploy hub and spoke clusters")] = False,
135+
multicluster: Annotated[
136+
bool, typer.Option("--multicluster", help="Deploy hub and spoke clusters")
137+
] = False,
132138
):
133139
"""
134140
Region flag requires an azure region key which can be (authoritatively)
135141
requested with: "az account list-locations -o table".
136-
142+
137143
Use --multicluster flag to deploy both hub (coco-hub) and spoke (coco-spoke) clusters.
138144
"""
139145
validate_dir()
140-
146+
141147
# Choose cluster configurations based on multicluster flag
142148
if multicluster:
143149
cluster_configs = get_multicluster_configs()
144150
rprint("Setting up multicluster deployment (hub and spoke)")
145151
else:
146152
cluster_configs = get_default_cluster_configs()
147153
rprint("Setting up single cluster deployment")
148-
154+
149155
cleanup(pathlib.Path.cwd(), cluster_configs)
150156
setup_install(
151157
pathlib.Path.cwd(),

0 commit comments

Comments
 (0)