Skip to content

Commit 95ad5c7

Browse files
authored
Fix the reference in docker-snmp-sv2 to deprecated alias_map.json (#320)
1 parent f087f13 commit 95ad5c7

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

dockers/docker-snmp-sv2/config.sh

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ mkdir -p /etc/snmp
88

99
sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /usr/share/sonic/templates/snmpd.conf.j2 >/etc/snmp/snmpd.conf
1010

11-
hwsku=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku`
12-
/bin/cp -rf /usr/share/sonic/$hwsku/alias_map.json /etc/snmp/
11+
sonic-cfggen -m /etc/sonic/minigraph.xml -s >/etc/snmp/alias_map.json
1312

1413
mkdir -p /var/sonic
1514
echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status

src/sonic-config-engine/sonic-cfggen

+8
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ def main():
5454
parser.add_argument("-a", "--additional-data", help="addition data, in json string")
5555
group = parser.add_mutually_exclusive_group()
5656
group.add_argument("-t", "--template", help="render the data with the template file")
57+
group.add_argument("-s", "--alias-mapping", help="print alias mapping json if available", action='store_true')
5758
group.add_argument("-v", "--var", help="print the value of a variable")
5859
group.add_argument("--var-json", help="print the value of a variable, in json format")
5960
group.add_argument("--var-keys", help="print all keys of a map variable")
@@ -101,6 +102,13 @@ def main():
101102
if args.var_keys != None:
102103
for key in data[args.var_keys].keys():
103104
print key
105+
106+
if args.alias_mapping != None:
107+
mapping = {}
108+
if data.has_key('alias_map'):
109+
for item in data['alias_map']:
110+
mapping[item['sonic']] = item['origin']
111+
print json.dumps(mapping)
104112

105113
if args.print_data:
106114
print data

0 commit comments

Comments
 (0)