Skip to content

Commit d918ee5

Browse files
committed
feat: format
1 parent 31cd278 commit d918ee5

File tree

3 files changed

+44
-8
lines changed

3 files changed

+44
-8
lines changed

easyecs/command/__init__.py

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ def create_port_forwards(ecs_manifest, aws_region, aws_account, parsed_container
2929
container_name = container.name
3030
container_ports = container.port_forward
3131
if ecs_manifest.copy_method == "sftp":
32-
container_ports.append(f"{container.sftp_config.port}:{container.sftp_config.port}")
32+
container_ports.append(
33+
f"{container.sftp_config.port}:{container.sftp_config.port}"
34+
)
3335
for container_port in container_ports:
3436
from_port = container_port.split(":")[0]
3537
to_port = container_port.split(":")[1]
@@ -126,7 +128,14 @@ def run_sftp_sync_thread(ecs_manifest, aws_region, aws_account, parsed_container
126128
for volume in container.volumes:
127129
_from, _ = volume.split(":")
128130
event_handler = SynchronizeSFTPEventHandler(
129-
target, aws_region, aws_account, volume, container.volumes_excludes, port, username, password
131+
target,
132+
aws_region,
133+
aws_account,
134+
volume,
135+
container.volumes_excludes,
136+
port,
137+
username,
138+
password,
130139
)
131140
event_handlers.append(event_handler)
132141
observer.schedule(event_handler, _from, recursive=True)
@@ -319,7 +328,9 @@ def install_netcat_command(target, aws_region, aws_account) -> None:
319328
)
320329

321330

322-
def install_sshd_client(target, aws_region, aws_account, auto_install_override, port, user, password) -> None:
331+
def install_sshd_client(
332+
target, aws_region, aws_account, auto_install_override, port, user, password
333+
) -> None:
323334
DEBUG_EASYECS = os.environ.get("DEBUG_EASYECS", None)
324335
client = boto3.client("ssm")
325336
if len(auto_install_override) > 0:
@@ -447,9 +458,15 @@ def run_sftp_commands(
447458
else:
448459
if not has_sshd and auto_install_sftp:
449460
install_sshd_client(
450-
ssm_target, aws_region, aws_account, auto_install_override, container.sftp_config.port, container.sftp_config.user, container.sftp_config.password
461+
ssm_target,
462+
aws_region,
463+
aws_account,
464+
auto_install_override,
465+
container.sftp_config.port,
466+
container.sftp_config.user,
467+
container.sftp_config.password,
451468
)
452-
time.sleep(2) # Wait a bit for sshd to be ready
469+
time.sleep(2) # Wait a bit for sshd to be ready
453470
run_sshd_command(
454471
parsed_containers,
455472
aws_region,

easyecs/command/event/synchronize_event_handler.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,16 @@ def netcat(hostname, port, content, input, output):
5959

6060

6161
def sftp(
62-
target, aws_region, aws_account, hostname, port, username, password, input, output, volumes_excludes
62+
target,
63+
aws_region,
64+
aws_account,
65+
hostname,
66+
port,
67+
username,
68+
password,
69+
input,
70+
output,
71+
volumes_excludes,
6372
):
6473
from easyecs.command import generate_ssm_cmd
6574

@@ -161,7 +170,17 @@ def dispatch(self, event: FileSystemEvent):
161170

162171

163172
class SynchronizeSFTPEventHandler(FileSystemEventHandler):
164-
def __init__(self, target, aws_region, aws_account, volume, volumes_excludes, port, username, password):
173+
def __init__(
174+
self,
175+
target,
176+
aws_region,
177+
aws_account,
178+
volume,
179+
volumes_excludes,
180+
port,
181+
username,
182+
password,
183+
):
165184
super().__init__()
166185
self.target = target
167186
self.aws_region = aws_region

easyecs/model/ecs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ class EcsFileContainerModel(BaseModel):
123123
ports: Optional[List[str]] = []
124124
sftp_config: EcsSftpConfig = EcsSftpConfig()
125125

126-
127126
@field_validator("volumes")
128127
def validate_volumes(cls, volumes):
129128
resolved_volumes = []
@@ -226,6 +225,7 @@ def validate_subnets(self):
226225
)
227226
return self
228227

228+
229229
class EcsFileModel(BaseModel):
230230
metadata: EcsFileMetadataModel
231231
role: EcsFileRoleModel

0 commit comments

Comments
 (0)