Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 19 additions & 5 deletions tapis_cli/commands/taccapis/v2/apps/deploy/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from ..formatters import AppsFormatManyUnlimited
from .. import API_NAME, SERVICE_VERSION
from ..helpers import pems
from requests.exceptions import HTTPError

__all__ = ['AppsDeploy']

Expand Down Expand Up @@ -441,11 +442,24 @@ def _upload(self, parsed_args):
# need relative destination here because
# agavepy permissions check will fail on '/'
# for public systems
manage.makedirs(os.path.basename(dep_path_temp),
system_id=dep_sys,
permissive=True,
destination=dep_path_parent,
agave=self.tapis_client)
try:
temp_basename = os.path.basename(dep_path_temp)
manage.makedirs(temp_basename,
system_id=dep_sys,
destination=dep_path_parent,
agave=self.tapis_client)
except HTTPError as err:
# if the 'apps' directory doesn't exist, go down a level
# this gets around an error that arises when deploying a first app
if err.response.status_code == 404:
res = manage.makedirs(os.path.join(os.path.basename(dep_path_parent), temp_basename),
system_id=dep_sys,
permissive=True,
destination=os.path.dirname(dep_path_parent),
agave=self.tapis_client)

except Exception:
pass
# clear out destination directory
manage.delete(dep_path,
system_id=dep_sys,
Expand Down