Skip to content
This repository has been archived by the owner on Aug 9, 2024. It is now read-only.

Commit

Permalink
config: Move the config in a single configuration file
Browse files Browse the repository at this point in the history
Signed-off-by: Sayan Chowdhury <[email protected]>
  • Loading branch information
sayanchowdhury committed Dec 22, 2017
1 parent f39c64a commit db17bb5
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 49 deletions.
13 changes: 13 additions & 0 deletions fedimg/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,16 @@
ACTIVE_SERVICES = config['general']['active_services']
CLEAN_UP_ON_FAILURE = config['general']['clean_up_on_failure']
DELETE_IMAGES_ON_FAILURE = config['general']['delete_images_on_failure']

AWS_UTIL_USER = config.get('aws', {}).get('util_username', {})
AWS_TEST_USER = config.get('aws', {}).get('test_username', {})
AWS_ACCESS_ID = config.get('aws', {}).get('access_id')
AWS_SECRET_KEY = config.get('aws', {}).get('secret_key')
AWS_VOLUME_SIZE = config.get('aws', {}).get('volume_size')
AWS_VOLUME_TYPES = config.get('aws', {}).get('volume_types')
AWS_VOLUME_VIA_S3 = config.get('aws', {}).get('volume_via_s3')
AWS_IAM_PROFILE = config.get('aws', {}).get('iam_profile')
AWS_REGIONS = config.get('aws', {}).get('regions', {})
AWS_ROOT_VOLUME_SIZE = config.get('aws', {}).get('root_volume_size', {})
AWS_BASE_REGION = config.get('aws', {}).get('base_region', {})
AWS_DELETE_RESOURCES = config.get('aws', {}).get('delete_resources', True)
41 changes: 0 additions & 41 deletions fedimg/services/ec2/config.py

This file was deleted.

2 changes: 1 addition & 1 deletion fedimg/services/ec2/ec2copy.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"""
import logging

from fedimg.services.ec2.config import AWS_BASE_REGION
from fedimg.config import AWS_BASE_REGION
from fedimg.services.ec2.ec2imgpublisher import EC2ImagePublisher

LOG = logging.getLogger(__name__)
Expand Down
4 changes: 2 additions & 2 deletions fedimg/services/ec2/ec2imgpublisher.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def get_volume_type_from_image(self, image):
blk_mapping = image.extra['block_device_mapping']
if not blk_mapping:
blk_mapping = self._retry_till_blk_mapping_is_available(image)

return blk_mapping[0]['ebs']['volume_type']

def get_virt_type_from_image(self, image):
Expand All @@ -159,7 +159,7 @@ def get_virt_type_from_image(self, image):
blk_mapping = image.extra['block_device_mapping']
if not blk_mapping:
blk_mapping = self._retry_till_blk_mapping_is_available(image)

device_name = blk_mapping[0]['ebs']['volume_type']

if device_name.endswith('sda1'):
Expand Down
2 changes: 1 addition & 1 deletion fedimg/services/ec2/ec2imguploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import fedimg.messenger

from fedimg.utils import external_run_command, get_item_from_regex
from fedimg.services.ec2.config import AWS_DELETE_RESOURCES
from fedimg.config import AWS_DELETE_RESOURCES
from fedimg.services.ec2.ec2base import EC2Base


Expand Down
4 changes: 2 additions & 2 deletions fedimg/services/ec2/ec2initiate.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@

import fedimg.messenger

from fedimg.services.ec2.config import AWS_VOLUME_TYPES, AWS_BASE_REGION
from fedimg.services.ec2.config import AWS_ROOT_VOLUME_SIZE
from fedimg.config import AWS_VOLUME_TYPES, AWS_BASE_REGION
from fedimg.config import AWS_ROOT_VOLUME_SIZE
from fedimg.services.ec2.ec2imguploader import EC2ImageUploader
from fedimg.services.ec2.ec2imgpublisher import EC2ImagePublisher
from fedimg.utils import get_virt_types_from_url, get_source_from_image
Expand Down
5 changes: 3 additions & 2 deletions fedimg/uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@
from fedimg.config import ACTIVE_SERVICES
from fedimg.services.ec2.ec2initiate import main as ec2main
from fedimg.services.ec2.ec2copy import main as ec2copy
from fedimg.services.ec2.config import AWS_ACCESS_ID, AWS_SECRET_KEY
from fedimg.services.ec2.config import AWS_BASE_REGION, AWS_REGIONS
from fedimg.config import AWS_ACCESS_ID, AWS_SECRET_KEY
from fedimg.config import AWS_BASE_REGION, AWS_REGIONS


LOG = logging.getLogger(__name__)

Expand Down

0 comments on commit db17bb5

Please sign in to comment.