|
6 | 6 | import shutil |
7 | 7 | import os |
8 | 8 | import sys |
| 9 | +import tempfile |
9 | 10 |
|
10 | 11 | import utils |
11 | 12 | import codes |
12 | 13 |
|
13 | 14 | DEFAULT_CONFIG_FILE = 'config.yaml' |
14 | 15 | DEFAULT_OUTPUT_TAR_PATH = '{0}-{1}-agent.tar.gz' |
15 | | -DEFAULT_VENV_PATH = 'cloudify/env' |
16 | 16 |
|
17 | 17 | PREINSTALL_MODULES = [ |
18 | 18 | 'setuptools==36.8.0' |
@@ -62,6 +62,7 @@ def _import_config(config_file=DEFAULT_CONFIG_FILE): |
62 | 62 |
|
63 | 63 | :param string config_file: path to config file |
64 | 64 | """ |
| 65 | + config_file = os.path.expanduser(config_file) |
65 | 66 | lgr.debug('Importing config: {0}...'.format(config_file)) |
66 | 67 | try: |
67 | 68 | with open(config_file, 'r') as c: |
@@ -332,16 +333,14 @@ def _name_archive(distro, release, version, milestone, build): |
332 | 333 |
|
333 | 334 |
|
334 | 335 | def create(config=None, config_file=None, force=False, dryrun=False, |
335 | | - no_validate=False, verbose=True): |
| 336 | + no_validate=False, verbose=True, virtualenv=None): |
336 | 337 | """Creates an agent package (tar.gz) |
337 | 338 |
|
338 | 339 | This will try to identify the distribution of the host you're running on. |
339 | 340 | If it can't identify it for some reason, you'll have to supply a |
340 | 341 | `distribution` (e.g. Ubuntu) config object in the config.yaml. |
341 | 342 | The same goes for the `release` (e.g. Trusty). |
342 | 343 |
|
343 | | - A virtualenv will be created under cloudify/env. |
344 | | -
|
345 | 344 | The order of the modules' installation is as follows: |
346 | 345 | cloudify-rest-service |
347 | 346 | cloudify-plugins-common |
@@ -385,7 +384,7 @@ def create(config=None, config_file=None, force=False, dryrun=False, |
385 | 384 | '({0})'.format(ex.message)) |
386 | 385 | sys.exit(codes.errors['could_not_identify_distribution']) |
387 | 386 | python = config.get('python_path', '/usr/bin/python') |
388 | | - venv = DEFAULT_VENV_PATH |
| 387 | + venv = virtualenv or tempfile.mkdtemp(prefix='agent-packager') |
389 | 388 | venv_already_exists = utils.is_virtualenv(venv) |
390 | 389 | destination_tar = config.get('output_tar', _name_archive(**name_params)) |
391 | 390 |
|
|
0 commit comments