mesos-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] [mesos] cf-natali commented on a change in pull request #383: Add mesos authentication to the mesos cli
Date Thu, 27 May 2021 18:53:03 GMT

cf-natali commented on a change in pull request #383:
URL: https://github.com/apache/mesos/pull/383#discussion_r640885326



##########
File path: src/python/cli_new/lib/cli/config.py
##########
@@ -119,6 +120,94 @@ def master(self):
 
         return master
 
+    def principal(self):
+        """
+        Return the principal in the configuration file
+        """
+        principal = self.data["master"].get("principal")
+        if principal is None:
+            return None
+        elif not principal:
+            raise CLIException("The 'principal' field in 'master'"
+                               " must be non-empty")
+
+        return principal
+
+    def secret(self):
+        """
+        Return the secret in the configuration file
+        """
+        secret = self.data["master"].get("secret")
+        if secret is None:
+            return None
+        elif not secret:
+            raise CLIException("The 'secret' field in 'master'"
+                               " must be non-empty")
+
+        return secret
+
+    def agent_ssl(self):
+        """
+        Return if the agent support ssl
+        """
+        if "agent" in self.data:
+            agent_ssl = self.data["agent"].get("ssl")
+            if agent_ssl is None:
+                return None
+            elif not agent_ssl:
+                if not isinstance(self.data["agent"]["ssl"], bool):

Review comment:
       > Is already change in the current version.
   
   I don't seem to see it.
   
   Also, I still see 3 commits, I thought you'd squashed?

##########
File path: src/python/cli_new/lib/cli/config.py
##########
@@ -119,6 +120,94 @@ def master(self):
 
         return master
 
+    def principal(self):
+        """
+        Return the principal in the configuration file
+        """
+        principal = self.data["master"].get("principal")
+        if principal is None:
+            return None
+        elif not principal:
+            raise CLIException("The 'principal' field in 'master'"
+                               " must be non-empty")
+
+        return principal
+
+    def secret(self):
+        """
+        Return the secret in the configuration file
+        """
+        secret = self.data["master"].get("secret")
+        if secret is None:
+            return None
+        elif not secret:
+            raise CLIException("The 'secret' field in 'master'"
+                               " must be non-empty")
+
+        return secret
+
+    def agent_ssl(self):
+        """
+        Return if the agent support ssl
+        """
+        if "agent" in self.data:
+            agent_ssl = self.data["agent"].get("ssl")
+            if agent_ssl is None:
+                return None
+            elif not agent_ssl:
+                if not isinstance(self.data["agent"]["ssl"], bool):

Review comment:
       > But I'm interesting of what do u think about to change `def secret` and `def principal`
to
   > 
   > ```
   >     def secret(self):
   >         return self.data["master"].get("secret")
   > ```
   > 
   > No matter secret does not exist, or it's empty, secret would be "None". Thats why
the "elif" is not usefull in these case. And because secret does not have to be configured,
it's also not important to rise a "Exception". What do u think?
   
   Yes, if it's not required it makes sense.

##########
File path: src/python/cli_new/lib/cli/http.py
##########
@@ -19,70 +19,63 @@
 """
 
 import json
-import urllib.request
-import urllib.error
-import urllib.parse
-import time
+from urllib.parse import urlencode
+import urllib3
 
 import cli
 
 from cli.exceptions import CLIException
 
+urllib3.disable_warnings()

Review comment:
       Then maybe add a comment explaining it?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



Mime
View raw message