fix unhandled error when output dir is not specified during collect
Pegleg is tossing an error that's difficult to decipher when an output directory is not specified during "collect". Currently "save-location" param is optional and can be missed during command execution. This PS handles missing or invalid output directory exception. Change-Id: I6f41e4951be29d8ecdce73f6090f0bcc9e7ee2d9
This commit is contained in:
parent
97ef079d9e
commit
d9692126ed
@ -69,7 +69,6 @@ def site(primary_repo, aux_repo):
|
||||
'save_location',
|
||||
type=click.Path(
|
||||
file_okay=False, dir_okay=True, writable=True, resolve_path=True),
|
||||
default=sys.stdout,
|
||||
help='Where to output')
|
||||
@click.argument('site_name')
|
||||
def collect(*, save_location, site_name):
|
||||
|
@ -29,6 +29,10 @@ LOG = logging.getLogger(__name__)
|
||||
def collect(site_name, save_location):
|
||||
try:
|
||||
save_files = dict()
|
||||
if save_location is None:
|
||||
raise ValueError('Missing param: save-location')
|
||||
elif not os.path.exists(save_location):
|
||||
raise FileNotFoundError('Invalid save-location path')
|
||||
for (repo_base,
|
||||
filename) in util.definition.site_files_by_repo(site_name):
|
||||
repo_name = os.path.normpath(repo_base).split(os.sep)[-1]
|
||||
|
Loading…
Reference in New Issue
Block a user