Fix the reference in docker-snmp-sv2 to deprecated alias_map.json (#320)

This commit is contained in:
Taoyu Li 2017-02-22 14:28:37 -08:00 committed by GitHub
parent f087f1317b
commit 95ad5c79fd
2 changed files with 9 additions and 2 deletions

View File

@ -8,8 +8,7 @@ mkdir -p /etc/snmp
sonic-cfggen -m /etc/sonic/minigraph.xml -y /etc/sonic/snmp.yml -t /usr/share/sonic/templates/snmpd.conf.j2 >/etc/snmp/snmpd.conf
hwsku=`sonic-cfggen -m /etc/sonic/minigraph.xml -v minigraph_hwsku`
/bin/cp -rf /usr/share/sonic/$hwsku/alias_map.json /etc/snmp/
sonic-cfggen -m /etc/sonic/minigraph.xml -s >/etc/snmp/alias_map.json
mkdir -p /var/sonic
echo "# Config files managed by sonic-config-engine" >/var/sonic/config_status

View File

@ -54,6 +54,7 @@ def main():
parser.add_argument("-a", "--additional-data", help="addition data, in json string")
group = parser.add_mutually_exclusive_group()
group.add_argument("-t", "--template", help="render the data with the template file")
group.add_argument("-s", "--alias-mapping", help="print alias mapping json if available", action='store_true')
group.add_argument("-v", "--var", help="print the value of a variable")
group.add_argument("--var-json", help="print the value of a variable, in json format")
group.add_argument("--var-keys", help="print all keys of a map variable")
@ -101,6 +102,13 @@ def main():
if args.var_keys != None:
for key in data[args.var_keys].keys():
print key
if args.alias_mapping != None:
mapping = {}
if data.has_key('alias_map'):
for item in data['alias_map']:
mapping[item['sonic']] = item['origin']
print json.dumps(mapping)
if args.print_data:
print data