26 Commits

Author SHA1 Message Date
hashicorp-copywrite[bot]
36a312ee26
add missing license headers and update copyright file headers to BUS-1.1 2023-08-10 21:53:25 +01:00
sophia
b6aebeacae Use '-r' xargs argument
This will pervent running sed if there are no results
passed to xargs
2020-09-16 10:36:55 -05:00
sophia
7370f24318 Check for existence of network files before trying to update them 2020-09-14 11:10:52 -05:00
sophia
91ac0681cf Update RHEL cap for setting hostname 2020-07-20 15:19:50 -05:00
Chris Roberts
11b0d58fa0 Include communicator on call 2018-10-01 08:43:49 -07:00
Chris Roberts
1797798760 Fix module name 2018-09-28 07:59:39 -07:00
Chris Roberts
ff021fcab4 Update redhat change host name capability to support systemd
Update capability to use guest inspection module for determining
correct actions to execute. When systemd is in use restart the
correct active service, either NetworkManager or networkd. Default
to using the original service restart when systemd service is not
found.
2018-09-20 16:44:08 -07:00
Joe Doss
19aa9578c7 Exit 1 if we cannot set the hostname. 2018-09-20 15:28:37 -07:00
Joe Doss
c14a4a09f7 Switch if statements, check for systemctl, and switch to is-active. 2018-09-20 15:28:37 -07:00
Joe Doss
94954739b5 Simplified if statements. 2018-09-20 15:28:37 -07:00
Joe Doss
80006251f4 Add in logic to restart NetworkManager if it is enabled. 2018-09-20 15:28:36 -07:00
Chris Roberts
e62d71b645 Remove comment removal from /etc/hosts file on guests
Fixes: #7794
2017-04-20 17:07:56 -07:00
Michaël Faille
96611341a9 Revert "Fix service network restart on RHEL-7 / Fedora"
`/etc/init.d/network restart` already restart NM and shutdown interfaces.

In start() :
```
        if [ "$(LANG=C nmcli -t --fields running general status 2>/dev/null)" = "running" ]; then
                nmcli connection reload
        fi

```

In stop() :

```
       for i in $vpninterfaces $xdslinterfaces $bridgeinterfaces $vlaninterfaces $remaining; do
                unset DEVICE TYPE
                (. ./ifcfg-$i
                if [ -z "$DEVICE" ] ; then DEVICE="$i"; fi

                if ! check_device_down $DEVICE; then
                   action $"Shutting down interface $i: " ./ifdown $i boot
                   [ $? -ne 0 ] && rc=1
                fi
                )
        done
```
Where $remaining include all "others" interfaces including eth*

This reverts commit 166d10d4e16836e908be0bd94c2f671cac2b38b4.
2016-12-21 20:33:57 -05:00
Latchezar Tzvetkoff
166d10d4e1 Fix service network restart on RHEL-7 / Fedora
RHEL-7 / Current Fedora versions tend to use NetworkManager for
configuring the networks, and `service network restart` might fail.
If the `NetworkManager` service is running, we should restart it,
otherwise we try restarting `network`.
2016-11-29 15:40:48 +02:00
Seth Vargo
084d62b5a6
guests/fedora: Move as a child of redhat
Fedora should have been a child of redhat for awhile now...
2016-07-18 21:12:54 -04:00
Seth Vargo
cf91bcf029
guests: Always search for FQDN without sudo 2016-07-18 21:12:54 -04:00
Seth Vargo
b91c167b19
guests/redhat: Change host name in one command 2016-06-06 11:58:38 -04:00
Felix Gilcher
96b011b39e update /etc/hosts on rhel 7
the previous fix for #4465 assumed that the NetworkManager takes care of updating /etc/hosts with
the new hostname, but testing shows it doesn't. This change ensures that the change is always added
to /etc/hosts when the name changes.
2014-09-20 17:34:01 +02:00
keithchambers
1f93582131 Fixed typo: hostnamectl vs. homenamectl 2014-09-02 21:55:33 -07:00
Mitchell Hashimoto
41f4ec1e4d guests/redhat: set hostname on EL7 [GH-4352] 2014-08-31 09:58:12 -07:00
smoyer
3964298504 This was introduced in 1.4.1 with d26c147.
This PR sets the active hostname back to the name specified in the Vagrantfile (fqdn) and updates the unit tests.

Setting it to the short name causes loads of problems while configuring the system. I've had issues with sudoers hostname matching, Weblogic certificate generation and a few others. Even if I changed all of the Chef recipes, the fqdn is set in /etc/sysconfig/network so the active hostname will switch to the fqdn after a reboot.
2014-01-08 17:49:54 -05:00
Charlie Huggard
d26c1471d7 Refactor ChangeHostName for EL.
Based off of the Debian pattern. Need to add tests.

Related to #2653 and #2592
2013-12-16 01:52:39 -06:00
Mitchell Hashimoto
fc190fad9f guests/redhat: DHCP_HOSTNAME set to hostname [GH-2441] 2013-11-26 11:28:47 -08:00
François Charlier
c1228ae206 Allow to change the DHCP_HOSTNAME on RedHat 2013-09-24 23:48:10 +02:00
Mitchell Hashimoto
ba07d303e5 More robust hostname checking for RedHat [GH-1566] 2013-04-10 09:33:33 -07:00
Mitchell Hashimoto
5e09577a76 Lots more guest capabilities converted 2013-04-04 12:09:40 -07:00