Skip to content

Commit d6777f4

Browse files
authored
Merge pull request #70 from drscholly/fix/versioning
Bugfix about versioning and empty module
2 parents 1c39e78 + 2d56ec4 commit d6777f4

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

toolbox/api/datagalaxy_api_modules.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def list_objects(self, workspace_name: str, include_links=False) -> list:
3939
raise Exception(body_json['error'])
4040
logging.info(
4141
f'list_objects - {len(body_json["results"])} objects found on '
42-
f'workspace "{workspace_name}" in module {self.module}')
42+
f'workspace {workspace_name} in module {self.module}')
4343
result_pages = [body_json['results']]
4444
next_page = body_json["next_page"]
4545
while next_page is not None:
@@ -49,7 +49,7 @@ def list_objects(self, workspace_name: str, include_links=False) -> list:
4949
body_json = response.json()
5050
logging.info(
5151
f'list_objects - {len(body_json["results"])} objects found on '
52-
f'workspace "{workspace_name}" in module {self.module}')
52+
f'workspace {workspace_name} in module {self.module}')
5353
next_page = body_json["next_page"]
5454
result_pages.append(body_json['results'])
5555
return result_pages

toolbox/api/datagalaxy_api_workspaces.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ def get_workspace(self, name: str) -> dict:
3434
return None
3535

3636
def list_versions(self, id_workspace: str) -> dict:
37-
headers = {'Authorization': f"Bearer {self.token}", 'limit': '5000'}
38-
response = requests.get(f"{self.url}/workspaces/{id_workspace}/versions", headers=headers)
37+
headers = {'Authorization': f"Bearer {self.token}"}
38+
params = {'limit': '5000'}
39+
response = requests.get(f"{self.url}/workspaces/{id_workspace}/versions", headers=headers, params=params)
3940
code = response.status_code
4041
body_json = response.json()
4142
if code == 200:

toolbox/commands/copy_module.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from typing import Optional
2+
import logging
23

34
from toolbox.api.datagalaxy_api_modules import DataGalaxyApiModules
45
from toolbox.commands.utils import config_workspace
@@ -62,6 +63,9 @@ def copy_module(module: str,
6263

6364
# Fetch objects from source workspace
6465
source_objects = source_module_api.list_objects(workspace_source_name)
66+
if source_objects == [[]]:
67+
logging.warning(f'copy-module - No object in source workspace {workspace_source_name}, aborting.')
68+
return 1
6569

6670
# Specific for Dictionary
6771
if module == "Dictionary":

0 commit comments

Comments
 (0)