Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Feb 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions dockers/docker-snmp-sv2/config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions src/sonic-config-engine/sonic-cfggen
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down