This commit is contained in:
Jonas Forsberg 2021-09-25 16:56:16 +02:00
parent 6638cda6fb
commit 3d2de6f4dd
2 changed files with 72 additions and 4 deletions

View File

@ -8,3 +8,14 @@ rmt:
- rmt-server-mirror.timer - rmt-server-mirror.timer
- rmt-server-sync.timer - rmt-server-sync.timer
- rmt-server-systems-scc-sync.timer - rmt-server-systems-scc-sync.timer
products:
-
name: SUSE Linux Enterprise Server 15 SP3 x86_64
id: 2140
-
name: SUSE Linux Enterprise High Performance Computing 15 SP3 x86_64
id: 2133
-
name: Containers Module 15 SP3 x86_64
id: 2157

View File

@ -12,6 +12,9 @@ Usage ${0##*/} [options..]
-N, --network configure network settings -N, --network configure network settings
-s, --salt run a masterless salt-call -s, --salt run a masterless salt-call
-y, --yes answer 'yes' on all questions -y, --yes answer 'yes' on all questions
--rmt-sync Sync database with SUSE Customer Center
--rmt-enable-products Enable all preconfigured repositories
--rmt-mirror Mirror repositories
EOF EOF
} }
@ -135,6 +138,41 @@ function configure_network(){
} }
function rmt_sync(){
new_log "Sync RMT Database with SUSE Customer Center"
if asktobreak; then
return
fi
sudo rmt-cli sync
}
function rmt_enable_products(){
new_log "Enable the following products in RMT?"
eval $(parse_yaml salt/pillars/rmt.sls "SALT_")
if [[ -f salt/pillars/local.sls ]];then
eval $(parse_yaml salt/pillars/local.sls "SALT_")
fi
for name in "${SALT_rmt_products__name[@]}"; do
echo " * $name"
done
if asktobreak; then
return
fi
sudo rmt-cli products enable "${SALT_rmt_products__id[*]}"
}
function rmt_mirror(){
new_log "Mirror all repositories"
if asktobreak; then
return
fi
sudo rmt-cli mirror all
}
######################### #########################
# #
# Main Script # Main Script
@ -146,6 +184,9 @@ ALL=true
SALT=false SALT=false
NETWORK=false NETWORK=false
ANSWER_YES=false ANSWER_YES=false
RMT_SYNC=false
RMT_MIRROR=false
RMT_ENABLE_PRODUCTS=false
while :; do while :; do
case ${1-noop} in case ${1-noop} in
@ -164,6 +205,18 @@ while :; do
-y|--yes) -y|--yes)
ANSWER_YES=true ANSWER_YES=true
;; ;;
--rmt-sync)
RMT_SYNC=true
ALL=false
;;
--rmt-mirror)
RMT_MIRROR=true
ALL=false
;;
--rmt-enable-products)
RMT_ENABLE_PRODUCTS=true
ALL=false
;;
--) #End of all options --) #End of all options
shift shift
break break
@ -184,6 +237,10 @@ done
[[ $ALL == true ]] || [[ $NETWORK == true ]] && configure_network [[ $ALL == true ]] || [[ $NETWORK == true ]] && configure_network
[[ $ALL == true ]] || [[ $SALT == true ]] && do_salt_call [[ $ALL == true ]] || [[ $SALT == true ]] && do_salt_call
[[ $ALL == true ]] || [[ $RMT_SYNC == true ]] && rmt_sync
[[ $ALL == true ]] || [[ $RMT_ENABLE_PRODUCTS == true ]] && rmt_enable_products
[[ $ALL == true ]] || [[ $RMT_MIRROR == true ]] && rmt_mirror
printf "\n DONE!!!!!!!\n" printf "\n DONE!!!!!!!\n"