Forum: Cfengine Help Subject: Re: Are case-insensitive classes possible? Author: zzamboni Link to topic: https://cfengine.com/forum/read.php?3,19067,19068#msg-19068
babudro Wrote: > One machine I can rename by > hand, but I can't check a thousand servers by > hand Well, but that's exactly what you have cfengine for, isn't it? Use cfengine itself for making the change on all machines as needed, and then you can use nice all-lowercase classes. Actually you said it yourself. Something like this should do the trick (untested): bundle agent normalize_hostname { vars: "lchostname" string => execresult("hostname | tr '[:upper:]' '[:lower:]'", "useshell"); classes: "hostname_is_lc" expression => strcmp("$(sys.fqdn)", "$(lchostname)"); commands: !hostname_is_lc:: "hostname $(lchostname)"; files: # Make the change permanent, add as needed for other versions of Unix/Linux # insert_lines and empty come from cfengine_stdlib.cf !hostname_is_lc.OpenBSD:: "/etc/myname" edit_line => insert_lines("$(lchostname)");, edit_defaults => empty; } _______________________________________________ Help-cfengine mailing list Help-cfengine@cfengine.org https://cfengine.org/mailman/listinfo/help-cfengine