Skip to content

Commit

Permalink
[SCP] Fix the code for openapi changes (#3826)
Browse files Browse the repository at this point in the history
* fix the code for scp openapi change

fix the code for scp openapi change

* fix the code for scp openapi change

fix the code for scp openapi change
  • Loading branch information
hyoxt121 authored Aug 15, 2024
1 parent 6f89fa5 commit df2a9b4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions sky/clouds/utils/scp_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,7 @@ def _delete(self, url, request_body=None):
def create_security_group(self, zone_id, vpc, sg_name):
url = f'{API_ENDPOINT}/security-group/v3/security-groups'
request_body = {
'loggable': False,
'securityGroupName': sg_name,
'serviceZoneId': zone_id,
'vpcId': vpc,
Expand Down
12 changes: 10 additions & 2 deletions sky/skylet/providers/scp/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,21 @@ def get_vcp_subnets(self):

def _get_vm_init_script(self, ssh_public_key):

import subprocess
init_script_content = self._get_default_config_cmd(
) + self._get_ssh_key_gen_cmd(ssh_public_key)
init_script_content_string = f'"{init_script_content}"'
command = f'echo {init_script_content_string} | base64'
result = subprocess.run(command,
shell=True,
capture_output=True,
text=True)
init_script_content_base64 = result.stdout
return {
"encodingType": "plain",
"encodingType": "base64",
"initialScriptShell": "bash",
"initialScriptType": "text",
"initialScriptContent": init_script_content
"initialScriptContent": init_script_content_base64
}

def _get_ssh_key_gen_cmd(self, ssh_public_key):
Expand Down

0 comments on commit df2a9b4

Please # to comment.