SHARE
TWEET

Untitled

a guest May 19th, 2017 42 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # just a short example of using optparse
  2. import getpass
  3. import optparse
  4.  
  5. # def parseCmdArgs():
  6. cmdOpts = optparse.OptionParser(usage = '%prog [options]')
  7. cmdOpts.add_option('-i', dest = 'ipaddr', help = 'IP address of CIMC')
  8. cmdOpts.add_option('-u', dest = 'user', help = 'Username')
  9. cmdOpts.add_option('-p', dest = 'passwd', help = 'Password (Optional. If not provided you will be prompted.)')
  10. cmdOpts.add_option('-l', action = 'store_true', dest = 'list', help = 'Just query running firmware.')
  11. cmdOpts.add_option('-v', action = 'store_true', dest = 'verbose', help = 'Verbose output')
  12. cmdOpts.add_option('-n', action = 'store_true', dest = 'dry', help = 'Dry run')
  13. (opts, args) = cmdOpts.parse_args()
  14.  
  15. def getpassword(prompt = "CIMC Password: "):
  16.     return getpass.unix_getpass(prompt)%
RAW Paste Data
Challenge yourself this year...
Learn something new in 2017
Top