summaryrefslogtreecommitdiffstats
path: root/cm-container/scripts/get-plugins.sh
diff options
context:
space:
mode:
authorJack Lucas <jflucas@research.att.com>2020-05-18 18:23:38 -0400
committerJack Lucas <jflucas@research.att.com>2020-06-12 09:39:23 -0400
commitec3410a8478bedba8a06efb02f1610c2ebfdf130 (patch)
tree59b8a007f1d76fc1b3a8eadc36825a5f28e1201d /cm-container/scripts/get-plugins.sh
parenta774ad9f309576a61db9689f5315f2577e507b25 (diff)
Move plugin upload to CM container
Issue-ID: DCAEGEN2-2236 Issue-ID: DCAEGEN2-1789 Signed-off-by: Jack Lucas <jflucas@research.att.com> Change-Id: Ibc4612dedbf73a17a237b88abe198add391b82de
Diffstat (limited to 'cm-container/scripts/get-plugins.sh')
-rwxr-xr-xcm-container/scripts/get-plugins.sh60
1 files changed, 60 insertions, 0 deletions
diff --git a/cm-container/scripts/get-plugins.sh b/cm-container/scripts/get-plugins.sh
new file mode 100755
index 0000000..7c2f353
--- /dev/null
+++ b/cm-container/scripts/get-plugins.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+# ============LICENSE_START=======================================================
+# Copyright (c) 2018-2020 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=========================================================
+
+# Pull plugin wagon files and type files from repo
+# $1 is the DCAE repo URL - script assumes all files come from the
+# same repo, but not necessarily same paths
+#
+set -x -e
+
+# Location in CM container where plugins/type files will be stored
+# At deployment, CM script will look here to find plugins to upload
+DEST=${DEST:-/opt/plugins}
+
+# Each line has a plugin wagon/type file pair, in the form
+# /path/to/plugin/wagon|/path/to/type/file
+PLUGINS=\
+"\
+/dcaepolicyplugin/2.4.0/dcaepolicyplugin-2.4.0-py27-none-linux_x86_64.wgn|/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml \
+/relationshipplugin/1.1.0/relationshipplugin-1.1.0-py27-none-linux_x86_64.wgn|/relationshipplugin/1.1.0/relationshipplugin_types.yaml \
+/k8splugin/2.0.0/k8splugin-2.0.0-py27-none-linux_x86_64.wgn|/k8splugin/2.0.0/k8splugin_types.yaml \
+/k8splugin/3.0.0/k8splugin-3.0.0-py27-none-linux_x86_64.wgn|/k8splugin/3.0.0/k8splugin_types.yaml \
+/clamppolicyplugin/1.1.0/clamppolicyplugin-1.1.0-py27-none-linux_x86_64.wgn|/clamppolicyplugin/1.1.0/clamppolicyplugin_types.yaml \
+/dmaap/1.5.0/dmaap-1.5.0-py27-none-linux_x86_64.wgn|/dmaap/1.5.0/dmaap_types.yaml \
+/helm/4.2.0/helm-4.2.0-py27-none-linux_x86_64.wgn|/helm/4.2.0/helm_types.yaml \
+/pgaas/1.3.0/pgaas-1.3.0-py27-none-linux_x86_64.wgn|/pgaas/1.3.0/pgaas_types.yaml \
+/sshkeyshare/1.2.0/sshkeyshare-1.2.0-py27-none-linux_x86_64.wgn|/sshkeyshare/1.2.0/sshkeyshare_types.yaml
+"
+
+mkdir -p ${DEST}
+
+for p in ${PLUGINS}
+do
+ w=$(echo $p | cut -d '|' -f1)
+ t=$(echo $p | cut -d '|' -f2)
+
+ # Put each wagon/type file pair into its own subdirectory
+ # This prevents name collisions which can happen because
+ # type files don't embed a version.
+ subdir=$(mktemp -d -t plugin-XXXXXXX --tmpdir=${DEST})
+
+ curl -Ss -L -f $1/$t >> ${subdir}/$(basename $t)
+ curl -Ss -L -f $1/$w >> ${subdir}/$(basename $w)
+
+done
+
+chown -R cfyuser:cfyuser ${DEST}