vagrant-hosts 2.4.0 → 2.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/CHANGELOG +9 -0
- data/lib/vagrant-hosts/cap/sync_hosts/windows.rb +62 -0
- data/lib/vagrant-hosts/version.rb +1 -1
- metadata +9 -12
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 802263ab44d128add4e915e7a5ebaf01a67c547c
|
4
|
+
data.tar.gz: ab286d7e0b2d74f1b951169ae255cc5922ab1cbc
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5cafc5418e59b07c379d1f227651c42bbac05418cdbbb4bf909ca853b7b87ac6f17f5630b99039f0a76e7b550cfebc81ef71ffad69645128657275e89014fe5a
|
7
|
+
data.tar.gz: 5c47aa690303b42436d1bf432e0f2060ed09ae53a3562e305881c44655446c7ce827233388ca19b13ae4092e5623464ef961788cfbfda642b280a2e7f07d5df8
|
data/CHANGELOG
CHANGED
@@ -19,4 +19,66 @@ class VagrantHosts::Cap::SyncHosts::Windows < VagrantHosts::Cap::SyncHosts::Base
|
|
19
19
|
@machine.communicate.sudo(script.join("; "))
|
20
20
|
end
|
21
21
|
|
22
|
+
# Windows needs a modification of the base method because Windows guest names
|
23
|
+
# cannot be fully-qualified domain names (they cannot contain the "."
|
24
|
+
# character). Therefore, modify the input name to convert illegal characters
|
25
|
+
# to legal replacements.
|
26
|
+
#
|
27
|
+
# @param name [String] The new hostname to apply on the guest
|
28
|
+
def change_host_name(name)
|
29
|
+
|
30
|
+
# First set the machine name (hostname)
|
31
|
+
components = name.split('.')
|
32
|
+
hostname = components.first
|
33
|
+
domainname = components.slice(1, components.size).join('.')
|
34
|
+
|
35
|
+
super(hostname)
|
36
|
+
|
37
|
+
# Next set the Primary DNS Suffix, if it makes sense (domainname)
|
38
|
+
unless domainname.empty?
|
39
|
+
change_domain_name(domainname)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
def change_domain_name(domainname)
|
44
|
+
# Source: http://poshcode.org/2958
|
45
|
+
# Note that whitespace is important in this inline powershell script due
|
46
|
+
# to the use of a here-string.
|
47
|
+
powershell = <<-END_OF_POWERSHELL
|
48
|
+
function Set-PrimaryDnsSuffix {
|
49
|
+
param ([string] $Suffix)
|
50
|
+
|
51
|
+
# http://msdn.microsoft.com/en-us/library/ms724224(v=vs.85).aspx
|
52
|
+
$ComputerNamePhysicalDnsDomain = 6
|
53
|
+
|
54
|
+
Add-Type -TypeDefinition @"
|
55
|
+
using System;
|
56
|
+
using System.Runtime.InteropServices;
|
57
|
+
|
58
|
+
namespace ComputerSystem {
|
59
|
+
public class Identification {
|
60
|
+
[DllImport("kernel32.dll", CharSet = CharSet.Auto)]
|
61
|
+
static extern bool SetComputerNameEx(int NameType, string lpBuffer);
|
62
|
+
|
63
|
+
public static bool SetPrimaryDnsSuffix(string suffix) {
|
64
|
+
try {
|
65
|
+
return SetComputerNameEx($ComputerNamePhysicalDnsDomain, suffix);
|
66
|
+
}
|
67
|
+
catch (Exception) {
|
68
|
+
return false;
|
69
|
+
}
|
70
|
+
}
|
71
|
+
}
|
72
|
+
}
|
73
|
+
"@
|
74
|
+
[ComputerSystem.Identification]::SetPrimaryDnsSuffix($Suffix)
|
75
|
+
}
|
76
|
+
|
77
|
+
$success = Set-PrimaryDnsSuffix "#{domainname}"
|
78
|
+
if ($success -eq $True) {exit 0} else {exit 1}
|
79
|
+
END_OF_POWERSHELL
|
80
|
+
|
81
|
+
@machine.communicate.sudo(powershell)
|
82
|
+
end
|
83
|
+
|
22
84
|
end
|
metadata
CHANGED
@@ -1,19 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-hosts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
5
|
-
prerelease:
|
4
|
+
version: 2.5.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Adrien Thebo
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2015-
|
11
|
+
date: 2015-07-16 00:00:00.000000000 Z
|
13
12
|
dependencies: []
|
14
|
-
description:
|
15
|
-
|
16
|
-
'
|
13
|
+
description: |2
|
14
|
+
Manage static DNS entries and configuration for Vagrant guests.
|
17
15
|
email: adrien@somethingsinistral.net
|
18
16
|
executables: []
|
19
17
|
extensions: []
|
@@ -42,27 +40,26 @@ files:
|
|
42
40
|
homepage: https://github.com/adrienthebo/vagrant-hosts
|
43
41
|
licenses:
|
44
42
|
- Apache 2.0
|
43
|
+
metadata: {}
|
45
44
|
post_install_message:
|
46
45
|
rdoc_options: []
|
47
46
|
require_paths:
|
48
47
|
- lib
|
49
48
|
required_ruby_version: !ruby/object:Gem::Requirement
|
50
|
-
none: false
|
51
49
|
requirements:
|
52
|
-
- -
|
50
|
+
- - ">="
|
53
51
|
- !ruby/object:Gem::Version
|
54
52
|
version: '0'
|
55
53
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
56
|
-
none: false
|
57
54
|
requirements:
|
58
|
-
- -
|
55
|
+
- - ">="
|
59
56
|
- !ruby/object:Gem::Version
|
60
57
|
version: '0'
|
61
58
|
requirements: []
|
62
59
|
rubyforge_project:
|
63
|
-
rubygems_version:
|
60
|
+
rubygems_version: 2.4.3
|
64
61
|
signing_key:
|
65
|
-
specification_version:
|
62
|
+
specification_version: 4
|
66
63
|
summary: Manage static DNS on vagrant guests
|
67
64
|
test_files: []
|
68
65
|
has_rdoc: true
|