Move the task exclusion check away from common.sh
[snf-image] / snf-image-helper / tasks / 50AssignHostname.in
index 8363dde..a944c49 100644 (file)
@@ -27,6 +27,9 @@
 set -e
 . "@commondir@/common.sh"
 
+# Check if the task should be prevented from running.
+check_if_excluded
+
 windows_hostname() {
     local target="$1"
     local password="$2"
@@ -56,14 +59,13 @@ linux_hostname() {
         redhat)
             sed -ie "s/HOSTNAME=.*$/HOSTNAME=$hostname/g" "$target/etc/sysconfig/network";;
         slackware|suse)
-        #local domain=$(sed -e 's/^[^\.]*//g' < /etc/HOSTNAME)
-        
-        # In slackware hostname and domain name are joined together. For now I
-        # will not retain the domain name.
-        
-        echo "$hostname" > "${target}/etc/HOSTNAME";;
-    gentoo)
-        sed -ie "s/\(\(HOSTNAME\)\|\(hostname\)\)=.*$/\1=\"$hostname\"/" "$target/etc/conf.d/hostname";;
+            #local domain=$(sed -e 's/^[^\.]*//g' < /etc/HOSTNAME)
+
+            # In slackware hostname and domain name are joined together. For now
+            # I will not retain the domain name.
+            echo "$hostname" > "${target}/etc/HOSTNAME";;
+        gentoo)
+            sed -ie "s/\(\(HOSTNAME\)\|\(hostname\)\)=.*$/\1=\"$hostname\"/" "$target/etc/conf.d/hostname";;
     esac
 
     # Some Linux distributions assign the hostname to 127.0.1.1 in order to be