def setUpClass(cls):
        cls.logger = setup_logger(cls.__name__)
        cls.resource_base = tempfile.mkdtemp(
            prefix='file-server-resource-base')
        cls.fs = FileServer(
            root_path=cls.resource_base)
        cls.fs.start()

        cls.source_url = get_source_uri()
        cls.requirements_file = get_requirements_uri()
 def _initialize(self):
     config = RawConfigParser()
     config.add_section('install')
     config.set('install', 'cloudify_agent_module', get_source_uri())
     config.set('install', 'requirements_file',
                get_requirements_uri())
     config.add_section('system')
     config.set('system', 'python_path',
                os.path.join(getattr(sys, 'real_prefix', sys.prefix),
                             'bin', 'python'))
     package_name = create_agent_package(self._fs.root_path, config)
     self._package_url = '{fs_url}/{package_name}'.format(
         fs_url=self._fs.url, package_name=package_name)
     self._package_path = os.path.join(self._fs.root_path, package_name)
     self.initialized = True
def _test_local_agent_from_package(agent_name, fs, ssl_cert, request, *_):

    agent_queue = '{0}-queue'.format(agent_name)

    blueprint_path = resources.get_resource(
        'blueprints/agent-from-package/local-agent-blueprint.yaml')
    logger.info('Initiating local env')

    inputs = {
        'resource_base': fs.root_path,
        'source_url': get_source_uri(),
        'requirements_file': get_requirements_uri(),
        'name': agent_name,
        'queue': agent_queue,
        'file_server_port': fs.port,
        'ssl_cert_path': ssl_cert.local_cert_path()
    }
    managers = [
        ManagerItem({
            'networks': {
                'default': '127.0.0.1'
            },
            'ca_cert_content': ssl_cert.DUMMY_CERT,
            'hostname': 'cloudify'
        })
    ]

    with patch('cloudify.endpoint.LocalEndpoint.get_managers',
               return_value=managers):
        env = local.init_env(name=request.node.name,
                             blueprint_path=blueprint_path,
                             inputs=inputs)

        env.execute('install', task_retries=0)
    agent_dict = get_agent_dict(env)
    ssl_cert.verify_remote_cert(agent_dict['agent_dir'])

    env.execute('uninstall', task_retries=1)
    wait_for_daemon_dead(agent_queue)
Example #4
0
 def setUpClass(cls):
     cls.logger = setup_logger(cls.__name__)
     cls.source_url = get_source_uri()
     cls.requirements_file = get_requirements_uri()
 def setUpClass(cls):
     cls.logger = setup_logger(cls.__name__)
     cls.source_url = get_source_uri()
     cls.requirements_file = get_requirements_uri()