CMS 3D CMS Logo

Functions
update_db_credential Namespace Reference

Functions

def main ()
 
def update_credential (serviceName, accountName, label, newPassword)
 

Function Documentation

def update_db_credential.main ( )

Definition at line 18 of file update_db_credential.py.

References harvestTrackValidationPlots.str, and update_credential().

18 def main():
19 
20  parser = optparse.OptionParser(usage =
21  'Usage: %prog <file> [<file> ...]\n'
22  )
23 
24  parser.add_option('-s', '--service',
25  dest = 'service',
26  help = 'the service hosting the account'
27  )
28 
29  parser.add_option('-a','--accountName',
30  dest = 'accountName',
31  help = 'the account name to change'
32  )
33 
34  parser.add_option('-l','--label',
35  dest = 'label',
36  default = '-',
37  help = 'the connection label. default=accountName@service'
38  )
39 
40  (options, arguments) = parser.parse_args()
41 
42  if options.service == None or options.accountName == None:
43  parser.print_help()
44  return -2
45 
46  password = getpass.getpass( prompt= 'Enter the new password:')
47 
48  try:
49  print update_credential( options.service, options.accountName, options.label, password )
50  print 'Credentials updated.'
51  except Exception as e:
52  print 'Update credential failed: %s'%str(e)
def update_credential(serviceName, accountName, label, newPassword)
def update_db_credential.update_credential (   serviceName,
  accountName,
  label,
  newPassword 
)

Definition at line 7 of file update_db_credential.py.

Referenced by main().

7 def update_credential( serviceName, accountName, label, newPassword ):
8  command = 'cmscond_authentication_manager --update_conn -s %s -u %s -p %s'
9  params = (serviceName, accountName, newPassword )
10  if label != '-':
11  command += ' -l %s'
12  params += ( label, )
13  command = command %params
14  pipe = subprocess.Popen( command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
15  stdout_val = pipe.communicate()[0]
16  return stdout_val
17 
def update_credential(serviceName, accountName, label, newPassword)