|
|
31f7c36 |
From 913b547a0df8433924531739506e1b8975e50b8b Mon Sep 17 00:00:00 2001
|
|
|
31f7c36 |
From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= <lsedlar@redhat.com>
|
|
|
31f7c36 |
Date: Wed, 17 May 2017 15:30:45 +0200
|
|
|
31f7c36 |
Subject: [PATCH 1/3] Make --module-name work with namespaces
|
|
|
31f7c36 |
MIME-Version: 1.0
|
|
|
31f7c36 |
Content-Type: text/plain; charset=UTF-8
|
|
|
31f7c36 |
Content-Transfer-Encoding: 8bit
|
|
|
31f7c36 |
|
|
|
31f7c36 |
Allow the user to specify module name including a namespace, and when no
|
|
|
31f7c36 |
namespace is included, assume 'rpms'.
|
|
|
31f7c36 |
|
|
|
31f7c36 |
Fixes: #216
|
|
|
31f7c36 |
Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
|
|
|
31f7c36 |
---
|
|
|
31f7c36 |
pyrpkg/cli.py | 16 +++++++++++++++-
|
|
|
31f7c36 |
1 file changed, 15 insertions(+), 1 deletion(-)
|
|
|
31f7c36 |
|
|
|
31f7c36 |
diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
|
|
|
31f7c36 |
index 7395fd1..856883a 100644
|
|
|
31f7c36 |
--- a/pyrpkg/cli.py
|
|
|
31f7c36 |
+++ b/pyrpkg/cli.py
|
|
|
31f7c36 |
@@ -138,7 +138,21 @@ class cliClient(object):
|
|
|
31f7c36 |
realms=realms
|
|
|
31f7c36 |
)
|
|
|
31f7c36 |
|
|
|
31f7c36 |
- self._cmd.module_name = self.args.module_name
|
|
|
31f7c36 |
+ if self.args.module_name:
|
|
|
31f7c36 |
+ # Module name was specified via argument
|
|
|
31f7c36 |
+ if '/' not in self.args.module_name:
|
|
|
31f7c36 |
+ # No slash, assume rpms namespace
|
|
|
31f7c36 |
+ self._cmd.module_name = self.args.module_name
|
|
|
31f7c36 |
+ self._cmd.ns_module_name = 'rpms/%s' % self.args.module_name
|
|
|
31f7c36 |
+ else:
|
|
|
31f7c36 |
+ self._cmd.ns_module_name = self.args.module_name
|
|
|
31f7c36 |
+ try:
|
|
|
31f7c36 |
+ _, self._cmd.module_name = self.args.module_name.split('/')
|
|
|
31f7c36 |
+ # Exactly one slash, let's continue on
|
|
|
31f7c36 |
+ except ValueError:
|
|
|
31f7c36 |
+ # Too many segments, report an error
|
|
|
31f7c36 |
+ self.parser.error('Argument to --module-name can contain '
|
|
|
31f7c36 |
+ 'at most one / character')
|
|
|
31f7c36 |
self._cmd.password = self.args.password
|
|
|
31f7c36 |
self._cmd.runas = self.args.runas
|
|
|
31f7c36 |
self._cmd.debug = self.args.debug
|
|
|
31f7c36 |
--
|
|
|
31f7c36 |
2.9.4
|
|
|
31f7c36 |
|