-
Notifications
You must be signed in to change notification settings - Fork 0
/
os_upgrade
56 lines (51 loc) · 1.66 KB
/
os_upgrade
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
reachable -n <node>
if <error>
stop
log -m "Node is not reachable"
endif
<os_file> = os_files -v <Vendor_type> -t <Node_model>
<%os_image> := os_image_select -v <vendor_type> -t <Node_model>
<os_version> = <Os_version%os_image>
<os_path> = <Os_path%os_image>
<%os_file> := os_file_select -v <Vendor_type> -n <os_file>
<md5_netyce_file> = <File_crc%os_file>
<File_size> = <File_size%os_file>
# Verify the current OS version
<%cmd1> = parse_cmd -n <node> -r "show version | i Version" -t software_version
<s_w> = <s_w%cmd1>
if <s_w> == <os_version>
log -m "OS is already upgraded, aborting the job"
stop
endif
# Verify if the file exists
<%cmd2> = parse_cmd -n <node> -r "dir | i <os_file>" -t parse_file_exists
<file_name2> = <f%cmd2>
if <file_name2> == <os_file>
log -m "File already exists.. skipping copying, proceeding with md5 check"
else
# check for free size
<%cmd1> = Parse_cmd -n <node> -r "dir | i free" -t free_disk_space
<free_space> = <free%cmd1>
if <free_space> < <File_size>
log -m "Disk space is not sufficient"
stop
endif
# Transferring the file
log -m "Disk space is sufficient.. copying the file.."
<source> = "/var/opt/shared/public/os/<Vendor_type>/<os_file>"
file_get -n <node> -s <source> -t <os_file>
if <error>
log -m "Error while copying the file"
endif
# copy the file
endif
<%cmd2> = Parse_cmd -n <node> -r "verify /md5 <os_path><os_file>" -t md5_check
<md5_switch_file> = <md5%cmd2>
if <md5_netyce_file> == <md5_switch_file>
log -m "MD5 verified"
else
log -m "MD5 verification failed, aborting the job"
stop
endif
#Cmd_exec_basic -n <node> -a <node_addr> -v <vendor_type> -d <domain> -f <node>.cmd <verbose>
`