diff --git a/services/standaloneworker/Dockerfile b/services/standaloneworker/Dockerfile index dbd134af9d18c9c5c8089e14cce6b516de0dd9c2..11ceaceaf1455b0baca49b4dc7c2c4c41558da3f 100755 --- a/services/standaloneworker/Dockerfile +++ b/services/standaloneworker/Dockerfile @@ -21,8 +21,10 @@ RUN mkdir /home/testuser/.ssh COPY keys/id_rsa.pub /home/testuser/.ssh/authorized_keys RUN dnf install -y python wget -# Install iputils (ping) -RUN dnf install -y iputils +# Install iputils (fpr ping) and openssh-clients (for scp) +RUN dnf install -y iputils openssh-clients + +# TODO: Add the rosettta user # Copy registries.conf to allow insecure access to dregistry COPY registries.conf /etc/containers/registries.conf diff --git a/services/webapp/code/rosetta/core_app/api.py b/services/webapp/code/rosetta/core_app/api.py index 9a44798c530877862c7cda81fea552f89c8e41d7..c52dd77f46fd4fb3bd526f3bddfc69019b7ff9be 100644 --- a/services/webapp/code/rosetta/core_app/api.py +++ b/services/webapp/code/rosetta/core_app/api.py @@ -321,7 +321,7 @@ print(port) return HttpResponse('Port not valid (got "{}")'.format(task_interface_port)) # Set fields - logger.info('Setting task "{}" to ip "{}" and port "{}"'.format(task.uuid, task_interface_ip, task_interface_port)) + logger.info('Agent API setting task "{}" to ip "{}" and port "{}"'.format(task.uuid, task_interface_ip, task_interface_port)) task.status = TaskStatuses.running task.interface_ip = task_interface_ip @@ -349,7 +349,7 @@ print(port) # Notify the user that the task called back home if using a WMS if task.computing.wms: if settings.DJANGO_EMAIL_APIKEY: - logger.info('Sending task ready mail notification to "{}"'.format(task.user.email)) + logger.info('Agent API sending task ready mail notification to "{}"'.format(task.user.email)) mail_subject = 'Your Task "{}" is now starting up'.format(task.container.name) mail_text = 'Hello,\n\nyour Task "{}" on {} is now starting up. Check logs or connect here: https://{}/tasks/?uuid={}\n\nThe Rosetta notifications bot.'.format(task.container.name, task.computing, settings.ROSETTA_HOST, task.uuid) try: @@ -449,7 +449,7 @@ class FileManagerAPI(PrivateGETAPI, PrivatePOSTAPI): else: raise NotImplementedError('Accessing a storage with ssh+cli without going through its computing resource is not implemented') if '$USER' in base_path_expanded: - base_path_expanded = base_path_expanded.replace('$USER', user.name) + base_path_expanded = base_path_expanded.replace('$USER', user.username) # If the path is not starting with the base path, do it if not path.startswith(base_path_expanded): @@ -757,6 +757,9 @@ class FileManagerAPI(PrivateGETAPI, PrivatePOSTAPI): if not storage.type=='generic_posix' and storage.access_mode=='ssh+cli': continue + if storage.access_through_computing and not storage.computing.manager.is_configured_for(user=request.user): + continue + data['data'].append({ 'id': '/{}/'.format(storage.id), 'type': 'folder', diff --git a/services/webapp/code/rosetta/core_app/computing_managers.py b/services/webapp/code/rosetta/core_app/computing_managers.py index ff6dfcbb169e480fb8524cc6cc93b1d72b33e400..9a92361787b2767aad42dd574afa896305608883 100644 --- a/services/webapp/code/rosetta/core_app/computing_managers.py +++ b/services/webapp/code/rosetta/core_app/computing_managers.py @@ -249,7 +249,7 @@ class SSHStandaloneComputingManager(StandaloneComputingManager, SSHComputingMana else: raise NotImplementedError('Accessing a storage with ssh+cli without going through its computing resource is not implemented') if '$USER' in expanded_base_path: - expanded_base_path = expanded_base_path.replace('$USER', self.task.user.name) + expanded_base_path = expanded_base_path.replace('$USER', task.user.username) # Expand the bind_path expanded_bind_path = storage.bind_path @@ -259,7 +259,7 @@ class SSHStandaloneComputingManager(StandaloneComputingManager, SSHComputingMana else: raise NotImplementedError('Accessing a storage with ssh+cli without going through its computing resource is not implemented') if '$USER' in expanded_bind_path: - expanded_bind_path = expanded_bind_path.replace('$USER', self.task.user.name) + expanded_bind_path = expanded_bind_path.replace('$USER', task.user.username) # Add the bind if not binds: @@ -309,7 +309,7 @@ class SSHStandaloneComputingManager(StandaloneComputingManager, SSHComputingMana else: raise NotImplementedError('Accessing a storage with ssh+cli without going through its computing resource is not implemented') if '$USER' in expanded_base_path: - expanded_base_path = expanded_base_path.replace('$USER', self.task.user.name) + expanded_base_path = expanded_base_path.replace('$USER', task.user.username) # Expand the bind_path expanded_bind_path = storage.bind_path @@ -319,7 +319,7 @@ class SSHStandaloneComputingManager(StandaloneComputingManager, SSHComputingMana else: raise NotImplementedError('Accessing a storage with ssh+cli without going through its computing resource is not implemented') if '$USER' in expanded_bind_path: - expanded_bind_path = expanded_bind_path.replace('$USER', self.task.user.name) + expanded_bind_path = expanded_bind_path.replace('$USER', task.user.username) # Add the bind if not binds: @@ -502,7 +502,7 @@ class SlurmSSHClusterComputingManager(ClusterComputingManager, SSHComputingManag else: raise NotImplementedError('Accessing a storage with ssh+cli without going through its computing resource is not implemented') if '$USER' in expanded_base_path: - expanded_base_path = expanded_base_path.replace('$USER', self.task.user.name) + expanded_base_path = expanded_base_path.replace('$USER', task.user.username) # Expand the bind_path expanded_bind_path = storage.bind_path @@ -512,7 +512,7 @@ class SlurmSSHClusterComputingManager(ClusterComputingManager, SSHComputingManag else: raise NotImplementedError('Accessing a storage with ssh+cli without going through its computing resource is not implemented') if '$USER' in expanded_bind_path: - expanded_bind_path = expanded_bind_path.replace('$USER', self.task.user.name) + expanded_bind_path = expanded_bind_path.replace('$USER', task.user.username) # Add the bind if not binds: