def tearDownClass(cls):
     eco_utils.execute_uninstall('k8s')
     try:
         del os.environ['KUBERNETES_MASTER_IP']
     except KeyError:
         pass
     eco_utils.execute_command('cfy profiles delete {0}'.format(
         os.environ['ECOSYSTEM_SESSION_MANAGER_IP']))
     super(KubernetesTestBase, cls).tearDownClass()
 def check_nodecellar(self):
     aws_nodes = [
         'security_group', 'haproxy_nic', 'nodejs_nic', 'mongo_nic',
         'nodecellar_ip'
     ]
     monitored_nodes = [
         'haproxy_frontend_host', 'nodejs_host', 'mongod_host'
     ]
     failed = utils.install_nodecellar(
         blueprint_file_name=self.blueprint_file_name)
     if failed:
         raise Exception('Nodecellar install failed.')
     del failed
     self.addCleanup(self.cleanup_deployment, 'nc')
     failed = utils.execute_scale('nc', scalable_entity_name='nodejs_group')
     if failed:
         raise Exception('Nodecellar scale failed.')
     del failed
     deployment_nodes = \
         utils.get_deployment_resources_by_node_type_substring(
             'nc', 'cloudify')
     self.check_resources_in_deployment_created(deployment_nodes, aws_nodes)
     self.check_resources_in_deployment_created(deployment_nodes,
                                                monitored_nodes)
     blueprint_dir = tempfile.mkdtemp()
     blueprint_zip = os.path.join(blueprint_dir, 'blueprint.zip')
     blueprint_archive = 'nodecellar-auto-scale-auto-heal-blueprint-master'
     download_path = \
         os.path.join(blueprint_dir, blueprint_archive, 'aws.yaml')
     blueprint_path = utils.create_blueprint(utils.NODECELLAR,
                                             blueprint_zip, blueprint_dir,
                                             download_path)
     skip_transform = [
         'aws', 'vpc', 'public_subnet', 'private_subnet',
         'ubuntu_trusty_ami'
     ]
     new_blueprint_path = utils.create_external_resource_blueprint(
         blueprint_path,
         aws_nodes,
         deployment_nodes,
         resource_id_attr='aws_resource_id',
         nodes_to_keep_without_transform=skip_transform)
     failed = utils.execute_command(
         'cfy install {0} -b nc-external'.format(new_blueprint_path))
     if failed:
         raise Exception('Nodecellar external install failed.')
     failed = utils.execute_uninstall('nc-external')
     if failed:
         raise Exception('Nodecellar external uninstall failed.')
     failed = utils.execute_uninstall('nc')
     if failed:
         raise Exception('Nodecellar uninstall failed.')
     del failed
     self.check_resources_in_deployment_deleted(deployment_nodes, aws_nodes)
     self.check_resources_in_deployment_deleted(deployment_nodes,
                                                monitored_nodes)
示例#3
0
 def install_file(self, blueprint_id):
     file_path = '/tmp/{0}'.format(blueprint_id)
     utils.execute_command(
         'cfy blueprints upload cloudify_files/'
         'examples/simple.yaml -b {0}'.format(blueprint_id))
     utils.create_deployment(blueprint_id, inputs={'file_path': file_path})
     utils.execute_install(blueprint_id)
     if utils.execute_command(
             'docker exec cfy_manager stat {0}'.format(file_path)):
         raise Exception('{0} not written.'.format(file_path))
     utils.execute_uninstall(blueprint_id)
     if not utils.execute_command(
             'docker exec cfy_manager stat {0}'.format(file_path)):
         raise Exception('{0} not deleted.'.format(file_path))
示例#4
0
 def install_cloud_init(self, blueprint_id):
     utils.execute_command(
         'cfy blueprints upload cloudify_cloudinit/'
         'examples/simple.yaml -b {0}'.format(blueprint_id))
     utils.create_deployment(blueprint_id)
     utils.execute_install(blueprint_id)
     rs = utils.get_deployment_resources_by_node_type_substring(
         blueprint_id, 'cloudify.nodes.CloudInit.CloudConfig')
     cloud_config = \
         rs[0]['instances'][0]['runtime_properties']['cloud_config']
     if '#cloud-config' not in cloud_config:
         raise Exception('{0} not in {1}'.format('#cloud-config',
                                                 cloud_config))
     utils.execute_uninstall(blueprint_id)
