Skip to content

Commit

Permalink
xClusterNetwork: Enabled localization (#116)
Browse files Browse the repository at this point in the history
- Changes to xClusterNetwork
  - Enabled localization for all strings (issue #85).
  - Fixed typo in parameter descriptions in comment-based help, and schema.mof.
  • Loading branch information
johlju committed Jul 26, 2017
1 parent 64b42ca commit 657062a
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 12 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
- Replaced the URL for the parameter Role in README.md. The new URL is a more
generic description of the possible settings for the Role parameter. The
previous URL was still correct but focused on Hyper-V in particular.
- Fixed typos in parameter descriptions in README.md.
- Fixed typos in parameter descriptions in README.md, comment-based help and schema.mof.
- Enabled localization for all strings ([issue #85](https://github.com/PowerShell/xFailOverCluster/issues/85)).
- Changes to xCluster
- Resolved Script Analyzer rule warnings by changing Get-WmiObject to
Get-CimInstance ([issue #49](https://github.com/PowerShell/xFailOverCluster/issues/49)).
Expand Down
23 changes: 14 additions & 9 deletions DSCResources/MSFT_xClusterNetwork/MSFT_xClusterNetwork.psm1
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
Import-Module -Name (Join-Path -Path (Split-Path -Path $PSScriptRoot -Parent) `
-ChildPath 'CommonResourceHelper.psm1')

$script:localizedData = Get-LocalizedData -ResourceName 'MSFT_xClusterNetwork'

<#
.SYNOPSIS
Returns the current state of the failover cluster network resource.
.PARAMETER Address
The adress for the cluster network in the format '10.0.0.0'.
The address for the cluster network in the format '10.0.0.0'.
.PARAMETER AddressMask
The adress mask for the cluster network in the format '255.255.255.0'.
The address mask for the cluster network in the format '255.255.255.0'.
#>
function Get-TargetResource
{
Expand Down Expand Up @@ -42,10 +47,10 @@ function Get-TargetResource
network resource.
.PARAMETER Address
The adress for the cluster network in the format '10.0.0.0'.
The address for the cluster network in the format '10.0.0.0'.
.PARAMETER AddressMask
The adress mask for the cluster network in the format '255.255.255.0'.
The address mask for the cluster network in the format '255.255.255.0'.
.PARAMETER Name
The name of the cluster network. If the cluster network name is not in
Expand Down Expand Up @@ -100,7 +105,7 @@ function Set-TargetResource

if ($PSBoundParameters.ContainsKey('Name') -and $getTargetResourceResult.Name -ne $Name)
{
Write-Verbose "Changing the name of network $Address/$AddressMask to '$Name'"
Write-Verbose -Message ($script:localizedData.ChangeNetworkName -f $Address, $AddressMask, $Name)

$clusterNetworkResource = Get-ClusterNetwork | Where-Object -FilterScript {
$_.Address -eq $Address -and $_.AddressMask -eq $AddressMask
Expand All @@ -111,7 +116,7 @@ function Set-TargetResource

if ($PSBoundParameters.ContainsKey('Role') -and $getTargetResourceResult.Role -ne $Role)
{
Write-Verbose "Changing the role of network $Address/$AddressMask to '$Role'"
Write-Verbose -Message ($script:localizedData.ChangeNetworkRole -f $Address, $AddressMask, $Role)

$clusterNetworkResource = Get-ClusterNetwork | Where-Object -FilterScript {
$_.Address -eq $Address -and $_.AddressMask -eq $AddressMask
Expand All @@ -122,7 +127,7 @@ function Set-TargetResource

if ($PSBoundParameters.ContainsKey('Metric') -and $getTargetResourceResult.Metric -ne $Metric)
{
Write-Verbose "Changing the metric of network $Address/$AddressMask to '$Metric'"
Write-Verbose -Message ($script:localizedData.ChangeNetworkMetric -f $Address, $AddressMask, $Metric)

$clusterNetworkResource = Get-ClusterNetwork | Where-Object -FilterScript {
$_.Address -eq $Address -and $_.AddressMask -eq $AddressMask
Expand All @@ -138,10 +143,10 @@ function Set-TargetResource
values for the properties Name, Role and Metric.
.PARAMETER Address
The adress for the cluster network in the format '10.0.0.0'.
The address for the cluster network in the format '10.0.0.0'.
.PARAMETER AddressMask
The adress mask for the cluster network in the format '255.255.255.0'.
The address mask for the cluster network in the format '255.255.255.0'.
.PARAMETER Name
The name of the cluster network. If the cluster network name is not in
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
[ClassVersion("1.0.0.0"), FriendlyName("xClusterNetwork")]
class MSFT_xClusterNetwork : OMI_BaseResource
{
[Key, Description("The adress for the cluster network in the format '10.0.0.0'.")] String Address;
[Key, Description("The adress mask for the cluster network in the format '255.255.255.0'.")] String AddressMask;
[Key, Description("The address for the cluster network in the format '10.0.0.0'.")] String Address;
[Key, Description("The address mask for the cluster network in the format '255.255.255.0'.")] String AddressMask;
[Write, Description("The name of the cluster network. If the cluster network name is not in desired state it will be renamed to match this name.")] String Name;
[Write, Description("he role of the cluster network. If the cluster network role is not in desired state it will change to match this role."), ValueMap{"0","1","3"}, Values{"0","1","3"}] String Role;
[Write, Description("The metric number for the cluster network. If the cluster network metric number is not in desired state it will be changed to match this metric number.")] String Metric;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Localized resources for xClusterNetwork

ConvertFrom-StringData @'
ChangeNetworkName = Changing the name of the network {0}/{1} to '{2}'.
ChangeNetworkRole = Changing the role of the network {0}/{1} to '{2}'.
ChangeNetworkMetric = Changing the metric of the network {0}/{1} to '{2}'.
'@

0 comments on commit 657062a

Please sign in to comment.