<commit_before><#
.SYNOPSIS
    Installs Puppet on this machine.

.DESCRIPTION
    Downloads and installs the PuppetLabs Puppet MSI package.

    This script requires administrative privileges.

    You can run this script from an old-style cmd.exe prompt using the
    following:

      powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -Command "& '.\windows.ps1'"

.PARAMETER PuppetPackage
    This is the Chocolatey Package you want to install.
    This defaults to puppet (puppet 3.x).

.PARAMETER PuppetCollection
    This is the Collection of Puppet that you want to install. If you pass this it will override the PuppetPackage.
    This defaults to $null.

.PARAMETER PuppetCertname
    The certname to use for this puppet agent.
    This defaults to $env:computername.

.PARAMETER PuppetEnvironment
    The environment to use for this puppet agent.
    This defaults to "test".

.PARAMETER chocolateyProxyLocation
    Use this web proxy to do the install.
#>
param(
   [string]$PuppetPackage = "puppet"
  ,[string]$PuppetCollection = $env:PuppetCollection
  ,[string]$PuppetCertname = $env:PuppetCertname
  ,[string]$PuppetEnvironment = $env:PuppetEnvironment
  ,[string]$chocolateyProxyLocation = $env:chocolateyProxyLocation
)

Import-Module ScheduledTasks

if ($PuppetCollection) {
  $PuppetPackage = "puppet-agent"
  Write-Host "Puppet Collection $PuppetCollection specified, updated PuppetPackage to `"$PuppetPackage`""
  $PuppetApplyManifests = "C:\ProgramData\PuppetLabs\code\environments\$PuppetEnvironment\manifests"
} else {
  $PuppetApplyManifests = "C:\ProgramData\PuppetLabs\puppet\etc\manifests"
}

if (!($PuppetCertname)) {
  if ($env:userdnsdomain) {
    $PuppetCertname = ("${env:computername}.${env:userdnsdomain}").tolower()
  } else {
    $PuppetCertname = ("${env:computername}.it.muohio.edu").tolower()
  }
}

if (!($PuppetEnvironment)) { $PuppetEnvironment = "test" }
switch -regex ($PuppetEnvironment) {
  'locdev|loctst|locprd|vagrant'        { $PuppetServer = "localhost" }
  'esodev|esotst'                       { $PuppetServer = "uitlpupt02.mcs.miamioh.edu" }
  'development|test|staging|production' { $PuppetServer = "uitlpupp02.mcs.miamioh.edu" }
  default {
    Write-Error "Unknown/Unsupported PuppetEnvironment."
    Exit 1
  }
}

$PuppetCmd = "`"C:\Program Files\Puppet Labs\Puppet\bin\puppet.bat`""
switch -regex ($PuppetEnvironment) {
  'locdev|loctst|locprd|vagrant' { $PuppetArg = "apply --config C:\ProgramData\PuppetLabs\puppet\etc\puppet.conf $PuppetApplyManifests" }
  default                        { $PuppetArg = "agent --config C:\ProgramData\PuppetLabs\puppet\etc\puppet.conf --onetime --no-daemonize" }
}

$PuppetInstalled = $false
try {
  $ErrorActionPreference = "Stop";
  Get-Command puppet | Out-Null
  $PuppetInstalled = $true
  $PuppetVersion=&puppet "--version"
  Write-Host "Puppet $PuppetVersion is installed. This process does not ensure the exact version or at least version specified, but only that puppet is installed. Exiting..."
  Exit 0
} catch {
  Write-Host "Puppet is not installed, continuing..."
}<commit_msg>Windows make a better guess at domain based on environment<commit_after><#
.SYNOPSIS
    Installs Puppet on this machine.

.DESCRIPTION
    Downloads and installs the PuppetLabs Puppet MSI package.

    This script requires administrative privileges.

    You can run this script from an old-style cmd.exe prompt using the
    following:

      powershell.exe -ExecutionPolicy Unrestricted -NoLogo -NoProfile -Command "& '.\windows.ps1'"

.PARAMETER PuppetPackage
    This is the Chocolatey Package you want to install.
    This defaults to puppet (puppet 3.x).

.PARAMETER PuppetCollection
    This is the Collection of Puppet that you want to install. If you pass this it will override the PuppetPackage.
    This defaults to $null.

.PARAMETER PuppetCertname
    The certname to use for this puppet agent.
    This defaults to $env:computername.

.PARAMETER PuppetEnvironment
    The environment to use for this puppet agent.
    This defaults to "test".

.PARAMETER chocolateyProxyLocation
    Use this web proxy to do the install.
#>
param(
   [string]$PuppetPackage = "puppet"
  ,[string]$PuppetCollection = $env:PuppetCollection
  ,[string]$PuppetCertname = $env:PuppetCertname
  ,[string]$PuppetEnvironment = $env:PuppetEnvironment
  ,[string]$chocolateyProxyLocation = $env:chocolateyProxyLocation
)

Import-Module ScheduledTasks

if ($PuppetCollection) {
  $PuppetPackage = "puppet-agent"
  Write-Host "Puppet Collection $PuppetCollection specified, updated PuppetPackage to `"$PuppetPackage`""
  $PuppetApplyManifests = "C:\ProgramData\PuppetLabs\code\environments\$PuppetEnvironment\manifests"
} else {
  $PuppetApplyManifests = "C:\ProgramData\PuppetLabs\puppet\etc\manifests"
}

if (!($PuppetEnvironment)) { $PuppetEnvironment = "test" }

if (!($PuppetCertname)) {
  if ($env:userdnsdomain) {
    $PuppetCertname = ("${env:computername}.${env:userdnsdomain}").tolower()
  } else {
    switch -regex ($PuppetEnvironment) {
      'locprd|production' { $PuppetCertname = ("${env:computername}.it.muohio.edu").tolower() }
      default             { $PuppetCertname = ("${env:computername}.ittst.muohio.edu").tolower() }
    }
  }
}

switch -regex ($PuppetEnvironment) {
  'locdev|loctst|locprd|vagrant'        { $PuppetServer = "localhost" }
  'esodev|esotst'                       { $PuppetServer = "uitlpupt02.mcs.miamioh.edu" }
  'development|test|staging|production' { $PuppetServer = "uitlpupp02.mcs.miamioh.edu" }
  default {
    Write-Error "Unknown/Unsupported PuppetEnvironment."
    Exit 1
  }
}

$PuppetCmd = "`"C:\Program Files\Puppet Labs\Puppet\bin\puppet.bat`""
switch -regex ($PuppetEnvironment) {
  'locdev|loctst|locprd|vagrant' { $PuppetArg = "apply --config C:\ProgramData\PuppetLabs\puppet\etc\puppet.conf $PuppetApplyManifests" }
  default                        { $PuppetArg = "agent --config C:\ProgramData\PuppetLabs\puppet\etc\puppet.conf --onetime --no-daemonize" }
}

$PuppetInstalled = $false
try {
  $ErrorActionPreference = "Stop";
  Get-Command puppet | Out-Null
  $PuppetInstalled = $true
  $PuppetVersion=&puppet "--version"
  Write-Host "Puppet $PuppetVersion is installed. This process does not ensure the exact version or at least version specified, but only that puppet is installed. Exiting..."
  Exit 0
} catch {
  Write-Host "Puppet is not installed, continuing..."
}
{'fraction_non_alphanumeric': 0.11292834890965732, 'fraction_numerical': 0.0024922118380062306, 'mean_word_length': 4.055905511811024, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '593964', 'n_tokens_mistral': 2214, 'n_tokens_neox': 2159, 'n_words': 516}