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