File: agent_update-self_update_test_setup

package info (click to toggle)
waagent 2.12.0.2-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 8,780 kB
  • sloc: python: 55,011; xml: 3,325; sh: 1,183; makefile: 22
file content (77 lines) | stat: -rwxr-xr-x 2,355 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/usr/bin/env bash

# Microsoft Azure Linux Agent
#
# Copyright 2018 Microsoft Corporation
#
# 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.
#
# This script prepares the new agent and install it on the vm
#

set -euo pipefail

usage() (
    echo "Usage: agent_update-self_update_test_setup -p|--package <path> -v|--version <version>  -u|--update_to_latest_version <y|n>"
    exit 1
)

while [[ $# -gt 0 ]]; do
    case $1 in
        -p|--package)
            shift
            if [ "$#" -lt 1 ]; then
                usage
            fi
            package=$1
            shift
            ;;
        -v|--version)
            shift
            if [ "$#" -lt 1 ]; then
                usage
            fi
            version=$1
            shift
            ;;
        -u|--update_to_latest_version)
            shift
            if [ "$#" -lt 1 ]; then
                usage
            fi
            update_to_latest_version=$1
            shift
            ;;
        *)
            usage
    esac
done
if [ "$#" -ne 0 ] || [ -z ${package+x} ] || [ -z ${version+x} ]; then
    usage
fi

echo "updating the related to self-update flags"
update-waagent-conf AutoUpdate.UpdateToLatestVersion=$update_to_latest_version AutoUpdate.GAFamily=Test Debug.EnableGAVersioning=n Debug.SelfUpdateHotfixFrequency=120 Debug.SelfUpdateRegularFrequency=120 Autoupdate.Frequency=120
agent-service stop
mv /var/log/waagent.log /var/log/waagent.$(date --iso-8601=seconds).log

# Some distros may pre-install higher version than custom version that test installs, so we need to lower the version to install custom version
agent_update-modify_agent_version 2.2.53

echo "Cleaning up the existing agents"
rm -rf /var/lib/waagent/WALinuxAgent-*

echo "Installing $package as version $version..."
unzip.py $package /var/lib/waagent/WALinuxAgent-$version
agent-service restart