2 # Copyright 2021 Canonical Ltd.
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # 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, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
16 # For those usages not covered by the Apache License, Version 2.0 please
17 # contact: legal@canonical.com
19 # To get in touch with the maintainers, please contact:
20 # osm-charmers@lists.launchpad.net
23 MODULES
="lcm pol mon ro nbi"
26 PRIVATE_KEY
=${1:-$HOME/.ssh/id_rsa}
27 echo "Using $PRIVATE_KEY key."
28 [ -f $PRIVATE_KEY ] ||
(echo "$PRIVATE_KEY file does not exist" && exit 1)
29 PRIVATE_KEY_CONTENT
=`cat $PRIVATE_KEY`
31 mkdir
-p ~
/.ssh
/config.d
32 echo "" |
tee ~
/.ssh
/config.d
/osm
35 for module
in $MODULES; do
36 if [[ `juju config -m osm $module debug_mode` == "true" ]]; then
37 pod_name
=`microk8s.kubectl -n osm get pods | grep -E "^$module-" | grep -v operator | cut -d " " -f 1`
38 pod_ip
=`microk8s.kubectl -n osm get pods $pod_name -o yaml | yq e .status.podIP -`
42 # StrictHostKeyChecking no
43 IdentityFile $PRIVATE_KEY" |
tee -a ~
/.ssh
/config.d
/osm
48 import_osm_config
="Include config.d/osm"
50 grep "$import_osm_config" ~
/.ssh
/config ||
( echo -e "$import_osm_config\n$(cat ~/.ssh/config)" > ~
/.ssh
/config
)