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())
Esempio n. 3
0
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
Esempio n. 4
0
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)
Esempio n. 5
0
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
Esempio n. 6
0
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))
Esempio n. 7
0
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))
Esempio n. 8
0
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))
Esempio n. 9
0
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))
Esempio n. 10
0
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
Esempio n. 11
0
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
Esempio n. 12
0
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)
Esempio n. 13
0
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)
Esempio n. 14
0
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)
Esempio n. 15
0
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
Esempio n. 16
0
 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())