def _cloud_init_comparator(self, config_dir): base_dir = join(TEST_ROOT, config_dir) cloud_config = CloudConfig(base_dir) cloud_init = CloudInit(base_dir=base_dir) actual_cloud_init = cloud_init.build(cloud_config.config_data('cluster')) expected_cloud_init = self._read_cloud_init(base_dir) self.assertEquals(actual_cloud_init.strip(), expected_cloud_init.strip())
def _cloud_init_comparator(self, config_dir): base_dir = join(TEST_ROOT, config_dir) cloud_config = CloudConfig(base_dir) cloud_init = CloudInit(base_dir=base_dir) actual_cloud_init = cloud_init.build( cloud_config.config_data('cluster')) expected_cloud_init = self._read_cloud_init(base_dir) self.assertEquals(actual_cloud_init.strip(), expected_cloud_init.strip())
def build(): """ builds the cloud_init script """ try: cloud_config = CloudConfig() config_data = cloud_config.config_data('cluster') cloud_init = CloudInit() print cloud_init.build(config_data) except CloudComposeException as ex: print ex.message
def build(): """ builds the cloud_init script """ try: cloud_config = CloudConfig() config_data = cloud_config.config_data('cluster') cloud_init = CloudInit() print(cloud_init.build(config_data)) except CloudComposeException as ex: print(ex)
def build(): """ builds the cloud_init script """ try: cloud_config = CloudConfig() config_data = cloud_config.config_data('image') cloud_init = CloudInit('image') print cloud_init.build(config_data) except CloudComposeException as ex: print ex.message
def health(verbose): """ check ECS cluster health """ try: cloud_config = CloudConfig() controller = Controller(cloud_config) name = cloud_config.config_data('cluster')['name'] healthy = controller.cluster_health(verbose) if healthy: print(("{} is healthy".format(name))) else: print(("{} is unhealthy".format(name))) except CloudComposeException as ex: print((ex.message))
def upgrade(single_step, upgrade_image): """ upgrade the ECS cluster """ try: cloud_config = CloudConfig() controller = Controller(cloud_config, upgrade_image=upgrade_image) controller.upgrade(single_step) except CloudComposeException as ex: print((ex.message))
def down(force): """ destroy ECS cluster """ try: cloud_config = CloudConfig() controller = Controller(cloud_config) controller.cluster_down(force) except CloudComposeException as ex: print((ex.message))
def up(upgrade_image): """ updates cluster configuration """ try: cloud_config = CloudConfig(upgrade_image=upgrade_image) controller = Controller(cloud_config) controller.cluster_up() except CloudComposeException as ex: print((ex.message))
def cleanup(): """ deletes launch configs and auto scaling group """ try: cloud_config = CloudConfig() cloud_controller = CloudController(cloud_config) cloud_controller.cleanup() except CloudComposeException as ex: print ex.message
def down(force): """ destroys an existing cluster """ try: cloud_config = CloudConfig() cloud_controller = CloudController(cloud_config) cloud_controller.down(force) except CloudComposeException as ex: print ex.message
def health(user, password): """ destroys an existing cluster """ try: cloud_config = CloudConfig() controller = Controller(cloud_config, user=user, password=password) _, msg_list = controller.cluster_health() print('%s' % '\n'.join(msg_list)) except CloudComposeException as ex: print(ex.message)
def up(use_snapshots, upgrade_image, snapshot_cluster, snapshot_time): """ upgrades an exist cluster """ try: cloud_config = CloudConfig() controller = Controller(cloud_config, use_snapshots=use_snapshots, upgrade_image=upgrade_image, snapshot_cluster=snapshot_cluster, snapshot_time=snapshot_time) controller.cluster_up() except CloudComposeException as ex: print(ex.message)
def upgrade(user, password, use_snapshots, upgrade_image, single_step): """ upgrades an exist cluster """ try: cloud_config = CloudConfig() controller = Controller(cloud_config, use_snapshots=use_snapshots, upgrade_image=upgrade_image, user=user, password=password) controller.cluster_upgrade(single_step) except CloudComposeException as ex: print(ex.message)
def up(cloud_init, use_snapshots, upgrade_image): """ creates a new cluster """ try: cloud_config = CloudConfig() ci = None if cloud_init: ci = CloudInit() cloud_controller = CloudController(cloud_config) cloud_controller.up(ci, use_snapshots, upgrade_image) except CloudComposeException as ex: print ex.message
def list_commands(self, ctx): cloud_config = CloudConfig() plugins = cloud_config.list_plugins() return plugins
def _cloud_controller(self, config_dir): base_dir = join(TEST_ROOT, config_dir) cloud_config = CloudConfig(base_dir) return CloudController(cloud_config, ec2_client=MockEC2Client(), asg_client=MockASGClient())