Skip to content

Commit

Permalink
Merge pull request #5 from pypr/raise-error-on-add-worker
Browse files Browse the repository at this point in the history
Simplify test and raise error if bootstrap fails.
  • Loading branch information
prabhuramachandran committed Aug 30, 2018
2 parents 380cd20 + 0d0c27e commit 1df44ca
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 8 deletions.
6 changes: 5 additions & 1 deletion automan/automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -798,9 +798,13 @@ def run(self, argv=None):
config_fname=args.config,
exclude_paths=self._get_exclude_paths()
)
from .cluster_manager import BootstrapError

if len(args.host) > 0:
self.cluster_manager.add_worker(args.host, args.home, args.nfs)
try:
self.cluster_manager.add_worker(args.host, args.home, args.nfs)
except BootstrapError:
pass
return
elif len(args.host) == 0 and args.update_remote:
self.cluster_manager.update(not args.no_rebuild)
Expand Down
5 changes: 5 additions & 0 deletions automan/cluster_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
from urllib.request import urlopen


class BootstrapError(Exception):
pass


class ClusterManager(object):
"""The cluster manager class.
Expand Down Expand Up @@ -194,6 +198,7 @@ def _bootstrap(self, host, home):
project_name=self.project_name)
)
print(msg)
raise BootstrapError(msg)
else:
print("Bootstrapping {host} succeeded!".format(host=host))

Expand Down
9 changes: 2 additions & 7 deletions automan/tests/test_cluster_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,8 @@ class MyClusterManager(ClusterManager):
#!/bin/bash
set -e
python -m venv envs/{project_name}
source envs/{project_name}/bin/activate
cd %s
python -m pip install execnet psutil
python setup.py install
""" % ROOT_DIR)
python -m venv --system-site-packages envs/{project_name}
""")

UPDATE = dedent("""\
#!/bin/bash
Expand Down

0 comments on commit 1df44ca

Please sign in to comment.