Sha256: 3fb7be175f1c9357c9700f12bb8c54e800b64eeb738247b391282a6b8cb0e5da
Contents?: true
Size: 968 Bytes
Versions: 11
Compression:
Stored size: 968 Bytes
Contents
module VagrantPlugins module OVirtProvider module Action # Setup name for domain and domain volumes. class SetNameOfDomain @@MAX_NAME_LENGTH = 64 def initialize(app, env) @app = app end def call(env) dir_name = env[:root_path].basename.to_s.dup.gsub(/[^-a-z0-9_]/i, "") timestamp = "_#{Time.now.to_f}" max_dir_name_length = dir_name.length-[(dir_name + timestamp).length-(@@MAX_NAME_LENGTH-1), 0].max env[:domain_name] = dir_name[0..max_dir_name_length] << timestamp # Check if the domain name is not already taken domain = OVirtProvider::Util::Collection.find_matching( env[:ovirt_compute].servers.all, env[:domain_name]) if domain != nil raise Vagrant::Errors::DomainNameExists, :domain_name => env[:domain_name] end @app.call(env) end end end end end
Version data entries
11 entries across 11 versions & 1 rubygems