Created
October 6, 2011 16:48
-
-
Save rickychilcott/1267912 to your computer and use it in GitHub Desktop.
Fixing hostnames for MunkiServer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Computer.all.each{|c| | |
if c.hostname == "" | |
c.hostname = c.name | |
end | |
if !c.valid? | |
c.hostname.downcase! | |
c.hostname.strip! | |
c.hostname.sub! /[_\s]/, '-' | |
if c.save | |
puts c.name + " hostname fix completed" | |
else | |
puts c.name + " still needs to be fixed" | |
end | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment