vagrant-vmm 1.0.1 → 1.0.2

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 CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- Mzc2YWEyODVmYjBiNWM4NmUyNWYxM2QxZmU1NmU2MThiMjdmOTc1Mg==
4
+ MjlhNDAyOWQxODFjZWY5NTI3YjMyNDgzZjhjMDNjOTA3YTVjODEzNw==
5
5
  data.tar.gz: !binary |-
6
- Y2FjNGM3N2ViYWIwN2Y2NjYwNzU5YmMyZWY3MDI4ZWZkOTk4NWUzYQ==
6
+ ZWUxZDA3NzAxMzY5YTJlZjEzMmUxMGI1YjE3YzY1M2NmYmY4MDYxYg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjBiMzMyODk5NTY4ODJjYTU2YThiZmQwOGIwMmUzYmFiMTQ4ZWRhZDRiOTVl
10
- Mzc0NDdiODE3MmIwZDRhYTQ3MWMwNDYyZmNmMTk1MmVkNDEwN2JhODk2NTVj
11
- NGE2NmFjNjU0YzAyYzBhOTNhZTFhNzhmOTQ3NDk1MjMyNmJmZTM=
9
+ MTk3ZGU0MThlNTUxZDYzNTMzN2FkMWZiYzVkNTAwNTgzOTAxMTVmNGMzM2Iz
10
+ YzNkMGE2MzM1ZDQwNzRjYTEwNWNiYTQ2NGE1NjE2NzM5OTk3MjdmMTg0NzBi
11
+ MTExY2U2YmNiZTI1YTJlMDRlNWUwNjU3ZjcxOTgyN2M1NDAzOGE=
12
12
  data.tar.gz: !binary |-
