# File lib/rudy/routines/handlers/host.rb, line 88 88: def set_hostname(rset) 89: raise NoMachines if rset.boxes.empty? 90: 91: # Set the hostname if specified in the machines config. 92: # :rudy -> change to Rudy's machine name 93: # :default -> leave the hostname as it is 94: # Anything else other than nil -> change to that value 95: # NOTE: This will set hostname every time a routine is 96: # run so we may want to make this an explicit action. 97: hntype = current_machine_hostname || :rudy 98: return if hntype.to_s.to_sym == :default 99: rset.batch do 100: unless self.stash.os == :windows 101: hn = hntype == :rudy ? self.stash.name : hntype 102: if self.user.to_s == 'root' # ubuntu has a root user 103: hostname hn 104: else 105: sudo do 106: hostname hn 107: end 108: end 109: end 110: end 111: end