tenantgenerator/tenant/commands/resize.py

37 lines
1.2 KiB
Python

# tenant/commands/resize.py
from tenant.utils.common import get_secure_password
import os
from tenant.utils.template_values import template_values
def add_subparser(subparsers):
resize_parser = subparsers.add_parser(
"resize", help="Resize resources for a tenant"
)
resize_parser.add_argument("tenant_name", help="Name of the tenant")
resize_parser.add_argument("--new-size", help="New size for resources")
resize_parser.add_argument(
"--target", default=".", help="Target directory (default: current directory)"
)
def execute(args):
target_directory = args.target
tenant_name = args.tenant_name
values_file = os.path.join(helm_directory, tenant_name + ".values.yaml")
new_size = args.new_size
tenant_directory = os.path.join(target_directory, tenant_name)
helm_directory = os.path.join(tenant_directory, "03-helm")
values_file = os.path.join(helm_directory, tenant_name + ".values.yaml")
template_values(tenant_name, new_size, "laas", values_file)
# Use the shared function
# shared_function()
# Your logic for resizing resources
# ...
print(f"Resizing resources for tenant '{tenant_name}' to size {new_size}.")