[snmp] Configure snmp docker hostname from config DB#2773
[snmp] Configure snmp docker hostname from config DB#2773qiluo-msft merged 2 commits intosonic-net:masterfrom
Conversation
Signed-off-by: Vitaliy Senchyshyn <[email protected]>
|
Could you clarify what is 'snmp CT'? |
dockers/docker-snmp-sv2/start.sh
Outdated
| HOSTNAME=`sonic-cfggen -d -v DEVICE_METADATA[\'localhost\'][\'hostname\']` | ||
|
|
||
| echo $HOSTNAME > /etc/hostname | ||
| hostname -F /etc/hostname |
There was a problem hiding this comment.
why not use hostname $HOSTNAME? #Closed
There was a problem hiding this comment.
why not use
hostname $HOSTNAME?
In this case /etc/hostname will contain the old hostname. #Closed
There was a problem hiding this comment.
@qiluo-msft Or you meant only this line: "hostname -F /etc/hostname"? If yes, this can be changed.
There was a problem hiding this comment.
| echo "# Config files managed by sonic-config-engine" > /var/sonic/config_status | ||
|
|
||
| CURRENT_HOSTNAME=`hostname` | ||
| HOSTNAME=`sonic-cfggen -d -v DEVICE_METADATA[\'localhost\'][\'hostname\']` |
There was a problem hiding this comment.
HOSTNAME [](start = 0, length = 8)
Will you handle command error or empty hostname cases? #Closed
There was a problem hiding this comment.
HOSTNAME [](start = 0, length = 8)
Will you handle command error or empty hostname cases?
Added validation. Please check.
Signed-off-by: Vitaliy Senchyshyn <[email protected]>
|
@qiluo-msft Could you please merge it? |
* [snmp] Configure snmp docker hostname from config DB * Fixed reviewer comments
| echo $HOSTNAME > /etc/hostname | ||
| hostname -F /etc/hostname | ||
|
|
||
| sed -i "/\s$CURRENT_HOSTNAME$/d" /etc/hosts |
There was a problem hiding this comment.
sed -i "/\s$CURRENT_HOSTNAME$/d" /etc/hosts [](start = 4, length = 43)
This line does not work inside docker container.
ref: http://blog.jonathanargentiero.com/docker-sed-cannot-rename-etcsedl8ysxl-device-or-resource-busy/
Could you double check and fix?
* [snmp] Configure snmp docker hostname from config DB * Fixed reviewer comments
…ic-net#2756)" (sonic-net#2773) This reverts commit 750e064. Reverts the PR sonic-net#2756 The fix added breaks the previously added workaround sonic-net#2626. Hence requesting to revert the fix. Once we find a proper solution for sonic-net#12361 we need to reintegrate this PR
Signed-off-by: Vitaliy Senchyshyn [email protected]
- What I did
Configure snmp docker hostname with the value received from the config DB in order to fix SNMP CT which failed because the "sonic" sysName was always received.
- How I did it
Configure snmp docker hostname in the same way as this is done in hostname-config.sh
- How to verify it
Run snmp CT and verify it will pass
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)