Jack Lucas | ec3410a | 2020-05-18 18:23:38 -0400 | [diff] [blame^] | 1 | #!/bin/bash |
| 2 | # ============LICENSE_START======================================================= |
| 3 | # Copyright (c) 2018-2020 AT&T Intellectual Property. All rights reserved. |
| 4 | # ================================================================================ |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # ============LICENSE_END========================================================= |
| 17 | |
| 18 | # Pull plugin wagon files and type files from repo |
| 19 | # $1 is the DCAE repo URL - script assumes all files come from the |
| 20 | # same repo, but not necessarily same paths |
| 21 | # |
| 22 | set -x -e |
| 23 | |
| 24 | # Location in CM container where plugins/type files will be stored |
| 25 | # At deployment, CM script will look here to find plugins to upload |
| 26 | DEST=${DEST:-/opt/plugins} |
| 27 | |
| 28 | # Each line has a plugin wagon/type file pair, in the form |
| 29 | # /path/to/plugin/wagon|/path/to/type/file |
| 30 | PLUGINS=\ |
| 31 | "\ |
| 32 | /dcaepolicyplugin/2.4.0/dcaepolicyplugin-2.4.0-py27-none-linux_x86_64.wgn|/dcaepolicyplugin/2.4.0/dcaepolicyplugin_types.yaml \ |
| 33 | /relationshipplugin/1.1.0/relationshipplugin-1.1.0-py27-none-linux_x86_64.wgn|/relationshipplugin/1.1.0/relationshipplugin_types.yaml \ |
| 34 | /k8splugin/2.0.0/k8splugin-2.0.0-py27-none-linux_x86_64.wgn|/k8splugin/2.0.0/k8splugin_types.yaml \ |
| 35 | /k8splugin/3.0.0/k8splugin-3.0.0-py27-none-linux_x86_64.wgn|/k8splugin/3.0.0/k8splugin_types.yaml \ |
| 36 | /clamppolicyplugin/1.1.0/clamppolicyplugin-1.1.0-py27-none-linux_x86_64.wgn|/clamppolicyplugin/1.1.0/clamppolicyplugin_types.yaml \ |
| 37 | /dmaap/1.5.0/dmaap-1.5.0-py27-none-linux_x86_64.wgn|/dmaap/1.5.0/dmaap_types.yaml \ |
| 38 | /helm/4.2.0/helm-4.2.0-py27-none-linux_x86_64.wgn|/helm/4.2.0/helm_types.yaml \ |
| 39 | /pgaas/1.3.0/pgaas-1.3.0-py27-none-linux_x86_64.wgn|/pgaas/1.3.0/pgaas_types.yaml \ |
| 40 | /sshkeyshare/1.2.0/sshkeyshare-1.2.0-py27-none-linux_x86_64.wgn|/sshkeyshare/1.2.0/sshkeyshare_types.yaml |
| 41 | " |
| 42 | |
| 43 | mkdir -p ${DEST} |
| 44 | |
| 45 | for p in ${PLUGINS} |
| 46 | do |
| 47 | w=$(echo $p | cut -d '|' -f1) |
| 48 | t=$(echo $p | cut -d '|' -f2) |
| 49 | |
| 50 | # Put each wagon/type file pair into its own subdirectory |
| 51 | # This prevents name collisions which can happen because |
| 52 | # type files don't embed a version. |
| 53 | subdir=$(mktemp -d -t plugin-XXXXXXX --tmpdir=${DEST}) |
| 54 | |
| 55 | curl -Ss -L -f $1/$t >> ${subdir}/$(basename $t) |
| 56 | curl -Ss -L -f $1/$w >> ${subdir}/$(basename $w) |
| 57 | |
| 58 | done |
| 59 | |
| 60 | chown -R cfyuser:cfyuser ${DEST} |