Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 705369 Details for
Bug 918036
RFE - rhncfg-manager supports --username and --password from CLI
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Patch : --password --username + other small fixes
0001-bz918036-RFE-rhncfg-manager-supports-username-and-pa.patch (text/plain), 4.59 KB, created by
Dimitar Yordanov
on 2013-03-05 11:57:36 UTC
(
hide
)
Description:
Patch : --password --username + other small fixes
Filename:
MIME Type:
Creator:
Dimitar Yordanov
Created:
2013-03-05 11:57:36 UTC
Size:
4.59 KB
patch
obsolete
>From eefa5ebc1029efdecd3ed8b32ec5e80ad6cb3c93 Mon Sep 17 00:00:00 2001 >From: Dimitar Yordanov <dyordano@redhat.com> >Date: Tue, 5 Mar 2013 12:48:25 +0100 >Subject: [PATCH] bz918036 - RFE - rhncfg-manager supports --username and > --password from CLI > >--- > client/tools/rhncfg/config_common/handler_base.py | 10 +++-- > client/tools/rhncfg/config_common/rhn_main.py | 44 +++++++++++++------- > 2 files changed, 34 insertions(+), 20 deletions(-) > >diff --git a/client/tools/rhncfg/config_common/handler_base.py b/client/tools/rhncfg/config_common/handler_base.py >index ce0fecd..1dbee14 100644 >--- a/client/tools/rhncfg/config_common/handler_base.py >+++ b/client/tools/rhncfg/config_common/handler_base.py >@@ -53,20 +53,22 @@ class HandlerBase: > def usage(self): > return self._parser.print_help() > >- def authenticate(self): >+ def authenticate(self, username=None, password=None): > # entry point for repository authentication > > try: > self.repository.login() > except cfg_exceptions.InvalidSession: >- (username, password) = self.get_auth_info( >- username=local_config.get('username')) >+ if not username : >+ username=local_config.get('username') >+ if not password : >+ (username, password) = self.get_auth_info(username) > > try: > self.repository.login(username=username, password=password) > except cfg_exceptions.InvalidSession, e: > rhn_log.die(1, "Session error: %s\n" % e) >- >+ > def get_auth_info(self, username=None): > if username is None: > username = self._read_username() >diff --git a/client/tools/rhncfg/config_common/rhn_main.py b/client/tools/rhncfg/config_common/rhn_main.py >index f59340b..be6af7c 100644 >--- a/client/tools/rhncfg/config_common/rhn_main.py >+++ b/client/tools/rhncfg/config_common/rhn_main.py >@@ -54,27 +54,39 @@ class BaseMain: > show_help = None > debug_level = 3 > mode = None >- server_name = None >- server_name_opt = "--server-name" >- needs_server_name = 0 >- for arg in sys.argv[1:]: >- if needs_server_name: >- server_name = arg >- needs_server_name = 0 >+ >+ dict_name_opt={'--server-name': None,'--password': None,'--username': None,} >+ for index in range(1,len(sys.argv)): >+ arg=sys.argv[index] >+ param = filter(lambda x: x[1] == 0,dict_name_opt.iteritems()) >+ if param: >+ if arg.startswith('-') or arg in self.modes: >+ # not perfect, but at least a little bit better >+ print "Option %s requires an argument" % dict_name_opt[param[0][0]] >+ return 1 >+ dict_name_opt[param[0][0]] = arg > continue > > if arg in ('--help', '-h'): > show_help = 1 > continue > >- if arg.startswith(server_name_opt): >- rarg = arg[len(server_name_opt):] >+ param = [s for s in dict_name_opt.keys() if arg.startswith(s)] >+ if param: >+ rarg = arg[len(param[0]):] > if not rarg: >- needs_server_name = 1 >+ dict_name_opt[param[0]] = 0 >+ if index == len(sys.argv) - 1: >+ print "Option %s requires an argument" % param[0] >+ return 1 > continue > if rarg[0] == '=': >- server_name = rarg[1:] >- continue >+ if len(rarg) == 1: >+ print "Option %s requires an argument" % param[0] >+ return 1 >+ >+ dict_name_opt[param[0]] = rarg[1:] >+ continue > print "Unknown option %s" % arg > return 1 > >@@ -97,9 +109,9 @@ class BaseMain: > > args.append(arg) > >- if needs_server_name: >- print "No argument specified to %s" % server_name_opt >- return 1 >+ server_name = dict_name_opt['--server-name'] >+ password = dict_name_opt['--password'] >+ username = dict_name_opt['--username'] > > rhn_log.set_debug_level(debug_level) > >@@ -191,7 +203,7 @@ class BaseMain: > > handler = module.Handler(args, repo, mode=mode, exec_name=execname) > try: >- handler.authenticate() >+ handler.authenticate(username,password) > handler.run() > except cfg_exceptions.AuthenticationError, e: > rhn_log.die(1, "Authentication failed: %s" % e) >-- >1.7.7.6 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 918036
: 705369