Merge "Remove pkgbuilder help text from repomgr commands"
This commit is contained in:
commit
014a76a792
@ -71,20 +71,27 @@ class KubeHelper:
|
||||
else:
|
||||
return False
|
||||
|
||||
def generatePrefixCommand(self, podname, command, enableuser):
|
||||
def generatePrefixCommand(self, podname, command, enableuser, interactive=False):
|
||||
'''Generate the command executed in the host'''
|
||||
|
||||
prefix_exec_cmd = self.config.kubectl() + ' exec -ti '
|
||||
builder_exec_cmd = prefix_exec_cmd + podname
|
||||
prefix_bash_cmd = ' -- bash -l -c '
|
||||
prefix_bash_with_user_cmd = ' -- bash -l -c \'sudo -u ${MYUNAME} bash \
|
||||
prefix_bash_with_user_cmd = ' -- bash -l -c \'sudo -u ${MYUNAME} \
|
||||
BASH_ENV=/home/$MYUNAME/userenv bash --rcfile /home/$MYUNAME/userenv -c '
|
||||
prefix_bash_with_interactive_user_cmd = ' -- bash -l -i -c \'sudo -u ${MYUNAME} bash \
|
||||
--rcfile /home/$MYUNAME/userenv -i -c '
|
||||
builder_exec_bash_cmd = builder_exec_cmd + prefix_bash_cmd
|
||||
builder_exec_bash_with_user_cmd = builder_exec_cmd + \
|
||||
prefix_bash_with_user_cmd
|
||||
builder_exec_bash_with_interactive_user_cmd = builder_exec_cmd + \
|
||||
prefix_bash_with_interactive_user_cmd
|
||||
|
||||
if enableuser:
|
||||
cmd = builder_exec_bash_with_user_cmd + command
|
||||
if interactive:
|
||||
cmd = builder_exec_bash_with_interactive_user_cmd + command
|
||||
else:
|
||||
cmd = builder_exec_bash_with_user_cmd + command
|
||||
else:
|
||||
cmd = builder_exec_bash_cmd + command
|
||||
|
||||
|
@ -150,7 +150,7 @@ class HandleBuildTask:
|
||||
'***********************************')
|
||||
sys.exit(1)
|
||||
|
||||
prefix_cmd = self.k8s.generatePrefixCommand(podname, '', 1)
|
||||
prefix_cmd = self.k8s.generatePrefixCommand(podname, '', 1, 1)
|
||||
|
||||
if args.build_task == 'image':
|
||||
cmd = self.buildImageCMD(args, prefix_cmd)
|
||||
|
@ -127,12 +127,14 @@ image.\t\teg: [ prepare|layer|image|download|world|${pkgname}]')
|
||||
|
||||
repo_subparser = subparsers.add_parser('repomgr',
|
||||
help='Manage source|binary \
|
||||
packages.\t\teg: [ list|download|sync|mirror|clean|remove_repo|upload_pkg|\
|
||||
delete_pkg ]')
|
||||
packages.\t\teg: [ list|download|sync|merge|mirror|clean|\
|
||||
remove_repo|search_pkg|upload_pkg|delete_pkg ]')
|
||||
repo_subparser.add_argument('repomgr_task',
|
||||
help='[ list|download|sync|mirror|clean|\
|
||||
remove_repo|upload_pkg|delete_pkg ]: \
|
||||
help='[ list|download|sync|merge|mirror|clean|\
|
||||
remove_repo|search_pkg|upload_pkg|delete_pkg ]: \
|
||||
Execute the management task.\n\n')
|
||||
# Pass remaining arguements into repo_manage.py for additional processing
|
||||
repo_subparser.add_argument('args', nargs=argparse.REMAINDER)
|
||||
repo_subparser.set_defaults(handle=self.handlerepomgr.handleCommand)
|
||||
|
||||
parser.add_argument('-d', '--debug',
|
||||
|
@ -16,6 +16,7 @@ import logging
|
||||
from stx.k8s import KubeHelper
|
||||
from stx import utils # pylint: disable=E0611
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
logger = logging.getLogger('STX-Repomgr')
|
||||
utils.set_logger(logger)
|
||||
@ -38,12 +39,14 @@ class HandleRepomgrTask:
|
||||
logger.error('The builder container does not exist, so please \
|
||||
consider to use the control module')
|
||||
|
||||
prefix_cmd = self.k8s.generatePrefixCommand(podname, '', 1)
|
||||
cmd = prefix_cmd + '"repo_manage.py ' + args.repomgr_task + '"\''
|
||||
prefix_cmd = self.k8s.generatePrefixCommand(podname, '', 1, 0)
|
||||
cmd = prefix_cmd + ' '.join(['"repo_manage.py', args.repomgr_task, ' '.join(args.args), '"\''])
|
||||
logger.debug('Manage the repo with the command [%s]', cmd)
|
||||
|
||||
try:
|
||||
subprocess.check_call(cmd, shell=True)
|
||||
except subprocess.CalledProcessError as exc:
|
||||
raise Exception('Failed to manage the repo with the command [%s].\n \
|
||||
# raise Exception('Failed to manage the repo with the command [%s].\n \
|
||||
logger.error('Failed to manage the repo with the command [%s].\n \
|
||||
Returncode: %s' % (cmd, exc.returncode))
|
||||
sys.exit(2)
|
||||
|
@ -19,6 +19,7 @@ if [ ! -d $MY_WORKSPACE ]; then
|
||||
mkdir -p $MY_WORKSPACE > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
if echo $- | grep -q i ; then
|
||||
cat <<EOF
|
||||
To ease checkout do:
|
||||
!!!! Mandatory:
|
||||
@ -47,5 +48,5 @@ To make image:
|
||||
build-image [ -t std|rt ]
|
||||
|
||||
EOF
|
||||
|
||||
fi
|
||||
cd ${MY_WORKSPACE}
|
||||
|
Loading…
x
Reference in New Issue
Block a user