kitchen-vagrant icon indicating copy to clipboard operation
kitchen-vagrant copied to clipboard

Truncation of Windows host name

Open maltman111 opened this issue 7 years ago • 4 comments

I know this has already been asked but can the hostname length be increased? We are seeing truncation at 12 characters. Can the >= 12 at least be changed to > 12?

  # Truncates the length of `:vm_hostname` to 12 characters for
  # Windows-based operating systems.
  #
  # @api private
  def finalize_vm_hostname!
    string = config[:vm_hostname]

    if windows_os? && string.is_a?(String) && string.size >= 12
      config[:vm_hostname] = "#{string[0...10]}-#{string[-1]}"
    end
  end

Thanks

Matt

maltman111 avatar May 02 '18 21:05 maltman111

As https://github.com/test-kitchen/kitchen-vagrant/issues/333 the max is still 15, happy to review a PR for this one but at best anyone is only ever getting 15 cause that's all that is supported.

cheeseplus avatar May 02 '18 22:05 cheeseplus

Thank you. I may open a PR for this. My 12 character hostname always ends up like this

hostname12-4 (where - should be 3)

maltman111 avatar May 02 '18 22:05 maltman111

We're happy to look at it but the deeper question might be "why does it matter?" Probably just use a shorter hostname.

coderanger avatar May 02 '18 22:05 coderanger

We base a lot of builds off of the hostname. I know that isn't the best idea but at the moment, its what we got. Each character specifies where and what it is. All lower level environment boxes are exactly 12 characters.

maltman111 avatar May 02 '18 22:05 maltman111