Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Allow username and password to be set on command line for cluster auth

  • Loading branch information...
commit 2519d40d01779067adb96a49957a84edb4d15290 1 parent c8ad362
@feist authored
Showing with 14 additions and 5 deletions.
  1. +11 −2 pcs/cluster.py
  2. +2 −2 pcs/pcs.py
  3. +1 −1  pcs/usage.py
View
13 pcs/cluster.py
@@ -113,8 +113,16 @@ def cluster_token(argv):
sys.exit(1)
def auth_nodes(nodes):
- username = None
- password = None
+ if "-u" in utils.pcs_options:
+ username = utils.pcs_options["-u"]
+ else:
+ username = None
+
+ if "-p" in utils.pcs_options:
+ password = utils.pcs_options["-p"]
+ else:
+ password = None
+
for node in nodes:
status = utils.checkStatus(node)
if status[0] == 0:
@@ -122,6 +130,7 @@ def auth_nodes(nodes):
elif status[0] == 3:
if username == None:
username = raw_input("Username: ")
+ if password == None:
password = getpass.getpass("Password: ")
utils.updateToken(node,username,password)
print "%s: Authorized" % (node)
View
4 pcs/pcs.py
@@ -27,12 +27,12 @@ def main(argv):
else:
modified_argv.append(arg)
else:
- if prev_arg != "-f":
+ if prev_arg != "-f" or prev_arg != "-p" or prev_arg != "-u":
real_argv.append(arg)
modified_argv.append(arg)
prev_arg = arg
- pcs_options, argv = getopt.gnu_getopt(modified_argv, "hf:p", ["local","start","all"])
+ pcs_options, argv = getopt.gnu_getopt(modified_argv, "hf:p:u:", ["local","start","all"])
except getopt.GetoptError, err:
print err
usage.main()
View
2  pcs/usage.py
@@ -165,7 +165,7 @@ def cluster():
Get current status of pcsd on nodes specified, or on all nodes
configured in corosync.conf if no nodes are specified
- auth [node] [...]
+ auth [node] [...] [-u username] [-p password]
Authenticate pcs to pcsd on nodes specified, or on all nodes
configured in corosync.conf if no nodes are specified (authorization
tokens are stored in ~/.pcs/token)
Please sign in to comment.
Something went wrong with that request. Please try again.