#175 Add a switch to fkinit for the staging infra
Merged 2 years ago by mohanboddu. Opened 2 years ago by abompard.
abompard/fedora-packager fkinit-staging  into  main

file modified
+15 -3
@@ -2,6 +2,7 @@ 

  

  # Created by argbash-init v2.10.0

  # ARG_OPTIONAL_SINGLE([user],[u],[Fedora account name],[$USER])

+ # ARG_OPTIONAL_BOOLEAN([staging],[],[Use the staging infrastructure])

  # ARG_HELP([Acquire a Kerberos ticket-granting ticket for Fedora])

  # ARGBASH_GO()

  # needed because of Argbash --> m4_ignore([
@@ -28,13 +29,15 @@ 

  

  # THE DEFAULTS INITIALIZATION - OPTIONALS

  _arg_user="$USER"

+ _arg_staging="off"

  

  

  print_help()

  {

  	printf '%s\n' "Acquire a Kerberos ticket-granting ticket for Fedora"

- 	printf 'Usage: %s [-u|--user <arg>] [-h|--help]\n' "$0"

+ 	printf 'Usage: %s [-u|--user <arg>] [--(no-)staging] [-h|--help]\n' "$0"

  	printf '\t%s\n' "-u, --user: Fedora account name (default: '$USER')"

+ 	printf '\t%s\n' "--staging: Use the staging infrastructure (off by default)"

  	printf '\t%s\n' "-h, --help: Prints help"

  }

  
@@ -56,6 +59,9 @@ 

  			-u*)

  				_arg_user="${_key##-u}"

  				;;

+ 			--staging)

+ 				_arg_staging="on"

+ 				;;

  			-h|--help)

  				print_help

  				exit 0
@@ -89,10 +95,16 @@ 

  armorcache=$(mktemp)

  trap finalize EXIT

  

- kinit -n @FEDORAPROJECT.ORG -c FILE:$armorcache

+ if [ "$_arg_staging" == "on" ]; then

+     domain=STG.FEDORAPROJECT.ORG

+ else

+     domain=FEDORAPROJECT.ORG

+ fi

+ 

+ kinit -n @$domain -c FILE:$armorcache

  

  echo "Enter your password and OTP concatenated. (Ignore that the prompt is for only the token)"

- kinit -T FILE:$armorcache $_arg_user@FEDORAPROJECT.ORG

+ kinit -T FILE:$armorcache $_arg_user@$domain

  

  

  # ^^^  TERMINATE YOUR CODE BEFORE THE BOTTOM ARGBASH MARKER  ^^^

This commit adds a switch to the fkinit tool to use the staging infrastructure.

Looks good.

I wonder... how hard would it be to have a 'stg-fkinit' that defaults to stg like we have a 'stg-koji' ?

like fedpkg-stage ;-) ? I think it would be harder because of argbash here.

Pull-Request has been merged by mohanboddu

2 years ago
Metadata