Module: check_mk
Branch: master
Commit: 7e7e258f66c12a26644599b763835fd1dbf87ec1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7e7e258f66c12a…
Author: Sergey Kipnis <sk(a)mathias-kettner.de>
Date: Thu May 2 09:41:23 2019 +0200
Scripts and descriptions for future new Agent testing
Change-Id: I87c507bb38ba4f3f4ac36e8da9e7bc1a9ee84d3d
---
agents/wnx/test_files/lwa_enable.cmd | 18 ++++++++++++++++++
agents/wnx/test_files/readme.txt | 3 +++
agents/wnx/test_files/tests/integration/readme.txt | 4 ++++
agents/wnx/test_files/wnx_enable.cmd | 18 ++++++++++++++++++
4 files changed, 43 insertions(+)
diff --git a/agents/wnx/test_files/lwa_enable.cmd b/agents/wnx/test_files/lwa_enable.cmd
new file mode 100644
index 0000000..93f745c
--- /dev/null
+++ b/agents/wnx/test_files/lwa_enable.cmd
@@ -0,0 +1,18 @@
+@echo off
+set lwa=check_mk_agent
+set wnx=checkmkservice
+powershell Write-Host "'New' Agent Service stopping..." -Foreground
Cyan
+net stop %wnx% 2> nul > nul
+if "%errorlevel%" == "2" powershell Write-Host "'New'
Agent Service already stopped" -Foreground Green && goto next
+if not "%errorlevel%" == "0" powershell Write-Host "Failed Stop
'NEW' Agent Service" -Foreground Yellow
+:next
+sc config "%wnx%" start= disabled > nul
+if not "%errorlevel%" == "0" powershell Write-Host "Failed
Disable 'NEW' Agent Service, Error=[%errorlevel%]" -Foreground Yellow
+sc config "%lwa%" start= auto > nul
+if not "%errorlevel%" == "0" powershell Write-Host "Failed
Enable 'LEGACY' Agent Service, Error=[%errorlevel%]" -Foreground Yellow
+powershell Write-Host "'Legacy' Agent Service starting..." -Foreground
Cyan
+net start %lwa% 2> nul > nul
+if "%errorlevel%" == "2" powershell Write-Host
"'Legacy' Agent Service already started" -Foreground Green &&
set errorlevel=0 && goto end
+if not "%errorlevel%" == "0" powershell Write-Host "Failed
Start 'Legacy' Agent Service, Error=[%errorlevel%]" -Foreground Red
&& exit 1
+powershell Write-Host "'Legacy' Agent Service started successfully"
-Foreground Green
+:end
\ No newline at end of file
diff --git a/agents/wnx/test_files/readme.txt b/agents/wnx/test_files/readme.txt
new file mode 100644
index 0000000..2c8aba7
--- /dev/null
+++ b/agents/wnx/test_files/readme.txt
@@ -0,0 +1,3 @@
+Limited description of the content:
+lwa_enable.cmd - stop&disable new agent + enable& start old one
+wnx_enable.cmd - stop&disable old agent + enable& start new one
\ No newline at end of file
diff --git a/agents/wnx/test_files/tests/integration/readme.txt
b/agents/wnx/test_files/tests/integration/readme.txt
new file mode 100644
index 0000000..d11629c
--- /dev/null
+++ b/agents/wnx/test_files/tests/integration/readme.txt
@@ -0,0 +1,4 @@
+
+Windows Local Test
+py -2 -m pip install pypiwin32
+py -2 -m pip install pytest
\ No newline at end of file
diff --git a/agents/wnx/test_files/wnx_enable.cmd b/agents/wnx/test_files/wnx_enable.cmd
new file mode 100644
index 0000000..8dcb63d
--- /dev/null
+++ b/agents/wnx/test_files/wnx_enable.cmd
@@ -0,0 +1,18 @@
+@echo off
+set lwa=check_mk_agent
+set wnx=checkmkservice
+powershell Write-Host "'Legacy' Agent Service stopping..." -Foreground
Cyan
+net stop %lwa% 2> nul > nul
+if "%errorlevel%" == "2" powershell Write-Host "'Legacy'
Agent Service already stopped" -Foreground Green && goto next
+if not "%errorlevel%" == "0" powershell Write-Host "Failed Stop
'Legacy' Agent Service [%errorlevel%]" -Foreground Yellow
+:next
+sc config "%lwa%" start= disabled > nul
+if not "%errorlevel%" == "0" powershell Write-Host "Failed
Disable 'Legacy' Agent Service, Error=[%errorlevel%]" -Foreground Yellow
+sc config "%wnx%" start= auto > nul
+if not "%errorlevel%" == "0" powershell Write-Host "Failed
Enable 'New' Agent Service, Error=[%errorlevel%]" -Foreground Yellow
+powershell Write-Host "'New' Agent Service starting..." -Foreground
Cyan
+net start %wnx% 2> nul > nul
+if "%errorlevel%" == "2" powershell Write-Host "'New'
Agent Service already started" -Foreground Green && set errorlevel=0
&& goto end
+if not "%errorlevel%" == "0" powershell Write-Host "Failed
Start 'New' Agent Service, Error=[%errorlevel%]" -Foreground Red &&
exit 1
+powershell Write-Host "'New' Agent Service started successfully"
-Foreground Green
+:end
\ No newline at end of file