aurora-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zma...@apache.org
Subject aurora git commit: Deleting --setuid-health-checks and switching to --nosetuid-health-checks flag to to control whether the executor runs health checks as the job role's user.
Date Tue, 19 Apr 2016 19:40:47 GMT
Repository: aurora
Updated Branches:
  refs/heads/master 96d5b648e -> d1dfd16a3


Deleting --setuid-health-checks and switching to --nosetuid-health-checks flag
to to control whether the executor runs health checks as the job role's user.

Bugs closed: AURORA-1666

Reviewed at https://reviews.apache.org/r/46361/


Project: http://git-wip-us.apache.org/repos/asf/aurora/repo
Commit: http://git-wip-us.apache.org/repos/asf/aurora/commit/d1dfd16a
Tree: http://git-wip-us.apache.org/repos/asf/aurora/tree/d1dfd16a
Diff: http://git-wip-us.apache.org/repos/asf/aurora/diff/d1dfd16a

Branch: refs/heads/master
Commit: d1dfd16a34a42bb725f6a321f3ea729097db78e0
Parents: 96d5b64
Author: Dmitriy Shirchenko <caldima@gmail.com>
Authored: Tue Apr 19 12:40:32 2016 -0700
Committer: Zameer Manji <zmanji@apache.org>
Committed: Tue Apr 19 12:40:32 2016 -0700

----------------------------------------------------------------------
 RELEASE-NOTES.md                                |  2 +-
 .../executor/bin/thermos_executor_main.py       | 20 ++++++++++----------
 .../aurora/executor/common/health_checker.py    | 12 ++++++------
 .../executor/common/test_health_checker.py      |  2 +-
 4 files changed, 18 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/aurora/blob/d1dfd16a/RELEASE-NOTES.md
----------------------------------------------------------------------
diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md
index 2068d9c..0ccc341 100644
--- a/RELEASE-NOTES.md
+++ b/RELEASE-NOTES.md
@@ -5,7 +5,7 @@
 
 - Added a new optional [Apache Curator](https://curator.apache.org/) backend for performing
   scheduler leader election. You can enable this with the new `-zk_use_curator` scheduler
argument.
-- Adding --setuid-health-checks flag to control whether the executor runs health checks as
the job's
+- Adding --nosetuid-health-checks flag to control whether the executor runs health checks
as the job's
   role's user.
 
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/d1dfd16a/src/main/python/apache/aurora/executor/bin/thermos_executor_main.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/executor/bin/thermos_executor_main.py b/src/main/python/apache/aurora/executor/bin/thermos_executor_main.py
index 0b3c38c..b2cc78d 100644
--- a/src/main/python/apache/aurora/executor/bin/thermos_executor_main.py
+++ b/src/main/python/apache/aurora/executor/bin/thermos_executor_main.py
@@ -114,6 +114,15 @@ app.add_option(
 
 
 app.add_option(
+    '--nosetuid-health-checks',
+    dest='nosetuid_health_checks',
+    action="store_true",
+    help='If set, the executor will not run shell health checks as job\'s role\'s user',
+    default=False
+)
+
+
+app.add_option(
     '--runner-logger-destination',
     dest='runner_logger_destination',
     type=str,
@@ -145,15 +154,6 @@ app.add_option(
 
 
 app.add_option(
-    '--setuid-health-checks',
-    dest='setuid_health_checks',
-    action="store_true",
-    help='If False, does not run shell health checks as job\'s role\'s user',
-    default=True
-)
-
-
-app.add_option(
      "--preserve_env",
      dest="preserve_env",
      default=False,
@@ -190,7 +190,7 @@ def initialize(options):
 
   # status providers:
   status_providers = [
-      HealthCheckerProvider(setuid_health_checks=options.setuid_health_checks),
+      HealthCheckerProvider(nosetuid_health_checks=options.nosetuid_health_checks),
       ResourceManagerProvider(checkpoint_root=checkpoint_root)
   ]
 

http://git-wip-us.apache.org/repos/asf/aurora/blob/d1dfd16a/src/main/python/apache/aurora/executor/common/health_checker.py
----------------------------------------------------------------------
diff --git a/src/main/python/apache/aurora/executor/common/health_checker.py b/src/main/python/apache/aurora/executor/common/health_checker.py
index 88b629e..5fc845e 100644
--- a/src/main/python/apache/aurora/executor/common/health_checker.py
+++ b/src/main/python/apache/aurora/executor/common/health_checker.py
@@ -208,8 +208,8 @@ class HealthChecker(StatusChecker):
 
 class HealthCheckerProvider(StatusCheckerProvider):
 
-  def __init__(self, setuid_health_checks=True):
-    self.setuid_health_checks = setuid_health_checks
+  def __init__(self, nosetuid_health_checks=False):
+    self.nosetuid_health_checks = nosetuid_health_checks
 
   @staticmethod
   def interpolate_cmd(task, cmd):
@@ -247,14 +247,14 @@ class HealthCheckerProvider(StatusCheckerProvider):
         task=assigned_task,
         cmd=shell_command
       )
-      # If we do not want user which is job's role to execute the health shell check.
-      if self.setuid_health_checks:
+      # If we do not want user which is job's role to execute the health shell check
+      # --nosetuid-health-checks should be passed in as an argument to the executor.
+      demote_to_job_role_user = None
+      if not self.nosetuid_health_checks:
         pw_entry = pwd.getpwnam(assigned_task.task.job.role)
         def demote_to_job_role_user():
           os.setgid(pw_entry.pw_gid)
           os.setuid(pw_entry.pw_uid)
-      else:
-        demote_to_job_role_user = None
 
       shell_signaler = ShellHealthCheck(cmd=interpolated_command,
         preexec_fn=demote_to_job_role_user,

http://git-wip-us.apache.org/repos/asf/aurora/blob/d1dfd16a/src/test/python/apache/aurora/executor/common/test_health_checker.py
----------------------------------------------------------------------
diff --git a/src/test/python/apache/aurora/executor/common/test_health_checker.py b/src/test/python/apache/aurora/executor/common/test_health_checker.py
index ff39e86..bb6ea69 100644
--- a/src/test/python/apache/aurora/executor/common/test_health_checker.py
+++ b/src/test/python/apache/aurora/executor/common/test_health_checker.py
@@ -309,7 +309,7 @@ class TestHealthCheckerProvider(unittest.TestCase):
     execconfig_data = json.loads(assigned_task.task.executorConfig.data)
     assert execconfig_data[
              'health_check_config']['health_checker']['shell']['shell_command'] == 'failed
command'
-    health_checker = HealthCheckerProvider(setuid_health_checks=False).from_assigned_task(
+    health_checker = HealthCheckerProvider(nosetuid_health_checks=True).from_assigned_task(
       assigned_task, None)
     assert health_checker.threaded_health_checker.interval == interval_secs
     assert health_checker.threaded_health_checker.initial_interval == initial_interval_secs


Mime
View raw message