Blob Blame Raw
From 00a8c40153b276a63088b7891f866f62161d6f5c Mon Sep 17 00:00:00 2001
From: Bret Fontecchio <bfontecc@redhat.com>
Date: Thu, 30 Nov 2017 15:30:00 -0500
Subject: [PATCH] Add compose-id and signing-intent arguments

Signed-off-by: Bret Fontecchio <bfontecc@redhat.com>
---
 pyrpkg/cli.py     | 27 +++++++++++++++++++++------
 tests/test_cli.py |  6 ++++++
 2 files changed, 27 insertions(+), 6 deletions(-)

diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py
index c8ce3d7..7799d29 100644
--- a/pyrpkg/cli.py
+++ b/pyrpkg/cli.py
@@ -1026,11 +1026,24 @@ see API KEY section of copr-cli(1) man page.
             help='Build a container',
             description='Build a container')
 
-        self.container_build_parser.add_argument(
-            '--repo-url',
-            metavar="URL",
-            help=('URL of yum repo file'),
-            nargs='*')
+        group = self.container_build_parser.add_mutually_exclusive_group()
+        group.add_argument(
+                           '--compose-id',
+                           dest='compose_ids',
+                           metavar='COMPOSE_ID',
+                           help='ODCS composes used. '
+                                'Cannot be used with --signing-intent or --repo-url',
+                           nargs='*')
+        group.add_argument(
+                          '--signing-intent',
+                          help='Signing intent of the ODCS composes. Cannot be '
+                               'used with --compose-id or --repo-url')
+        group.add_argument(
+                          '--repo-url',
+                          metavar="URL",
+                          help='URL of yum repo file'
+                               'Cannot be used with --signing-intent or --compose-id',
+                          nargs='*')
 
         self.container_build_parser.add_argument(
             '--target',
@@ -1280,7 +1293,9 @@ see API KEY section of copr-cli(1) man page.
                 "quiet": self.args.q,
                 "yum_repourls": self.args.repo_url,
                 "git_branch": self.cmd.branch_merge,
-                "arches": self.args.arches}
+                "arches": self.args.arches,
+                "compose_ids": self.args.compose_ids,
+                "signing_intent": self.args.signing_intent}
 
         section_name = "%s.container-build" % self.name
         err_msg = "Missing %(option)s option in [%(plugin.section)s] section. " \
diff --git a/tests/test_cli.py b/tests/test_cli.py
index 11b9bc8..2ba93ea 100644
--- a/tests/test_cli.py
+++ b/tests/test_cli.py
@@ -205,6 +205,8 @@ class TestContainerBuildWithKoji(CliTestCase):
                 'yum_repourls': None,
                 'git_branch': 'eng-rhel-7',
                 'arches': None,
+                'signing_intent': None,
+                'compose_ids': None
             },
             kojiconfig=None,
             kojiprofile='koji',
@@ -230,6 +232,8 @@ class TestContainerBuildWithKoji(CliTestCase):
                 'yum_repourls': None,
                 'git_branch': 'eng-rhel-7',
                 'arches': None,
+                'signing_intent': None,
+                'compose_ids': None
             },
             kojiconfig=None,
             kojiprofile='koji',
@@ -264,6 +268,8 @@ class TestContainerBuildWithKoji(CliTestCase):
                 'yum_repourls': None,
                 'git_branch': 'eng-rhel-7',
                 'arches': None,
+                'signing_intent': None,
+                'compose_ids': None
             },
             kojiconfig='/path/to/koji.conf',
             kojiprofile=None,
-- 
2.14.3