Trees | Indices | Help |
---|
|
1 # 2 # Copyright (c) 2008--2016 Red Hat, Inc. 3 # 4 # This software is licensed to you under the GNU General Public License, 5 # version 2 (GPLv2). There is NO WARRANTY for this software, express or 6 # implied, including the implied warranties of MERCHANTABILITY or FITNESS 7 # FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2 8 # along with this software; if not, see 9 # http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt. 10 # 11 # Red Hat trademarks are not licensed under GPLv2. No permission is 12 # granted to use or replicate Red Hat trademarks that are incorporated 13 # in this software or its documentation. 14 # 15 16 import sys 17 import getpass 18 from optparse import OptionParser, Option 19 20 from config_common import rhn_log 21 from config_common import cfg_exceptions 22 from config_common import local_config 23 from rhn.i18n import bstr 2426 _options_table = [] 27 _option_parser_class = OptionParser 28 _usage_options = "[options]" 29 _option_class = Option9631 self.repository = repository 32 self.set_mode(mode) 33 self.set_exec_name(exec_name) 34 self.options, self.args = self._parse_args(args)35 38 41 4446 # Parses the arguments and returns a tuple (options, args) 47 usage = " ".join(["%prog", self.mode, self._usage_options]) 48 self._parser = self._option_parser_class( 49 option_list=self._options_table, 50 usage=usage) 51 return self._parser.parse_args(args)52 5557 # entry point for repository authentication 58 59 try: 60 self.repository.login() 61 except cfg_exceptions.InvalidSession: 62 if not username : 63 username=local_config.get('username') 64 if not password : 65 password=local_config.get('password') 66 67 if not password : 68 (username, password) = self.get_auth_info(username) 69 try: 70 self.repository.login(username=username, password=password) 71 except cfg_exceptions.InvalidSession: 72 e = sys.exc_info()[1] 73 rhn_log.die(1, "Session error: %s\n" % e)7476 if username is None: 77 username = self._read_username() 78 79 password = getpass.getpass() 80 81 return (username, password)82
Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Wed Mar 4 07:37:49 2020 | http://epydoc.sourceforge.net |