Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
auto-tx
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vamp
auto-tx
Commits
7d9c1a5a
Commit
7d9c1a5a
authored
7 years ago
by
Niko Ehrenfeuchter
Browse files
Options
Downloads
Patches
Plain Diff
Add NewConfig-IsValid to validate new configuration files.
Implements the core functionality of
#28
parent
5965a0c4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Updater/Update-Service.ps1
+30
-0
30 additions, 0 deletions
Updater/Update-Service.ps1
with
30 additions
and
0 deletions
Updater/Update-Service.ps1
+
30
−
0
View file @
7d9c1a5a
...
...
@@ -306,6 +306,36 @@ function NewConfig-Available {
}
function
NewConfig
-IsValid
{
# Check if the new configuration provided at $UpdPathConfig validates with
# the appropriate "AutoTxConfigTest" binary (either the existing one in the
# service installation directory (if the service binaries won't be updated)
# or the new one at the $UpdPathBinaries location in case the service itself
# will be updated as well).
#
# Returns an array with two elements, the first one being $True in case the
# configuration was successfully validated ($False otherwise) and the second
# one containing the output of the configuration test tool as a string.
Param
(
[
Parameter
(
Mandatory
=
$True
)]
[
ValidateScript
({(
Test-Path
$_
-PathType
Leaf
)})
]
[
String
]
$ConfigTest
)
Write-Verbose
"Running [
$(
$ConfigTest
)
$(
$UpdPathConfig
)
]..."
$Summary
=
&
$ConfigTest
$UpdPathConfig
$Ret
=
$?
# pipe through Out-String to preserve line breaks:
$Summary
=
"
$(
"="
*
80
)
`n
$(
$Summary
|
Out-String
)
`n
$(
"="
*
80
)
"
if
(
$Ret
)
{
Log-Debug
"Successfully validated new configuration files!
`n
$(
$Summary
)
"
Return
$Ret
,
$Summary
}
Log-Error
"Config at [
$(
$UpdPathConfig
)
] failed validation!
`n
$(
$Summary
)
"
Return
$Ret
,
$Summary
}
function
Copy
-ServiceFiles
{
try
{
Write-Verbose
"Looking for source package using pattern:
$(
$Pattern
)
"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment