opened
rudyardrichter
username_0
### Bug Fixes

The deployment with the previous fence will run into problems if arborist is rolled after fence, because that will discard the role for data upload which fence creates in it. The solution is to use the user.yaml file and have the fence sidecar to arborist handle the upload role setup.

### Deployment changes

Differences in user.yaml required for using with arborist: documentation in progress
fix(upload-role): move arborist setup to yaml
issue
created
PlanXCyborg
username_1
This PR contains code that is not formatted correctly according to [`black`](https://github.com/ambv/black). Run `black` on your code before merging.

<details>
<summary>Expand the full diff to see formatting changes</summary>

```diff
--- fence/sync/sync_users.py
+++ blackened
@@ -109,21 +109,25 @@
     Representation of the information in a YAML file describing user, project, and RBAC
     information for access control.
     """
 
     def __init__(
-        self, projects=None, user_info=None, policies=None, rbac=None, logger=None,
+        self,
+        projects=None,
+        user_info=None,
+        policies=None,
+        rbac=None,
+        logger=None,
         user_rbac=None,
     ):
         self.projects = projects or {}
         self.user_info = user_info or {}
         self.user_rbac = user_rbac or {}
         self.policies = policies or {}
         self.rbac = rbac or {}
         self.logger = logger
 
-
     @classmethod
     def from_file(cls, filepath, encrypted=True, key=None, logger=None):
         with _read_file(filepath, encrypted=encrypted, key=key, logger=logger) as f:
             data = yaml.safe_load(f)
         projects = dict()
@@ -157,11 +161,10 @@
             projects[username] = privileges
 
             # list of policies we want to grant to this user, which get sent to arborist
             # to check if they're allowed to do certain things
             policies[username] = details.get("policies", [])
-
 
         # resources should be the resource tree to construct in arborist
         user_rbac = dict()
         for username, user_detail in users.iteritems():
             # users should occur only once each; skip if already processed
@@ -384,11 +387,13 @@
                 continue
             if not self._match_pattern(filepath, encrypted=encrypted):
                 continue
 
             dbgap_key = getattr(self, "dbgap_key", None)
-            with _read_file(filepath, encrypted=encrypted, key=dbgap_key, logger=self.logger) as f:
+            with _read_file(
+                filepath, encrypted=encrypted, key=dbgap_key, logger=self.logger
+            ) as f:
                 csv = DictReader(f, quotechar='"', skipinitialspace=True)
                 for row in csv:
                     username = row.get("login", "")
                     if username == "":
                         continue
@@ -463,11 +468,13 @@
         user_project = dict()
         user_info = dict()
         user_policies = dict()
 
         dbgap_key = getattr(self, "dbgap_key")
-        with _read_file(filepath, encrypted=encrypted, key=dbgap_key, logger=self.logger) as f:
+        with _read_file(
+            filepath, encrypted=encrypted, key=dbgap_key, logger=self.logger
+        ) as f:
             data = yaml.safe_load(f)
 
         users = data.get("users", {})
         for username, details in users.iteritems():
             # users should occur only once each; skip if already processed
@@ -949,13 +956,11 @@
             dict(zip(local_csv_file_list, permissions)), encrypted=False, sess=sess
         )
 
         try:
             user_yaml = UserYAML.from_file(
-                self.sync_from_local_yaml_file,
-                encrypted=False,
-                logger=self.logger,
+                self.sync_from_local_yaml_file, encrypted=False, logger=self.logger
             )
             resources = user_yaml.rbac["resources"]
         except EnvironmentError as e:
             self.logger.error(str(e))
             self.logger.error("aborting early")
```
</details></br>

This formatting comment was generated automatically by a script in [uc-cdis/wool](https://github.com/uc-cdis/wool).
comment