Module: Kitchen::Driver::Openstack::Config
- Included in:
- Kitchen::Driver::Openstack
- Defined in:
- lib/kitchen/driver/openstack/config.rb
Overview
Server naming and configuration helpers
Constant Summary collapse
- MAX_SERVER_NAME_LENGTH =
Longest server name OpenStack will accept without truncating.
Every other length in this file is derived from it, so the limit is actually maintained by the code rather than merely documented here.
63- PREFIX_SUFFIX_LENGTH =
Number of random characters appended to a user-supplied prefix.
8- MAX_PREFIX_LENGTH =
Longest user-supplied prefix that still leaves room for the separator and the random suffix.
MAX_SERVER_NAME_LENGTH - PREFIX_SUFFIX_LENGTH - 1
- NAME_INSTANCE_LENGTH =
Character budget for the instance name in a fully generated name.
15- NAME_USERNAME_LENGTH =
Character budget for the username in a fully generated name.
15- NAME_RANDOM_LENGTH =
Number of random characters in a fully generated name.
7- NAME_HOSTNAME_LENGTH =
Character budget for the hostname in a fully generated name.
Whatever is left once the other three components and the three separators are accounted for.
MAX_SERVER_NAME_LENGTH - NAME_INSTANCE_LENGTH - NAME_USERNAME_LENGTH - NAME_RANDOM_LENGTH - 3
Instance Method Summary collapse
-
#config_server_name ⇒ String
Sets
config[:server_name]unless the user already supplied one.
Instance Method Details
#config_server_name ⇒ String
Sets config[:server_name] unless the user already supplied one.
Called at the top of Kitchen::Driver::Openstack#create rather than
at config-finalize time so that the random suffix is generated once
per converge instead of once per kitchen invocation.
82 83 84 85 86 87 88 89 90 |
# File 'lib/kitchen/driver/openstack/config.rb', line 82 def config_server_name return config[:server_name] if config[:server_name] config[:server_name] = if config[:server_name_prefix] server_name_prefix(config[:server_name_prefix]) else default_name end end |