Skip to content

Commit

Permalink
Additional renamings as aligned with TK.
Browse files Browse the repository at this point in the history
  • Loading branch information
ckunki committed Oct 19, 2023
1 parent fc58905 commit 3640cfa
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 29 deletions.
2 changes: 1 addition & 1 deletion doc/developer_guide/developer_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ The bucket has private access. In order to control access, the Bucket cloudforma
The following diagram shows the involved cloudformation stacks:
![image info](./img/cloudformation-stacks.drawio.png)

"DATA-SCIENCE-SANDBOX-VM-SLC-Bucket", "DATA-SCIENCE-SANDBOX-CI-TEST-CODEBUILD" & "DATA-SCIENCE-SANDBOX-RELEASE-CODEBUILD" are permanent and need to be deployed using the "deploy" commands (see [commands](#deployment-commands)).
"DATA-SCIENCE-SANDBOX-VM-Bucket", "DATA-SCIENCE-SANDBOX-CI-TEST-CODEBUILD" & "DATA-SCIENCE-SANDBOX-RELEASE-CODEBUILD" are permanent and need to be deployed using the "deploy" commands (see [commands](#deployment-commands)).
The EC2-stack lives only during the creation of a new sandbox image.

## Tagging
Expand Down
2 changes: 1 addition & 1 deletion exasol/ds/sandbox/cli/commands/setup_vm_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from exasol.ds.sandbox.lib.aws_access.aws_access import AwsAccess
from exasol.ds.sandbox.lib.config import default_config_object
from exasol.ds.sandbox.lib.logging import set_log_level
from exasol.ds.sandbox.lib.vm_bucket.vm_slc_bucket import run_setup_vm_bucket
from exasol.ds.sandbox.lib.vm_bucket.vm_dss_bucket import run_setup_vm_bucket


@cli.command()
Expand Down
2 changes: 1 addition & 1 deletion exasol/ds/sandbox/cli/commands/setup_vm_bucket_waf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from exasol.ds.sandbox.lib.aws_access.aws_access import AwsAccess
from exasol.ds.sandbox.lib.config import default_config_object
from exasol.ds.sandbox.lib.logging import set_log_level
from exasol.ds.sandbox.lib.vm_bucket.vm_slc_bucket_waf import run_setup_vm_bucket_waf
from exasol.ds.sandbox.lib.vm_bucket.vm_dss_bucket_waf import run_setup_vm_bucket_waf


@cli.command()
Expand Down
2 changes: 1 addition & 1 deletion exasol/ds/sandbox/lib/asset_printing/print_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

from exasol.ds.sandbox.lib.aws_access.cloudformation_stack import CloudformationStack
from exasol.ds.sandbox.lib.tags import DEFAULT_TAG_KEY
from exasol.ds.sandbox.lib.vm_bucket.vm_slc_bucket import find_vm_bucket, find_url_for_bucket
from exasol.ds.sandbox.lib.vm_bucket.vm_dss_bucket import find_vm_bucket, find_url_for_bucket


class AssetTypes(Enum):
Expand Down
6 changes: 4 additions & 2 deletions exasol/ds/sandbox/lib/aws_access/deployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@
"ChangeSetResult", ["changeset_id", "changeset_type"])


DEFAULT_CHANGE_SET_PREFIX="dss-ci-setup-deploy-"


class Deployer(object):

def __init__(self, cloudformation_client,
changeset_prefix="slc-ci-setup-deploy-"):
def __init__(self, cloudformation_client, changeset_prefix=DEFAULT_CHANGE_SET_PREFIX):
self._client = cloudformation_client
self.changeset_prefix = changeset_prefix

Expand Down
2 changes: 1 addition & 1 deletion exasol/ds/sandbox/lib/export_vm/run_export_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from exasol.ds.sandbox.lib.setup_ec2.cf_stack import find_ec2_instance_in_cf_stack
from exasol.ds.sandbox.lib.asset_printing.print_assets import print_assets
from exasol.ds.sandbox.lib.export_vm.vm_disk_image_format import VmDiskImageFormat
from exasol.ds.sandbox.lib.vm_bucket.vm_slc_bucket import find_vm_bucket, find_vm_import_role
from exasol.ds.sandbox.lib.vm_bucket.vm_dss_bucket import find_vm_bucket, find_vm_import_role

LOG = get_status_logger(LogType.EXPORT)

Expand Down
3 changes: 2 additions & 1 deletion exasol/ds/sandbox/lib/run_create_vm.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ def run_create_vm(aws_access: AwsAccess, ec2_key_file: Optional[str], ec2_key_na
ansible_repositories: Tuple[AnsibleRepository, ...] = default_repositories) -> None:
"""
Runs setup of an EC2 instance and then installs all dependencies via Ansible,
and finally exports the VM to the S3 Bucket (which must be already created by the stack ("VM-SLC-Bucket").
and finally exports the VM to the S3 Bucket (which must be already created
by the stack "DATA-SCIENCE-SANDBOX-VM-Bucket").
If anything goes wrong the cloudformation stack of the EC-2 instance will be removed.
For debuging you can use the available debug commands.
"""
Expand Down
2 changes: 1 addition & 1 deletion exasol/ds/sandbox/lib/setup_ci_codebuild/ci_codebuild.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from exasol.ds.sandbox.lib.aws_access.aws_access import AwsAccess
from exasol.ds.sandbox.lib.logging import get_status_logger, LogType
from exasol.ds.sandbox.lib.render_template import render_template
from exasol.ds.sandbox.lib.vm_bucket.vm_slc_bucket import find_vm_bucket
from exasol.ds.sandbox.lib.vm_bucket.vm_dss_bucket import find_vm_bucket

STACK_NAME = "DATA-SCIENCE-SANDBOX-CI-TEST-CODEBUILD"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from exasol.ds.sandbox.lib.aws_access.aws_access import AwsAccess
from exasol.ds.sandbox.lib.logging import get_status_logger, LogType
from exasol.ds.sandbox.lib.render_template import render_template
from exasol.ds.sandbox.lib.vm_bucket.vm_slc_bucket import find_vm_bucket
from exasol.ds.sandbox.lib.vm_bucket.vm_dss_bucket import find_vm_bucket

RELEASE_CODE_BUILD_STACK_NAME = "DATA-SCIENCE-SANDBOX-RELEASE-CODEBUILD"

Expand Down
2 changes: 1 addition & 1 deletion exasol/ds/sandbox/lib/tags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
DEFAULT_TAG_KEY = "exa_slc_id"
DEFAULT_TAG_KEY = "exa_dss_id"


def create_default_asset_tag(value: str) -> list:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from exasol.ds.sandbox.lib.render_template import render_template
from enum import Enum

from exasol.ds.sandbox.lib.vm_bucket.vm_slc_bucket_waf import find_acl_arn
from exasol.ds.sandbox.lib.vm_bucket.vm_dss_bucket_waf import find_acl_arn

STACK_NAME = "DATA-SCIENCE-SANDBOX-VM-SLC-Bucket"
STACK_NAME = "DATA-SCIENCE-SANDBOX-VM-Bucket"


class OutputKey(Enum):
Expand Down
24 changes: 12 additions & 12 deletions test/aws_mock_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
from exasol.ds.sandbox.lib.aws_access.stack_resource import StackResource
from test.conftest import DEFAULT_ASSET_ID

TEST_ROLE_ID = 'VM-SLC-Bucket-VMImportRole-TEST'
TEST_BUCKET_ID = 'vm-slc-bucket-vmslcbucket-TEST'
TEST_ROLE_ID = 'VM-DSS-Bucket-VMImportRole-TEST'
TEST_BUCKET_ID = 'vm-dss-bucket-vmdssbucket-TEST'
TEST_AMI_ID = "AMI-IMAGE-12345"
TEST_CLOUDFRONT_ID = "test-cloudfrontet-TEST"
TEST_CLOUDFRONT_DOMAIN_NAME = "test-s3.cloudfront.net"
Expand Down Expand Up @@ -43,7 +43,7 @@ def get_ami_image_mock_data(state: str) -> Ami:
'Name': DEFAULT_ASSET_ID.ami_name,
'RootDeviceName': '/dev/sda1',
'RootDeviceType': 'ebs', 'SriovNetSupport': 'simple',
'Tags': [{'Key': 'exa_slc_id', 'Value': DEFAULT_ASSET_ID.tag_value}],
'Tags': [{'Key': 'exa_dss_id', 'Value': DEFAULT_ASSET_ID.tag_value}],
'VirtualizationType': 'hvm'})


Expand All @@ -53,7 +53,7 @@ def get_snapshot_mock_data():
'OwnerId': '123', 'Progress': '100%', 'SnapshotId': 'snap-123',
'StartTime': datetime.datetime(2022, 8, 16, 15, 3, 40, 662000, tzinfo=tzutc()), 'State': 'completed',
'VolumeId': 'vol-123', 'VolumeSize': 100,
'Tags': [{'Key': 'exa_slc_id', 'Value': DEFAULT_ASSET_ID.tag_value}],
'Tags': [{'Key': 'exa_dss_id', 'Value': DEFAULT_ASSET_ID.tag_value}],
'StorageTier': 'standard'
})

