Bug 1459737 - Move closure to module-level function; r=dustin
authorGregory Szorc <gps@mozilla.com>
Fri, 04 May 2018 17:41:45 -0700
changeset 417329 5be2194287082502ba148191a13289f0cba349e1
parent 417328 d1e1c418a26e0ea2c07a4c48a4033d2b9be056bb
child 417330 327defec799f2dd0f64771bd71b2b1b486461e04
push id33966
push useraciure@mozilla.com
push dateTue, 08 May 2018 22:55:45 +0000
treeherdermozilla-central@ecbcf736a436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdustin
bugs1459737
milestone62.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1459737 - Move closure to module-level function; r=dustin MozReview-Commit-ID: 2Z2qL8LaEno
taskcluster/scripts/run-task
--- a/taskcluster/scripts/run-task
+++ b/taskcluster/scripts/run-task
@@ -148,16 +148,23 @@ def get_posix_user_group(user, group):
         sys.exit(1)
 
     # Find all groups to which this user is a member.
     gids = [g.gr_gid for g in grp.getgrall() if group in g.gr_mem]
 
     return user_record, group_record, gids
 
 
+def write_audit_entry(path, msg):
+    now = datetime.datetime.utcnow().isoformat()
+    with open(path, 'ab') as fh:
+        fh.write(b'[%sZ %s] %s\n' % (
+                 now, os.environ.get('TASK_ID', 'UNKNOWN'), msg))
+
+
 WANTED_DIR_MODE = stat.S_IXUSR | stat.S_IRUSR | stat.S_IWUSR
 
 
 def set_dir_permissions(path, uid, gid):
     st = os.lstat(path)
 
     if st.st_uid != uid or st.st_gid != gid:
         os.chown(path, uid, gid)
@@ -369,22 +376,16 @@ def main(args):
 
     # Include the UID and GID the task will run as to ensure that tasks
     # with different UID and GID don't share the same cache.
     if uid is not None:
         our_requirements.add(b'uid=%d' % uid)
     if gid is not None:
         our_requirements.add(b'gid=%d' % gid)
 
-    def write_audit_entry(path, msg):
-        now = datetime.datetime.utcnow().isoformat()
-        with open(path, 'ab') as fh:
-            fh.write(b'[%sZ %s] %s\n' % (
-                     now, os.environ.get('TASK_ID', 'UNKNOWN'), msg))
-
     for cache in caches:
         if not os.path.isdir(cache):
             print('error: cache %s is not a directory; this should never '
                   'happen' % cache)
             return 1
 
         requires_path = os.path.join(cache, '.cacherequires')
         audit_path = os.path.join(cache, '.cachelog')