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

[config]: Add hostname command to config CLI #669

Merged
merged 5 commits into from
Oct 3, 2019

Conversation

samaity
Copy link
Contributor

@samaity samaity commented Sep 25, 2019

Signed-off-by: Sangita Maity sangitamaity0211@gmail.com

- What I did
added new command change-hostname to config CLI so that the user can change the hostname on a SONiC device without traffic being impacted.

- How I did it
update "hostname" key to the "DEVICE_METADATA|localhost" field in config DB using sonic-cfggen and restart the hostname-config service.

- How to verify it

changed the hostname from csw06 to csw06-sonic

admin@csw06:~$ sudo config change-hostname csw06-sonic
Running command: service hostname-config restart
Please note loaded setting will be lost after system reboot. To preserve setting, run config save.


admin@csw06:~$ sudo config save -y
Running command: /usr/local/bin/sonic-cfggen -d --print-data > /etc/sonic/config_db.json


admin@csw06:~$ exit
logout
Connection to 172.x.x.x closed.


➜  ~ ssh admin@172.x.x.x
admin@172.x.x.x's password:
Linux csw06-sonic 4.9.0-9-amd64 #1 SMP Debian 4.9.168-1+deb9u3 (2015-12-19) x86_64
Unauthorized access and/or use are prohibited.
All access and/or use are subject to monitoring.


Help:    http://azure.github.io/SONiC/


Last login: Tue Sep 24 18:11:57 2019 from 172.x.x.x
admin@csw06-sonic:~$    -> **hostname got updated successfully**

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
Copy link
Contributor

@jleveque jleveque left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please simplify the command syntax from config change-hostname <new_hostname> to config hostname <new_hostname>

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
@samaity samaity changed the title [config]: Add change-hostname command to config CLI [config]: Add hostname command to config CLI Sep 25, 2019
@jleveque
Copy link
Contributor

Retest this please

@jleveque
Copy link
Contributor

Retest this please

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
@sonic-net sonic-net deleted a comment from jleveque Sep 27, 2019
@jleveque
Copy link
Contributor

jleveque commented Oct 1, 2019

Retest this please

2 similar comments
@jleveque
Copy link
Contributor

jleveque commented Oct 3, 2019

Retest this please

@jleveque
Copy link
Contributor

jleveque commented Oct 3, 2019

Retest this please

@jleveque jleveque merged commit 46f344e into sonic-net:master Oct 3, 2019
@samaity samaity deleted the change_hostname branch October 4, 2019 07:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants