예제 #1
0
def _run(test_options=None):
    version = ver_check()
    options = test_options or docopt(__doc__, version=version)
    packager.set_global_verbosity_level(options.get('--verbose'))
    lgr.debug(options)

    packager.create(config_file=options.get('--config'),
                    force=options.get('--force'),
                    dryrun=options.get('--dryrun'),
                    no_validate=options.get('--no-validation'),
                    verbose=options.get('--verbose'))
예제 #2
0
def _run(test_options=None):
    version = ver_check()
    options = test_options or docopt(__doc__, version=version)
    packager.set_global_verbosity_level(options.get('--verbose'))
    lgr.debug(options)

    packager.create(
        config_file=options.get('--config'),
        force=options.get('--force'),
        dryrun=options.get('--dryrun'),
        no_validate=options.get('--no-validation'),
        verbose=options.get('--verbose')
        )
 def test_create_agent_package(self):
     config = ap._import_config(CONFIG_FILE)
     ap.create(None, CONFIG_FILE, force=True, verbose=True)
     if os.path.isdir(config['venv']):
         raise Exception('venv exists before extracting agent.')
     os.makedirs(config['venv'])
     utils.run('tar -xzvf {0} -C {1} --strip-components=2'.format(
         config['output_tar'], BASE_DIR))
     os.remove(config['output_tar'])
     self.assertTrue(os.path.isdir(config['venv']))
     p = utils.run('{0}/bin/pip freeze'.format(config['venv']))
     self.assertIn('cloudify-plugins-common', p.stdout)
     self.assertIn('cloudify-rest-client', p.stdout)
     self.assertIn('cloudify-script-plugin', p.stdout)
     self.assertNotIn('cloudify-diamond-plugin', p.stdout)
     shutil.rmtree(config['venv'])
 def test_create_agent_package_with_version_info(self):
     distro = 'Ubuntu'
     release = 'trusty'
     os.environ['VERSION'] = '3.3.0'
     os.environ['PRERELEASE'] = 'm4'
     os.environ['BUILD'] = '666'
     config = ap._import_config(CONFIG_FILE)
     config.pop('output_tar')
     archive = ap._name_archive(distro, release, os.environ['VERSION'],
                                os.environ['PRERELEASE'],
                                os.environ['BUILD'])
     try:
         ap.create(config, force=True, verbose=True)
         self.assertTrue(os.path.isfile(archive))
     finally:
         os.remove(archive)
         os.environ.pop('VERSION')
         os.environ.pop('PRERELEASE')
         os.environ.pop('BUILD')
 def test_create_agent_package_with_version_info(self):
     distro = 'Ubuntu'
     release = 'trusty'
     os.environ['VERSION'] = '3.3.0'
     os.environ['PRERELEASE'] = 'm4'
     os.environ['BUILD'] = '666'
     config = ap._import_config(CONFIG_FILE)
     config.pop('output_tar')
     archive = ap._name_archive(
         distro, release,
         os.environ['VERSION'],
         os.environ['PRERELEASE'],
         os.environ['BUILD'])
     try:
         ap.create(config, force=True, verbose=True)
         self.assertTrue(os.path.isfile(archive))
     finally:
         os.remove(archive)
         os.environ.pop('VERSION')
         os.environ.pop('PRERELEASE')
         os.environ.pop('BUILD')
예제 #6
0
def create_agent_package(directory, config, package_logger=None):
    if package_logger is None:
        package_logger = logger
    package_logger.info('Changing directory into {0}'.format(directory))
    original = os.getcwd()
    try:
        package_logger.info('Creating Agent Package')
        os.chdir(directory)
        if platform.system() == 'Linux':
            packager.create(config=config,
                            config_file=None,
                            force=False,
                            verbose=False)
            distname, _, distid = platform.dist()
            return '{0}-{1}-agent.tar.gz'.format(distname, distid)
        elif platform.system() == 'Windows':
            create_windows_installer(config, logger)
            return 'cloudify_agent_0.exe'
        else:
            raise NonRecoverableError('Platform not supported: {0}'
                                      .format(platform.system()))
    finally:
        os.chdir(original)
예제 #7
0
def create_agent_package(directory, config, package_logger=None):
    if package_logger is None:
        package_logger = logger
    package_logger.info('Changing directory into {0}'.format(directory))
    original = os.getcwd()
    try:
        package_logger.info('Creating Agent Package')
        os.chdir(directory)
        if platform.system() == 'Linux':
            packager.create(config=config,
                            config_file=None,
                            force=False,
                            verbose=False)
            distname, _, distid = platform.dist()
            return '{0}-{1}-agent.tar.gz'.format(distname, distid)
        elif platform.system() == 'Windows':
            create_windows_installer(config, logger)
            return 'cloudify_agent_0.exe'
        else:
            raise NonRecoverableError('Platform not supported: {0}'.format(
                platform.system()))
    finally:
        os.chdir(original)
예제 #8
0
def agent_packager_run(o):
    packager.create(
        config_file=o.get('--config'),
        force=o.get('--force'),
        verbose=o.get('--verbose')
        )
예제 #9
0
#!/usr/bin/env python

import agent_packager.packager as cfyap


URL = "https://github.com/cloudify-cosmo/{}/archive/{}.zip"
AGENT_URL = URL.format("cloudify-agent", "3.4.2")
COMMON_URL = URL.format("cloudify-plugins-common", "3.4.2")
REST_URL = URL.format("cloudify-rest-client", "3.4.2")
SCRIPT_URL = URL.format("cloudify-script-plugin", "1.4")

config = {
    "cloudify_agent_module": AGENT_URL,
    "core_modules": {
        "cloudify_plugins_common": COMMON_URL,
        "cloudify_rest_client": REST_URL,
    },
    "core_plugins": {
        "cloudify_script_plugin": SCRIPT_URL,
    },
}

cfyap.create(config=config)
예제 #10
0
    runner.run(pip_cmd)

    iscc_cmd = 'C:\\Program Files (x86)\\Inno Setup 5\\iscc.exe {0}'\
        .format(get_resource(os.path.join('winpackage', 'create.iss')))
    os.environ['VERSION'] = '0'
    os.environ['iscc_output'] = os.getcwd()
    runner.run(iscc_cmd)

ctx.logger.info('Changing directory into {0}'.format(resource_base))
original = os.getcwd()
try:
    ctx.logger.info('Creating Agent Package')
    os.chdir(resource_base)
    if platform.system() == 'Linux':
        packager.create(config=config,
                        config_file=None,
                        force=False,
                        verbose=False)
        distname, _, distid = platform.dist()
        package_url = 'http://localhost:{0}/{1}-{2}-agent.tar.gz' \
            .format(file_server_port, distname, distid)
    elif platform.system() == 'Windows':
        create_windows_installer()
        package_url = 'http://localhost:{0}/cloudify_agent_0.exe' \
            .format(file_server_port)
    else:
        raise NonRecoverableError('Platform not supported: {0}'
                                  .format(platform.system()))
finally:
    os.chdir(original)

ctx.logger.info('Package created successfully: {0}'.format(package_url))