Sha256: c9e87734c5cebea9b41b411bcb2aa7a654de3323e90c694528ed18e27b4569d3

Contents?: true

Size: 1005 Bytes

Versions: 79

Compression:

Stored size: 1005 Bytes

Contents

#! /bin/bash

DEST=<%= @upload_url %>
RH_USERNAME=<%= @rh_username %>

if [ -z "$FILES" ]
then
        FILES=./*.tar.gz
fi

if [ -n "$CER_PATH" ]
then
        AUTH_KEY="--cert"
        AUTH_VAL="$CER_PATH"
else
        if [ -z "$RH_USERNAME" ]
        then
                IFS= read -rp "Enter username: " RH_USERNAME
        fi

        if [ -z "$RH_PASSWORD" ]
        then
                IFS= read -rsp "Enter password: " RH_PASSWORD
        fi

        AUTH_KEY="-u"
        AUTH_VAL="\"$RH_USERNAME\":\"$RH_PASSWORD\""
fi

# /tmp/a b/x.pem
# curl --cert /tmp/a\ b/x.pem

SCRIPT_DIR=$(realpath "$(dirname "${BASH_SOURCE:-0}")")
DONE_DIR="$SCRIPT_DIR/done/"
mkdir -p $DONE_DIR

for f in $FILES
do
  curl -k -vvv -# --fail -F "file=@$f;type=application/vnd.redhat.qpc.tar+tgz" $DEST "$AUTH_KEY" "$AUTH_VAL"
  status=$?
  if [ $status -eq 0 ]; then
    mv $f $DONE_DIR
    echo "Done: $f"
  fi
done
echo "Uploaded files moved to done/ folder"

# return the error code from the curl command
exit $status

Version data entries

79 entries across 79 versions & 1 rubygems

Version Path
foreman_rh_cloud-11.0.3 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-9.0.59 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-11.0.2 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-11.0.1 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-11.0.0 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-9.0.58 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-10.0.2 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-9.0.57 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-10.0.1 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-9.0.56 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-9.0.55 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-9.0.54 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-9.0.53 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-9.0.52 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-8.0.52 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-9.0.51 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-8.0.51 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-7.0.48 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-7.0.47 lib/foreman_inventory_upload/scripts/uploader.sh.erb
foreman_rh_cloud-8.0.50 lib/foreman_inventory_upload/scripts/uploader.sh.erb