<commit_before>{
  "Id": "ed837372-165f-4e0e-b755-1df9633d9eb1",
  "Name": "Windows - Ensure Features Installed",
  "Description": "Ensures that a set of Windows Features are installed on the system.",
  "ActionType": "Octopus.Script",
  "Version": 3,
  "Properties": {
    "Octopus.Action.Script.ScriptBody": "$requiredFeatures = $OctopusParameters['WindowsFeatures'].split(\",\") | foreach { $_.trim() }\nif(! $requiredFeatures) {\n    Write-Output \"No required Windows Features specified...\"\n    exit\n}\n$requiredFeatures | foreach { $feature = DISM.exe /ONLINE /Get-FeatureInfo /FeatureName:$_; if($feature -like \"*Feature name $_ is unknown*\") { throw $feature } }\n\nWrite-Output \"Retrieving all Windows Features...\"\n$allFeatures = DISM.exe /ONLINE /Get-Features /FORMAT:List | Where-Object { $_.StartsWith(\"Feature Name\") -OR $_.StartsWith(\"State\") } \n$features = new-object System.Collections.ArrayList\nfor($i = 0; $i -lt $allFeatures.length; $i=$i+2) {\n    $feature = $allFeatures[$i]\n    $state = $allFeatures[$i+1]\n    $features.add(@{feature=$feature.split(\":\")[1].trim();state=$state.split(\":\")[1].trim()}) | OUT-NULL\n}\n\nWrite-Output \"Checking for missing Windows Features...\"\n$missingFeatures = new-object System.Collections.ArrayList\n$features | foreach { if( $requiredFeatures -contains $_.feature -and $_.state -eq 'Disabled') { $missingFeatures.add($_.feature) | OUT-NULL } }\nif(! $missingFeatures) {\n    Write-Output \"All required Windows Features are installed\"\n    exit\n}\nWrite-Output \"Installing missing Windows Features...\"\n$featureNameArgs = \"\"\n$missingFeatures | foreach { $featureNameArgs = $featureNameArgs + \" /FeatureName:\" + $_ }\n$dism = \"DISM.exe\"\nIF ($SuppressReboot)\n{\n    $arguments = \"/NoRestart \"\n}\nELSE\n{\n    $arguments = \"\"\n}\n$arguments = $arguments + \"/ONLINE /Enable-Feature /All $featureNameArgs\"\nWrite-Output \"Calling DISM with arguments: $arguments\"\nstart-process -NoNewWindow $dism $arguments",
    "Octopus.Action.Script.Syntax": "PowerShell"
  },
  "SensitiveProperties": {},
  "Parameters": [
    {
      "Name": "WindowsFeatures",
      "Label": "Windows features",
      "HelpText": "The set of Windows Features that should be installed on the system. This can be either a single Windows Feature or a comma separated list of Windows Features to check.\n\nExample 1: IIS-WebServer\n\nExample 2: IIS-WebServer, IIS-WindowsAuthentication",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "MultiLineText"
      }
    },
    {
      "Name": "SuppressReboot",
      "Label": "Suppress Reboot",
      "HelpText": "Suppresses reboot. If a reboot is not necessary, then this option does nothing. This option will keep DISM.exe from prompting for a restart, or from restarting automatically).",
      "DefaultValue": "False",
      "DisplaySettings": {
        "Octopus.ControlType": "Checkbox"
      }
    }
  ],
  "LastModifiedOn": "2014-08-30T15:17:19.861+00:00",
  "LastModifiedBy": "cjuroz",
  "$Meta": {
    "ExportedAt": "2014-07-29T16:54:34.499+00:00",
    "OctopusVersion": "2.5.5.318",
    "Type": "ActionTemplate"
  },
  "Category": "windows"
}<commit_msg>Consider all DSIM states that begin with "Disabled" to be disabled, because both "Disabled" and "Disabled with Payload Removed" are possibilities.<commit_after>{
  "Id": "ed837372-165f-4e0e-b755-1df9633d9eb1",
  "Name": "Windows - Ensure Features Installed",
  "Description": "Ensures that a set of Windows Features are installed on the system.",
  "ActionType": "Octopus.Script",
  "Version": 4,
  "Properties": {
    "Octopus.Action.Script.ScriptBody": "$requiredFeatures = $OctopusParameters['WindowsFeatures'].split(\",\") | foreach { $_.trim() }\nif(! $requiredFeatures) {\n    Write-Output \"No required Windows Features specified...\"\n    exit\n}\n$requiredFeatures | foreach { $feature = DISM.exe /ONLINE /Get-FeatureInfo /FeatureName:$_; if($feature -like \"*Feature name $_ is unknown*\") { throw $feature } }\n\nWrite-Output \"Retrieving all Windows Features...\"\n$allFeatures = DISM.exe /ONLINE /Get-Features /FORMAT:List | Where-Object { $_.StartsWith(\"Feature Name\") -OR $_.StartsWith(\"State\") } \n$features = new-object System.Collections.ArrayList\nfor($i = 0; $i -lt $allFeatures.length; $i=$i+2) {\n    $feature = $allFeatures[$i]\n    $state = $allFeatures[$i+1]\n    $features.add(@{feature=$feature.split(\":\")[1].trim();state=$state.split(\":\")[1].trim()}) | OUT-NULL\n}\n\nWrite-Output \"Checking for missing Windows Features...\"\n$missingFeatures = new-object System.Collections.ArrayList\n$features | foreach { if( $requiredFeatures -contains $_.feature -and $_.state.StartsWith(\"Disabled\")) { $missingFeatures.add($_.feature) | OUT-NULL } }\nif(! $missingFeatures) {\n    Write-Output \"All required Windows Features are installed\"\n    exit\n}\nWrite-Output \"Installing missing Windows Features...\"\n$featureNameArgs = \"\"\n$missingFeatures | foreach { $featureNameArgs = $featureNameArgs + \" /FeatureName:\" + $_ }\n$dism = \"DISM.exe\"\nIF ($SuppressReboot)\n{\n    $arguments = \"/NoRestart \"\n}\nELSE\n{\n    $arguments = \"\"\n}\n$arguments = $arguments + \"/ONLINE /Enable-Feature /All $featureNameArgs\"\nWrite-Output \"Calling DISM with arguments: $arguments\"\nstart-process -NoNewWindow $dism $arguments",
    "Octopus.Action.Script.Syntax": "PowerShell"
  },
  "SensitiveProperties": {},
  "Parameters": [
    {
      "Name": "WindowsFeatures",
      "Label": "Windows features",
      "HelpText": "The set of Windows Features that should be installed on the system. This can be either a single Windows Feature or a comma separated list of Windows Features to check.\n\nExample 1: IIS-WebServer\n\nExample 2: IIS-WebServer, IIS-WindowsAuthentication",
      "DefaultValue": null,
      "DisplaySettings": {
        "Octopus.ControlType": "MultiLineText"
      }
    },
    {
      "Name": "SuppressReboot",
      "Label": "Suppress Reboot",
      "HelpText": "Suppresses reboot. If a reboot is not necessary, then this option does nothing. This option will keep DISM.exe from prompting for a restart, or from restarting automatically).",
      "DefaultValue": "False",
      "DisplaySettings": {
        "Octopus.ControlType": "Checkbox"
      }
    }
  ],
  "LastModifiedOn": "2017-10-03T21:58:18.839Z",
  "LastModifiedBy": "WesleySSmith",
  "$Meta": {
    "ExportedAt": "2017-10-03T21:58:18.839Z",
    "OctopusVersion": "3.17.1",
    "Type": "ActionTemplate"
  },
  "Category": "windows"
}
{'fraction_non_alphanumeric': 0.17434411226357535, 'fraction_numerical': 0.021964612568639415, 'mean_word_length': 3.9337848006019565, 'pattern_counts': {'":': 62, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5624355', 'n_tokens_mistral': 2147, 'n_tokens_neox': 2049, 'n_words': 506}