Blob Blame History Raw
From 1da1afda045ac7eda3f32fe6c7cc0385c64849d8 Mon Sep 17 00:00:00 2001
From: Randy Barlow <randy@electronsweatshop.com>
Date: Wed, 26 Sep 2018 19:42:53 -0400
Subject: [PATCH 1/2] Explicitly name the skopeo-lite src/dest_creds
 parameters.

The bodhi-skopeo-lite copy command accepts the source and
destination credentials via two different long-form (i.e., --)
flags. Click 6.0 named the resulting parameter by the second name,
and Click 7.0 names them by the first. This commit names the
parameter that click should use explicitly so that both flags can
work with both Click 6 and 7.

re #2621

Signed-off-by: Randy Barlow <randy@electronsweatshop.com>
---
 bodhi/server/scripts/skopeo_lite.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/bodhi/server/scripts/skopeo_lite.py b/bodhi/server/scripts/skopeo_lite.py
index df0db013..0e752512 100644
--- a/bodhi/server/scripts/skopeo_lite.py
+++ b/bodhi/server/scripts/skopeo_lite.py
@@ -738,7 +738,7 @@ class Copier(object):
 
 
 @main.command()
-@click.option('--src-creds', '--screds', metavar='USERNAME[:PASSWORD]',
+@click.option('--src-creds', '--screds', 'src_creds', metavar='USERNAME[:PASSWORD]',
               help='Use USERNAME[:PASSWORD] for accessing the source registry')
 @click.option('--src-tls-verify', type=bool, default=True,
               help=('require HTTPS and verify certificates when talking to the '
@@ -746,7 +746,7 @@ class Copier(object):
 @click.option('--src-cert-dir', metavar='PATH',
               help=('use certificates at PATH (*.crt, *.cert, *.key) to connect to the '
                     'source registry'))
-@click.option('--dest-creds', '--dcreds', metavar='USERNAME[:PASSWORD]',
+@click.option('--dest-creds', '--dcreds', 'dest_creds', metavar='USERNAME[:PASSWORD]',
               help='Use USERNAME[:PASSWORD] for accessing the destination registry')
 @click.option('--dest-tls-verify', type=bool, default=True,
               help=('require HTTPS and verify certificates when talking to the '
@@ -756,10 +756,11 @@ class Copier(object):
                     'destination registry'))
 @click.argument('src', metavar='SOURCE-IMAGE-NAME')
 @click.argument('dest', metavar='DEST-IMAGE-NAME')
-def copy(src, dest, screds, src_tls_verify, src_cert_dir, dcreds, dest_tls_verify, dest_cert_dir):
+def copy(src, dest, src_creds, src_tls_verify, src_cert_dir, dest_creds, dest_tls_verify,
+         dest_cert_dir):
     """Copy an image from one location to another."""
-    src = parse_spec(src, screds, src_tls_verify, src_cert_dir)
-    dest = parse_spec(dest, dcreds, dest_tls_verify, dest_cert_dir)
+    src = parse_spec(src, src_creds, src_tls_verify, src_cert_dir)
+    dest = parse_spec(dest, dest_creds, dest_tls_verify, dest_cert_dir)
 
     if src.registry != dest.registry:
         tempdir = tempfile.mkdtemp()
-- 
2.19.1