Red Hat Bugzilla – Bug 1018510
nmcli: add support for getting and setting system hostname
Last modified: 2016-01-04 01:03:30 EST
nmcli should add a 'hostname' command to the 'general' or 'networking' category. How about the following?
# nmcli g hostname
# nmcli g hostname blah.it.com
Or something along those lines, using the nm_remote_settings_save_hostname() method in libnm-glib.
The code is up for a review in upstream branch jk/rh1018510-nmcli-hostname.
looks mostly good to me.
I pushed two minor fixups over your branch jk/rh1018510-nmcli-hostname.
patch looks good. Not sure about Thomas's autocompletion support for it... presumably if you are setting the name, you're setting it to something new, so it doesn't make sense to autocomplete from anything...
(In reply to Dan Winship from comment #4)
> patch looks good. Not sure about Thomas's autocompletion support for it...
> presumably if you are setting the name, you're setting it to something new,
> so it doesn't make sense to autocomplete from anything...
True, I was thinking that too. But the chances are, that the new name will be somewhat similar and/or that is has the same domain.
Pushed to upstream master:
ce370fa cli: add bash-completion for 'nmcli general hostname'
79ac1cf cli: add support for getting/setting hostname to nmcli (rh #1018510)
I think the completion may be useful. Otherwise we can adapt/remove it later.
[vbenes@svine ~]$ sudo nmcli general hostname prase
[vbenes@svine ~]$ cat /etc/hostname
This request was resolved in Red Hat Enterprise Linux 7.0.
Contact your manager or support representative in case you have further questions about the request.