Expand All @@ -71,7 +71,7 @@ def get_export_image_task_mock_data(in_progress: bool):
'Progress': "50%",
"StatusMessage": "creating the image",
'Status': 'active',
'Tags': [{'Key': 'exa_slc_id', 'Value': DEFAULT_ASSET_ID.tag_value}]
'Tags': [{'Key': 'exa_dss_id', 'Value': DEFAULT_ASSET_ID.tag_value}]
})
else:
return ExportImageTask({
Expand All @@ -83,7 +83,7 @@ def get_export_image_task_mock_data(in_progress: bool):
'S3Prefix': DEFAULT_ASSET_ID.bucket_prefix
},
'Status': 'completed',
'Tags': [{'Key': 'exa_slc_id', 'Value': DEFAULT_ASSET_ID.tag_value}]
'Tags': [{'Key': 'exa_dss_id', 'Value': DEFAULT_ASSET_ID.tag_value}]
})


Expand All @@ -107,7 +107,7 @@ def get_ec2_cloudformation_mock_data():
'RollbackConfiguration': {},
'StackStatus': 'CREATE_COMPLETE',
'DisableRollback': False, 'NotificationARNs': [], 'Capabilities': ['CAPABILITY_IAM'],
'Tags': [{'Key': 'exa_slc_id', 'Value': DEFAULT_ASSET_ID.tag_value}],
'Tags': [{'Key': 'exa_dss_id', 'Value': DEFAULT_ASSET_ID.tag_value}],
'DriftInformation': {'StackDriftStatus': 'NOT_CHECKED'}
})

