2 # Copyright 2018-2019 AT&T Intellectual Property. All other rights reserved.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
20 OPENSTACK_CLI_IMAGE="${OPENSTACK_CLI_IMAGE:-docker.io/openstackhelm/heat:ocata}"
21 NAMESPACE="${NAMESPACE:-openstack}"
23 # Define Base Docker Command
24 base_docker_command=$(cat << EndOfCommand
25 sudo docker run -it --rm --net=host
26 -e http_proxy=${HTTP_PROXY}
27 -e https_proxy=${HTTPS_PROXY}
28 -e OS_AUTH_URL=${OS_AUTH_URL:-http://keystone.${NAMESPACE}.svc.cluster.local:80/v3}
29 -e OS_USERNAME=${OS_USERNAME:-admin}
30 -e OS_USER_DOMAIN_NAME=${OS_USER_DOMAIN_NAME:-default}
31 -e OS_PASSWORD=${OS_PASSWORD:-password123}
32 -e OS_PROJECT_DOMAIN_NAME=${OS_PROJECT_DOMAIN_NAME:-default}
33 -e OS_PROJECT_NAME=${OS_PROJECT_NAME:-admin}
34 -e OS_REGION_NAME=${OS_REGION_NAME:-RegionOne}
35 -e OS_IDENTITY_API_VERSION=${OS_IDENTITY_API_VERSION:-3}
41 # Warn about absolute references
42 if echo "$@" | grep ' /' ; then
43 echo "WARNING: Any absolute file references should start with /host/<path>/<filename> because openstack cli is running in a container" 1>&2
44 echo "WARNING: For example: 'openstack image create --file /host/tmp/ubuntu.img ubuntu' would create a new image with the file /tmp/ubuntu.img" 1>&2
47 # Execute OpenStack CLI
48 ${base_docker_command} ${OPENSTACK_CLI_IMAGE} ${COMMAND} $@