示例#5
0
 def install_rest(self, blueprint_id):
     utils.execute_command(
         'cfy blueprints upload cloudify_rest/'
         'examples/example-4-blueprint.yaml -b {0}'.format(blueprint_id))
     utils.create_deployment(blueprint_id,
                             inputs={'commit': os.environ['CIRCLE_SHA1']})
     utils.execute_install(blueprint_id)
     rs = utils.get_deployment_resources_by_node_type_substring(
         blueprint_id, 'cloudify.rest.Requests')
     rest_instance = rs[0]['instances'][0]['runtime_properties']
     if 'commit' not in rest_instance['result_propeties']:
         raise Exception('{0} not in {1}'.format(
             'commit', rest_instance['result_propeties']))
     utils.execute_uninstall(blueprint_id)
示例#6
0
 def install_blueprints(self):
     utils.initialize_cfy_profile(
         '{0} -u admin -p {1} -t default_tenant'.format(
             self.manager_ip, self.password))
     utils.update_plugin_yaml(os.environ['CIRCLE_SHA1'], 'pkg')
     workspace_path = os.path.join(os.path.abspath('workspace'), 'build')
     utils.upload_plugin(utils.get_wagon_path(workspace_path))
     for plugin in self.plugins_to_upload:
         utils.upload_plugin(plugin[0], plugin[1])
     self.install_network()
     self.install_nodecellar()
     utils.execute_uninstall('nc')
     utils.execute_uninstall('azure-example-network')
     self.uninstall_manager()
示例#7
0
    def check_external_nodecellar(self):
        blueprint_dir = tempfile.mkdtemp()
        blueprint_zip = os.path.join(blueprint_dir, 'blueprint.zip')
        blueprint_archive = 'nodecellar-auto-scale-auto-heal-blueprint-master'
        download_path = \
            os.path.join(blueprint_dir, blueprint_archive, 'aws.yaml')
        blueprint_path = utils.create_blueprint(utils.NODECELLAR,
                                                blueprint_zip, blueprint_dir,
                                                download_path)

        skip_transform = [
            'aws', 'vpc', 'public_subnet', 'private_subnet',
            'ubuntu_trusty_ami'
        ]

        deployment_nodes = self.get_nc_deployment_nodes()
        new_blueprint_path = utils.create_external_resource_blueprint(
            blueprint_path,
            NC_AWS_NODES,
            deployment_nodes,
            resource_id_attr='aws_resource_id',
            nodes_to_keep_without_transform=skip_transform)

        # Install nc-external
        failed = utils.execute_command(
            'cfy install {0} -b nc-external'.format(new_blueprint_path))
        if failed:
            raise Exception('Nodecellar external install failed.')

        # Un-install nc-external
        failed = utils.execute_uninstall('nc-external')
        if failed:
            raise Exception('Nodecellar external uninstall failed.')
示例#8
0
 def install_blueprints(self):
     ssh_id = 'sshkey-{0}'.format(os.environ['CIRCLE_BUILD_NUM'])
     proxy_id = 'proxy-{0}'.format(os.environ['CIRCLE_BUILD_NUM'])
     cloud_init_id = 'cloud-init-{0}'.format(os.environ['CIRCLE_BUILD_NUM'])
     file_id = 'file-{0}'.format(os.environ['CIRCLE_BUILD_NUM'])
     rest_id = 'rest-{0}'.format(os.environ['CIRCLE_BUILD_NUM'])
     self.install_ssh_key(ssh_id)
     self.install_deployment_proxy_new(proxy_id)
     self.install_deployment_proxy_external(proxy_id)
     utils.execute_uninstall('{0}-parent'.format(proxy_id))
     utils.execute_uninstall('{0}-existing'.format(proxy_id))
     utils.execute_uninstall(proxy_id)
     self.install_cloud_init(cloud_init_id)
     self.install_file(file_id)
     self.install_rest(rest_id)