Expand Down Expand Up @@ -137,7 +137,7 @@ def get_ec2_key_pair_mock_data():
'KeyFingerprint': '12:34:56:78:90:12:34:56:78:90:12:34:56:78:90:12:34:56:78:90',
'KeyName': 'ec2-key-test-key',
'KeyType': 'rsa',
'Tags': [{'Key': 'exa_slc_id', 'Value': DEFAULT_ASSET_ID.tag_value}],
'Tags': [{'Key': 'exa_dss_id', 'Value': DEFAULT_ASSET_ID.tag_value}],
'CreateTime': datetime.datetime(2022, 8, 16, 15, 30, 41,
tzinfo=tzutc())
})
Expand All @@ -146,14 +146,14 @@ def get_ec2_key_pair_mock_data():
def get_s3_cloudformation_mock_data() -> List[CloudformationStack]:
return [CloudformationStack({
'StackId': 'test-s3-stack-id',
'StackName': "DATA-SCIENCE-SANDBOX-VM-SLC-Bucket",
'StackName': "DATA-SCIENCE-SANDBOX-VM-Bucket",
'ChangeSetId': 'test-stack-changeset-id-2',
'CreationTime': datetime.datetime(2022, 8, 16, 14, 30, 45, 559000, tzinfo=tzutc()),
'LastUpdatedTime': datetime.datetime(2022, 8, 16, 14, 30, 51, 667000, tzinfo=tzutc()),
'RollbackConfiguration': {},
'StackStatus': 'CREATE_COMPLETE',
'DisableRollback': False, 'NotificationARNs': [], 'Capabilities': ['CAPABILITY_IAM'],
'Tags': [{'Key': 'exa_slc_id', 'Value': DEFAULT_ASSET_ID.tag_value}],
'Tags': [{'Key': 'exa_dss_id', 'Value': DEFAULT_ASSET_ID.tag_value}],
'DriftInformation': {'StackDriftStatus': 'NOT_CHECKED'},
'Outputs': [{'OutputKey': 'VMBucketId',
'OutputValue': TEST_BUCKET_ID, 'Description': ''},
Expand All @@ -171,14 +171,14 @@ def get_s3_cloudformation_mock_data() -> List[CloudformationStack]:
def get_waf_cloudformation_mock_data() -> List[CloudformationStack]:
return [CloudformationStack({
'StackId': 'test-waf-stack-id',
'StackName': "DATA-SCIENCE-SANDBOX-VM-SLC-Bucket-WAF",
'StackName': "DATA-SCIENCE-SANDBOX-VM-Bucket-WAF",
'ChangeSetId': 'test-stack-changeset-id-3',
'CreationTime': datetime.datetime(2022, 8, 16, 14, 30, 45, 559000, tzinfo=tzutc()),
'LastUpdatedTime': datetime.datetime(2022, 8, 16, 14, 30, 51, 667000, tzinfo=tzutc()),
'RollbackConfiguration': {},
'StackStatus': 'CREATE_COMPLETE',
'DisableRollback': False, 'NotificationARNs': [], 'Capabilities': [],
'Tags': [{'Key': 'exa_slc_id', 'Value': DEFAULT_ASSET_ID.tag_value}],
'Tags': [{'Key': 'exa_dss_id', 'Value': DEFAULT_ASSET_ID.tag_value}],
'DriftInformation': {'StackDriftStatus': 'NOT_CHECKED'},
'Outputs': [{'OutputKey': 'VMDownloadACLArn',
'OutputValue': TEST_ACL_ARN, 'Description': ''}
Expand Down
2 changes: 1 addition & 1 deletion test/cloudformation_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def validate_using_cfn_lint(tmp_path, cloudformation_yml):
This test uses cfn-lint to validate the Cloudformation template.
(See https://github.com/aws-cloudformation/cfn-lint)
"""
out_file = tmp_path / "slc_source_credential.yaml"
out_file = tmp_path / "cloudformation.yaml"
with open(out_file, "w") as f:
f.write(cloudformation_yml)

Expand Down
4 changes: 2 additions & 2 deletions test/test_deploy_vm_bucket.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
import pytest

from exasol.ds.sandbox.lib.aws_access.aws_access import AwsAccess
from exasol.ds.sandbox.lib.vm_bucket.vm_slc_bucket import run_setup_vm_bucket, find_vm_bucket, \
from exasol.ds.sandbox.lib.vm_bucket.vm_dss_bucket import run_setup_vm_bucket, find_vm_bucket, \
create_vm_bucket_cf_template
from test.aws_mock_data import TEST_BUCKET_ID, get_waf_cloudformation_mock_data, TEST_ACL_ARN, \
get_s3_cloudformation_mock_data
from test.cloudformation_validation import validate_using_cfn_lint
from test.mock_cast import mock_cast
from exasol.ds.sandbox.lib.vm_bucket.vm_slc_bucket import STACK_NAME as VM_STACK_NAME
from exasol.ds.sandbox.lib.vm_bucket.vm_dss_bucket import STACK_NAME as VM_STACK_NAME


@pytest.fixture
Expand Down
2 changes: 1 addition & 1 deletion test/test_deploy_vm_bucket_waf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytest

from exasol.ds.sandbox.lib.aws_access.aws_access import AwsAccess
from exasol.ds.sandbox.lib.vm_bucket.vm_slc_bucket_waf import run_setup_vm_bucket_waf, \
from exasol.ds.sandbox.lib.vm_bucket.vm_dss_bucket_waf import run_setup_vm_bucket_waf, \
find_acl_arn, get_cloudformation_template
from test.aws_mock_data import get_waf_cloudformation_mock_data, TEST_ACL_ARN
from test.cloudformation_validation import validate_using_cfn_lint
Expand Down

0 comments on commit 3640cfa

Please sign in to comment.