Skip to content

Commit 424137b

Browse files
committed
vmm-cli: require --kms-url when using --env-file
Add validation to ensure --kms-url is provided when --env-file is used, since environment variables need to be encrypted using the KMS public key. Affected commands: - deploy: requires --kms-url when --env-file is specified - update: requires --kms-url when --env-file is specified - update-env: requires --kms-url (always uses env file)
1 parent 139d588 commit 424137b

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

vmm/src/vmm-cli.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,10 @@ def create_vm(self, args) -> None:
565565

566566
envs = parse_env_file(args.env_file)
567567

568+
# Validate: --env-file requires --kms-url
569+
if envs and not args.kms_url:
570+
raise Exception("--env-file requires --kms-url to encrypt environment variables")
571+
568572
# Read user config file if provided
569573
user_config = ""
570574
if args.user_config:
@@ -620,6 +624,10 @@ def create_vm(self, args) -> None:
620624

621625
def update_vm_env(self, vm_id: str, envs: Dict[str, str], kms_urls: Optional[List[str]] = None) -> None:
622626
"""Update environment variables for a VM"""
627+
# Validate: requires --kms-url
628+
if not kms_urls:
629+
raise Exception("--kms-url is required to encrypt environment variables")
630+
623631
envs = envs or {}
624632
# First get the VM info to retrieve the app_id
625633
vm_info_response = self.rpc_call('GetInfo', {'id': vm_id})
@@ -709,6 +717,10 @@ def update_vm(
709717
no_tee: Optional[bool] = None,
710718
) -> None:
711719
"""Update multiple aspects of a VM in one command"""
720+
# Validate: --env-file requires --kms-url
721+
if env_file and not kms_urls:
722+
raise Exception("--env-file requires --kms-url to encrypt environment variables")
723+
712724
updates = []
713725

714726
# handle resize operations (vcpu, memory, disk, image)

0 commit comments

Comments
 (0)