Add user-specified download path for lftools sign 04/11604/6
authorAnil Belur <abelur@linuxfoundation.org>
Fri, 29 Jun 2018 12:16:57 +0000 (22:16 +1000)
committerAnil Belur <abelur@linuxfoundation.org>
Mon, 9 Jul 2018 23:12:52 +0000 (09:12 +1000)
Add a user-specified download location for lftools sign
deploy-nexus command. The default download location
is "/tmp/gpg-signatures.*" where '*' is random generated
suffix added to a directory name returned by mkdtemp()

Projects like ODL require more than 5 GiB free space
which might not be available in the returned path
therefore we should allow the user to use an alternative
download path.

ex:

lftools sign deploy-nexus -d <path> <URL> <repo> <profile-id>

JIRA: RELENG-928
Change-Id: I960e6c2dd5b5311ec0551834c6b96a297a2eb8bd
Signed-off-by: Anil Belur <abelur@linuxfoundation.org>
lftools/cli/sign.py

index e93a70f..abb5038 100644 (file)
@@ -48,11 +48,15 @@ def nexus(ctx, nexus_repo_url):
 @click.argument('nexus-url', envvar='NEXUS_URL')
 @click.argument('nexus-repo', envvar='NEXUS_REPO')
 @click.argument('staging-profile-id', envvar='STAGING_PROFILE_ID')
+@click.option(
+    '-d', '--sign-dir', type=str,
+    default=tempfile.mkdtemp(prefix='gpg-signatures.'),
+    help='Local directory to clone repository. (default /tmp/gpg-signatures.*)')
 @click.option(
     '-r', '--root-domain', type=str, default='org',
     help='Root download path of staging repo. (default org)')
 @click.pass_context
-def deploy_nexus(ctx, nexus_url, nexus_repo, staging_profile_id, root_domain):
+def deploy_nexus(ctx, nexus_url, nexus_repo, staging_profile_id, sign_dir, root_domain):
     """Sign artifacts from a Nexus repo then upload to a staging repo.
 
     This is a porcelain command that ties the lftools sign and deploy tools
@@ -65,7 +69,6 @@ def deploy_nexus(ctx, nexus_url, nexus_repo, staging_profile_id, root_domain):
     # -r option.
     nexus_url = nexus_url.rstrip('/')
     nexus_repo_url = "{}/content/repositories/{}/{}".format(nexus_url, nexus_repo, root_domain)
-    sign_dir = tempfile.mkdtemp(prefix='gpg-signatures.')
 
     status = subprocess.call(['sign', 'nexus', '-d', sign_dir, nexus_repo_url])
     if status: