rchaganti / DSCResources

Custom DSC resource modules by PowerShell Magazine
http://www.powershellmagazine.com
61 stars 26 forks source link

cVMNetworkAdapterVlan Issue #3

Closed SuperMarioo closed 8 years ago

SuperMarioo commented 9 years ago

HI ,

I'm trying to set up Vlans for 2 VM Machine but I'm getting following errors .

Add-NodeKeys : The key properties combination 'Network Adapter::False' is duplicated for keys 'Name,ManagementOS' of resource 'cVMNetworkAdapterVlan' in node .

I would appreciate any help .

 cVMNetworkAdapterVlan VLAN {
  ManagementOS = $false
  Name = "Network Adapter"
  VMName = "windows8"
  VlanId = 10
  AdapterMode = "Access"

  }

 cVMNetworkAdapterVlan VLAN1 {
  ManagementOS = $false
  Name = "Network Adapter"
  VMName = "s2"
  VlanId = 10
  AdapterMode = "Access"

  }
rchaganti commented 9 years ago

Hi, sorry about the delay! This seems like a bug in my module. I need to fix this.

rchaganti commented 8 years ago

I am still thinking if I should fix this or not. There has to be a key property in the resource and nothing else other than Name makes sense here. So, it has to be unique across different resource instances.

SuperMarioo commented 8 years ago

That's the problem , I tried to fix but its hard to find unique key .

rchaganti commented 8 years ago

True, at the same time we cannot force a user to use different NIC names for different VMs! I need to find a way out of this.

rchaganti commented 8 years ago

my recent commit https://github.com/rchaganti/DSCResources/commit/b210ee1bd855f6baf3019ec17f54ca0f5315118e closes this. I have added 'Id' as a property which is now used as the key property. Just give a GUID here and you can keep using the same name across all VMs. This is the only way we can close this issue.

rchaganti commented 8 years ago

I reopened the issue here. A similar issue to this was fixed for the cVMNetworkAdapter. However, this issues still remains open for cVMNetworkAdapterVlan. I can use the similar approach here. The Id property will identify the resource instance. This can change between runs too. We don't really care. But, the resource module will take care of the actual work behind the scenes.

SuperMarioo commented 8 years ago

Cool ID property should work in both cases , I will test it later this week .

Thanks

rchaganti commented 8 years ago

This is closed, finally! :)

I made a bunch of breaking changes along with this to the cVMNetworkAdapter, cVMNetworkAdapterVlan, and cVMNetworkAdapterSettings. This is required to ensure the Get-DscConfiguration works as expected.