Skip to content

Commit

Permalink
Add windows find disabled agents ps1 (#66)
Browse files Browse the repository at this point in the history
* Add Windows Support kb0285

Added kb0285_find_disabled_agents.ps1 to enable detection of disabled
agents on Windows.

Modified kb0285_find_disabled_agents.json so it will use the correct
version of the script on Linux and Windows.

* Updated kb0285_find_disabled_agents.ps1

Updated it so that it functions like the Linux version.

* Added blank line to the end of file.

* Updated kb0285 tasks

Updated kb0285 for backwards compatability.
  • Loading branch information
cwebster61083 authored and MartyEwings committed Dec 18, 2019
1 parent fd11da8 commit 44957de
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tasks/kb0285_find_disabled_agents.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"puppet_task_version": 1,
"description": "KB0285 Find Disabled Agents - This Task to be used in conjunction with Puppet Enterprise Knowledge Base Article KB0285 - https://support.puppet.com/hc/en-us/articles/360006717334",
"supports_noop": false
"supports_noop": false,
"implementations": [
{"name": "kb0285a_bash_find_disabled_agents.sh", "requirements": ["shell"]},
{"name": "kb0285b_powershell_find_disabled_agents.ps1", "requirements": ["powershell"]}
]
}

6 changes: 6 additions & 0 deletions tasks/kb0285a_bash_find_disabled_agents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"puppet_task_version": 1,
"description": "KB0285 Find Disabled Agents - This Task to be used in conjunction with Puppet Enterprise Knowledge Base Article KB0285 - https://support.puppet.com/hc/en-us/articles/360006717334",
"supports_noop": false
}

File renamed without changes.
6 changes: 6 additions & 0 deletions tasks/kb0285b_powershell_find_disabled_agents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"puppet_task_version": 1,
"description": "KB0285 Find Disabled Agents - This Task to be used in conjunction with Puppet Enterprise Knowledge Base Article KB0285 - https://support.puppet.com/hc/en-us/articles/360006717334",
"supports_noop": false
}

10 changes: 10 additions & 0 deletions tasks/kb0285b_powershell_find_disabled_agents.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
$LOCKFILE="$(cmd.exe /c puppet config print statedir)/agent_disabled.lock"

if(Test-Path $LOCKFILE) {
Write-Output "Puppet agent is disabled"
cat $LOCKFILE
}
else {
Write-Output "Puppet agent is enabled"
EXIT 1
}

0 comments on commit 44957de

Please sign in to comment.