Skip to content

Commit

Permalink
Merge 1b6f4b5 into fcad8c4
Browse files Browse the repository at this point in the history
  • Loading branch information
roksys committed Nov 28, 2018
2 parents fcad8c4 + 1b6f4b5 commit adac59f
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
32 changes: 32 additions & 0 deletions reana_commons/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import json
import os
import shutil
from hashlib import md5

import click
Expand Down Expand Up @@ -88,3 +89,34 @@ def calculate_file_access_time(workflow_workspace):
file_path = os.path.join(subdir, file)
access_times[file_path] = os.stat(file_path).st_atime
return access_times


def copy_openapi_specs(output_path, component):
"""Copy generated and validated openapi specs to reana-commons module."""
if component == 'reana-server':
file = 'reana_server.json'
elif component == 'reana-workflow-controller':
file = 'reana_workflow_controller.json'
elif component == 'reana-job-controller':
file = 'reana_job_controller.json'
if os.environ.get('REANA_SRCDIR'):
reana_srcdir = os.environ.get('REANA_SRCDIR')
else:
reana_srcdir = os.path.join('..')
try:
reana_commons_specs_path = os.path.join(
reana_srcdir,
'reana-commons',
'reana_commons',
'openapi_specifications')
if os.path.exists(reana_commons_specs_path):
if os.path.isfile(output_path):
shutil.copy(output_path,
os.path.join(reana_commons_specs_path,
file))
# copy openapi specs file as well to docs
shutil.copy(output_path,
os.path.join('docs', 'openapi.json'))
except Exception as e:
click.echo('Something went wrong, could not copy openapi '
'specifications to reana-commons \n{0}'.format(e))
2 changes: 1 addition & 1 deletion reana_commons/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@

from __future__ import absolute_import, print_function

__version__ = "0.5.0.dev20181126"
__version__ = "0.5.0.dev20181128"

0 comments on commit adac59f

Please sign in to comment.