13
- MTk1Mjk5ZTI2MjM0M2NiYzRjYTY5M2JiZTZlYWM0YzU1ZjBhMTA5NTgwMWM5
14
- ZDk2Zjk0MTZlOTBhNTNhYTEzN2ExNWY4YjYyZjlkOTkyZTVlMDk4MjA2NTdh
15
- NWQ5ZjM3MTA1MTViZWUzNjhhNTgzNzFkYWI5ZTY0YmU0OWUyN2E=
13
+ Mjc3OGY1NmI0ZjZhYTNiZTE1OGY4MDk1Y2E1ODlmNjU2MGY4YTBjNmI0NTA5
14
+ NzU1YTRmMGI0OTk2NGU4NGRkMThmNGI1OTAyNmMyYTlkYWIzNDAwMTI5NDdm
15
+ MjcxNDRkODFjOTE0YmZhOTAyMjVmNmFhMDU2NzI5ZmYzNGE4M2E=
data/README.md CHANGED
@@ -2,8 +2,6 @@ Travis CI: [![Build Status](https://travis-ci.org/jarig/vagrant-vmm.svg?branch=m
2
2
 
3
3
  # Vagrant Virtual Machine Manager (VMM) Plugin
4
4
 
5
- **UNDER DEVELOPMENT**
6
-
7
5
  Vagrant is a tool for building and distributing development environments.
8
6
 
9
7
  This provider will allow you to create VMs in the remote Virtual Machine Manager.
@@ -100,17 +98,21 @@ conf.proxy_server_address = 'my-proxy-to-vmm'
100
98
 
101
99
  Check that winrm is configured properly in the VM, if default username is used (vagrant/vagrant) then ensure that winrm accepts unencrypted connection and Basic auth.
102
100
 
103
- Enable basic auth (in VM)
101
+ Enable basic auth and unencrypted connection (in VM).
104
102
  ```
103
+ In elevated cmd
105
104
  winrm set winrm/config/service/auth @{Basic="true"}
105
+ winrm set winrm/config/service @{AllowUnencrypted="true"}
106
106
  ```
107
107
 
108
- Allow unencrypted connection (in VM)
108
+ ### Unencrypted traffic is currently disabled in the client configuration
109
+
110
+ Run following command on your machine as well:
109
111
  ```
112
+ In elevated cmd
110
113
  winrm set winrm/config/service @{AllowUnencrypted="true"}
111
114
  ```
112
115
 
113
-
114
116
  ## Contributing
115
117
 
116
118
  1. Fork it ( https://github.com/jarig/vagrant-vmm/fork )
@@ -13,10 +13,12 @@ module VagrantPlugins
13
13
  vmm_server_address: vmm_server_address,
14
14
  proxy_server_address: env[:machine].provider_config.proxy_server_address
15
15
  }
16
+
16
17
  env[:ui].info("Deleting the machine...")
17
18
  env[:machine].provider.driver.delete_vm(options)
18
19
  env[:machine].provider.reset_state
19
-
20
+ env[:ui].info("Machine removed.")
21
+
20
22
  @app.call(env)
21
23
  end
22
24
  end
@@ -66,16 +66,6 @@ if ( $address_to_use -ne $null )
66
66
  $ip = Read-Host 'Enter VM IP address:'
67
67
  }
68
68
 
69
- if ( $address_to_use -as [ipaddress] )
70
- {
71
- $trusted_hosts = get-item wsman:\localhost\Client\TrustedHosts
72
- if ( !$trusted_hosts.Value.Contains($address_to_use) )
73
- {
74
- Write-host "Adding $address_to_use to trusted host list"
75
- $new_th_values = "$($trusted_hosts.Value),$address_to_use"
76
- set-item wsman:\localhost\Client\TrustedHosts $new_th_values -Force
77
- }
78
- }
79
69
 
80
70
  $resultHash = @{
81
71
  address = $address_to_use
@@ -29,6 +29,17 @@ $Dir = Split-Path $script:MyInvocation.MyCommand.Path
29
29
  # convert from json to ps object
30
30
  $folders_to_sync_obj = ConvertFrom-Json $folders_to_sync
31
31
  $delimiter = " || "
32
+ $creds_to_vm = Get-Creds $vm_address "Credentials for access to the VM ($vm_address) via WinRM" $winrm_vm_username $winrm_vm_password
33
+
34
+ # add to trusted hosts
35
+ $trusted_hosts = get-item wsman:\localhost\Client\TrustedHosts
36
+ if ( !$trusted_hosts.Value.Contains($vm_address) )
37
+ {
38
+ Write-host "Adding $vm_address to trusted host list"
39
+ $new_th_values = "$($trusted_hosts.Value),$vm_address"
40
+ set-item wsman:\localhost\Client\TrustedHosts $new_th_values -Force
41
+ }
42
+
32
43
 
33
44
  function Get-file-hash($source_paths, $delimiter) {
34
45
  $source_files = @{}
@@ -63,21 +74,20 @@ function Get-remote-file-hash($source_paths, $delimiter, $session) {
63
74
  return Invoke-Command -Session $session -ScriptBlock ${function:Get-file-hash} -ArgumentList $source_paths, $delimiter
64
75
  }
65
76
 
66
- $trusted_hosts = get-item wsman:\localhost\Client\TrustedHosts
67
- if ( !$trusted_hosts.Value.Contains($vm_address) )
68
- {
69
- Write-host "Adding $vm_address to trusted host list"
70
- $new_th_values = "$($trusted_hosts.Value),$vm_address"
71
- set-item wsman:\localhost\Client\TrustedHosts $new_th_values -Force
72
- }
73
-
74
- $creds_to_vm = Get-Creds $vm_address "Credentials for access to the VM ($vm_address) via WinRM" $winrm_vm_username $winrm_vm_password
75
- $auth_method = "default"
76
- if ( !$creds_to_vm.UserName.contains("\") -and !$creds_to_vm.UserName.contains("@") )
77
- {
78
- $auth_method = "basic"
77
+ function Get-session {
78
+ $session = $script:session
79
+ if ( !$session -or $session.State.ToString() -ne "Opened" )
80
+ {
81
+ $auth_method = "default"
82
+ if ( !$creds_to_vm.UserName.contains("\") -and !$creds_to_vm.UserName.contains("@") )
83
+ {
84
+ $auth_method = "basic"
85
+ }
86
+ $session = New-PSSession -ComputerName $vm_address -Credential $creds_to_vm -Authentication $auth_method
87
+ $script:session = $session
88
+ }
89
+ return $script:session
79
90
  }
80
- $session = New-PSSession -ComputerName $vm_address -Credential $creds_to_vm -Authentication $auth_method
81
91
 
82
92
  # Compare source and destination files
83
93
  $remove_files = @{}
@@ -92,7 +102,7 @@ foreach ( $hst_path in $folders_to_sync_obj.psobject.properties.Name )
92
102
  }
93
103
 
94
104
  $source_files = Get-file-hash $folder_mappings.Keys $delimiter
95
- $destination_files = Get-remote-file-hash $folder_mappings.Values $delimiter $session
105
+ $destination_files = Get-remote-file-hash $folder_mappings.Values $delimiter $(Get-session)
96
106
  if (!$destination_files) {
97
107
  $destination_files = @{}
98
108
  }
@@ -116,7 +126,7 @@ foreach ( $hst_path in $folder_mappings.Keys )
116
126
  }
117
127
 
118
128
  # create file share on the remote machine
119
- Invoke-Command -Session $session -ScriptBlock {
129
+ Invoke-Command -Session $(Get-session) -ScriptBlock {
120
130
  $fileshare_dest = "$($env:SystemDrive)\vagrant-sync"
121
131
  if (Test-path $fileshare_dest)
122
132
  {
@@ -164,7 +174,7 @@ foreach ( $hst_path in $copy_files.Keys)
164
174
 
165
175
  # copy from fileshare to the dest locations on the remote machine
166
176
  # as well as remove files that shouldn't be there
167
- Invoke-Command -Session $session -ScriptBlock {
177
+ Invoke-Command -Session $(Get-session) -ScriptBlock {
168
178
  $remove_files = $using:remove_files
169
179
  $fileshare_dest = "$($env:SystemDrive)\vagrant-sync"
170
180
  write-host "$(&hostname) :: Distributing files from $fileshare_dest..."
@@ -195,6 +205,15 @@ Invoke-Command -Session $session -ScriptBlock {
195
205
 
196
206
  Remove-PSSession -Id $session.Id
197
207
 
208
+ # remove vm_address from trusted hosts
209
+ $trusted_hosts = get-item wsman:\localhost\Client\TrustedHosts
210
+ if ( $trusted_hosts.Value.Contains($vm_address) )
211
+ {
212
+ Write-host "Removing $vm_address from trusted host list"
213
+ $new_th_values = $trusted_hosts.Value -replace ",?$vm_address", ""
214
+ set-item wsman:\localhost\Client\TrustedHosts $new_th_values -Force
215
+ }
216
+
198
217
  $resultHash = $folder_mappings
199
218
  $result = ConvertTo-Json $resultHash
200
219
  Write-Output-Message $result
@@ -1,5 +1,5 @@
1
1
  module VagrantPlugins
2
2
  module VMM
3
- VERSION = "1.0.1"
3
+ VERSION = "1.0.2"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vagrant-vmm
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - jarig
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-24 00:00:00.000000000 Z
11
+ date: 2014-12-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler