Merge "[GENERAL] Add Andreas Geissler as committer."
[oom/offline-installer.git] / patches / update_policy.sh
1 #!/usr/bin/env  bash
2
3 set -xe
4 NAMESPACE=$1
5 DROOLS_POD=`kubectl -n ${NAMESPACE} get pods | grep drools | awk {'print $1'}`
6 DST_BASE="/home/policy/.m2/repository/org/onap"
7
8 # WA to clean wrong _remote.repositories
9 # this/original version of files will prevent maven to find missing dependencies
10 # its not an issue in online lab and those files are updated when poms are collected from internet
11 kubectl -n ${NAMESPACE} exec -it ${DROOLS_POD} -- bash -c "rm -f $DST_BASE/policy/drools-applications/controlloop/common/common/1.5.3/_remote.repositories"
12 kubectl -n ${NAMESPACE} exec -it ${DROOLS_POD} -- bash -c "rm -f $DST_BASE/policy/drools-applications/controlloop/common/controller-usecases/1.5.3/_remote.repositories"
13 kubectl -n ${NAMESPACE} exec -it ${DROOLS_POD} -- bash -c "rm -f $DST_BASE/policy/drools-applications/controlloop/common/database/1.5.3/_remote.repositories"
14 kubectl -n ${NAMESPACE} exec -it ${DROOLS_POD} -- bash -c "rm -f $DST_BASE/policy/drools-applications/controlloop/common/eventmanager/1.5.3/_remote.repositories"
15 kubectl -n ${NAMESPACE} exec -it ${DROOLS_POD} -- bash -c "rm -f $DST_BASE/policy/drools-applications/controlloop/common/guard/1.5.3/_remote.repositories"
16 kubectl -n ${NAMESPACE} exec -it ${DROOLS_POD} -- bash -c "rm -f $DST_BASE/policy/drools-applications/controlloop/controlloop/1.5.3/_remote.repositories"
17 kubectl -n ${NAMESPACE} exec -it ${DROOLS_POD} -- bash -c "rm -f $DST_BASE/policy/drools-applications/drools-applications/1.5.3/_remote.repositories"
18
19 # this part is for patching POLICY-2191
20
21 patch_pom() {
22     pom_name=$1
23     dst_path=$2
24
25     kubectl -n ${NAMESPACE} exec -it ${DROOLS_POD} -- bash -c "rm -f ${dst_path}/_remote.repositories;mkdir -p ${dst_path}"
26     kubectl -n ${NAMESPACE} cp ./POLICY-2191/${pom_name} ${DROOLS_POD}:${dst_path}/${pom_name}
27     kubectl -n ${NAMESPACE} cp ./POLICY-2191/${pom_name}.sha1 ${DROOLS_POD}:${dst_path}/${pom_name}.sha1
28 }
29
30 # patch 48 files in drools
31 patch_pom aaf-auth-client-2.1.2.pom ${DST_BASE}/aaf/authz/aaf-auth-client/2.1.2
32 patch_pom aaf-cadi-aaf-2.1.2.pom ${DST_BASE}/aaf/authz/aaf-cadi-aaf/2.1.2
33 patch_pom aaf-cadi-client-2.1.2.pom ${DST_BASE}/aaf/authz/aaf-cadi-client/2.1.2
34 patch_pom aaf-cadi-core-2.1.2.pom ${DST_BASE}/aaf/authz/aaf-cadi-core/2.1.2
35 patch_pom aaf-misc-env-2.1.2.pom ${DST_BASE}/aaf/authz/aaf-misc-env/2.1.2
36 patch_pom aaf-misc-rosetta-2.1.2.pom ${DST_BASE}/aaf/authz/aaf-misc-rosetta/2.1.2
37 patch_pom cadiparent-2.1.2.pom ${DST_BASE}/aaf/authz/cadiparent/2.1.2
38 patch_pom miscparent-2.1.2.pom ${DST_BASE}/aaf/authz/miscparent/2.1.2
39 patch_pom parent-2.1.2.pom ${DST_BASE}/aaf/authz/parent/2.1.2
40 patch_pom dmaapClient-1.1.9.pom ${DST_BASE}/dmaap/messagerouter/dmaapclient/dmaapClient/1.1.9
41 patch_pom dependencies-1.2.1.pom ${DST_BASE}/oparent/dependencies/1.2.1
42 patch_pom oparent-1.2.1.pom ${DST_BASE}/oparent/oparent/1.2.1
43 patch_pom version-1.2.1.pom ${DST_BASE}/oparent/version/1.2.1
44 patch_pom common-parameters-1.5.2.pom ${DST_BASE}/policy/common/common-parameters/1.5.2
45 patch_pom policy-endpoints-1.5.2.pom ${DST_BASE}/policy/common/policy-endpoints/1.5.2
46 patch_pom drools-pdp-1.5.2.pom ${DST_BASE}/policy/drools-pdp/drools-pdp/1.5.2
47 patch_pom policy-core-1.5.2.pom ${DST_BASE}/policy/drools-pdp/policy-core/1.5.2
48 patch_pom policy-management-1.5.2.pom ${DST_BASE}/policy/drools-pdp/policy-management/1.5.2
49 patch_pom policy-utils-1.5.2.pom ${DST_BASE}/policy/drools-pdp/policy-utils/1.5.2
50 patch_pom policy-models-base-2.1.3.pom ${DST_BASE}/policy/models/policy-models-base/2.1.3
51 patch_pom policy-models-dao-2.1.3.pom ${DST_BASE}/policy/models/policy-models-dao/2.1.3
52 patch_pom policy-models-examples-2.1.3.pom ${DST_BASE}/policy/models/policy-models-examples/2.1.3
53 patch_pom policy-models-pdp-2.1.3.pom ${DST_BASE}/policy/models/policy-models-pdp/2.1.3
54 patch_pom policy-models-tosca-2.1.3.pom ${DST_BASE}/policy/models/policy-models-tosca/2.1.3/
55
56 # restart policy
57 kubectl -n ${NAMESPACE} exec -it ${DROOLS_POD} -- bash -c '/opt/app/policy/bin/policy stop;/opt/app/policy/bin/policy start'