Skip to content

Commit

Permalink
Feature/masterkeys (OctopusDeploy#99)
Browse files Browse the repository at this point in the history
* Partial commit, moving to a different dev machine

* Changes to support --masterkey, first push

* Change Home Directory - would collide

* Forgot to add spec tests.

* Some oddly missing braces

* Vagrant tests YU stop dead after the first scenario??

* Vagrant hates me, doing a TC build

* Update tests for the HA scenaroio

* Typo!

* Packages directory - shared location held in DB?

* Packages test. Why packages test?

* Remove doesn't work when HAing on the same box for tests

* Establish a shared code module, start moving common code in.

* dot-source the shared code file, due to scoping considerations

* Shard code changes, add some tests for shared code

* Install-MSI was deleting installers, making the new hash comparison code pointless

* Change scenario tests so each uses a specific database

* Fix ScriptAnalyzer issues

* Fix whitespace

* Suppress PSAvoidUsingConvertToSecureStringWithPlainText

Rather than trying to work around it with passwords encoded on disk.

* Whitespace

* Remove functions that now exist in shared module

* Whitespace

* Force the LCM to ApplyOnly mode

* Only configure hyperv on a windows host

* Fix detection of other instances

* Always do licensekey and admin user

Even if in cluster/masterkey-provided mode, just in case someone wants to both restore and change the admin password at the same time.

* Improve variable name for when masterkey provided

Old name was potentially misleading

* Implement remaining changes for masterkey

* Correct path to config file

As it now includes instance name

* {OctopusHome}\OctopusServer doesn't always exist

Its created by tasks kicked off by scheduler - its not deterministically available

* Add a comment to explain why file should exist

* Removed .vscode folder and adding to .gitignore

* Remove exported function that was used for testing

* Removing unneeded change
  • Loading branch information
matt-richardson authored and stopthatastronaut committed Dec 19, 2017
1 parent 22b9003 commit 122cd5a
Show file tree
Hide file tree
Showing 55 changed files with 714 additions and 652 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ ipch/
*.vsp
*.vspx

# Visual Studio Code
.vscode/

# TFS 2012 Local Workspace
$tf/

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# dot-source the helper file (cannot load as a module due to scope considerations)
. (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) -ChildPath 'OctopusDSCHelpers.ps1')

function Get-TargetResource {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")]
Expand Down Expand Up @@ -97,7 +99,7 @@ function Test-TargetResource {
-OctopusCredentials $OctopusCredentials `
-OctopusApiKey $OctopusApiKey)

$params = Get-OctopusDSCParameter $MyInvocation.MyCommand.Parameters
$params = Get-ODSCParameter $MyInvocation.MyCommand.Parameters

$currentConfigurationMatchesRequestedConfiguration = $true
foreach ($key in $currentResource.Keys) {
Expand Down Expand Up @@ -225,19 +227,4 @@ function Get-OctopusClientRepository
}

return $repository
}

function Get-OctopusDSCParameter($parameters) {
# unfortunately $PSBoundParameters doesn't contain parameters that weren't supplied (because the default value was okay)
# credit to https://www.briantist.com/how-to/splatting-psboundparameters-default-values-optional-parameters/
$params = @{}
foreach ($h in $parameters.GetEnumerator()) {
$key = $h.Key
$var = Get-Variable -Name $key -ErrorAction SilentlyContinue
if ($null -ne $var) {
$val = Get-Variable -Name $key -ErrorAction Stop | Select-Object -ExpandProperty Value -ErrorAction Stop
$params[$key] = $val
}
}
return $params
}
}
22 changes: 5 additions & 17 deletions OctopusDSC/DSCResources/cOctopusSeqLogger/cOctopusSeqLogger.psm1
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
$octopusServerExePath = "$($env:ProgramFiles)\Octopus Deploy\Octopus\Octopus.Server.exe"
$tentacleExePath = "$($env:ProgramFiles)\Octopus Deploy\Tentacle\Tentacle.exe"

# dot-source the helper file (cannot load as a module due to scope considerations)
. (Join-Path -Path (Split-Path (Split-Path $PSScriptRoot -Parent) -Parent) -ChildPath 'OctopusDSCHelpers.ps1')

function Get-TargetResource {
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSDSCUseVerboseMessageInDSCResource", "")]
[OutputType([HashTable])]
Expand Down Expand Up @@ -308,7 +311,7 @@ function Test-TargetResourceInternal {
-SeqApiKey $SeqApiKey `
-Properties $Properties)

$params = Get-OctopusDSCParameter $MyInvocation.MyCommand.Parameters
$params = Get-ODSCParameter $MyInvocation.MyCommand.Parameters

$currentConfigurationMatchesRequestedConfiguration = $true
foreach ($key in $currentResource.Keys) {
Expand Down Expand Up @@ -425,19 +428,4 @@ function Test-PSCredential($currentValue, $requestedValue) {
Write-Verbose "Configuration parameter '$key' matches the requested value '********'"
}
return $true
}

function Get-OctopusDSCParameter($parameters) {
# unfortunately $PSBoundParameters doesn't contain parameters that weren't supplied (because the default value was okay)
# credit to https://www.briantist.com/how-to/splatting-psboundparameters-default-values-optional-parameters/
$params = @{}
foreach ($h in $parameters.GetEnumerator()) {
$key = $h.Key
$var = Get-Variable -Name $key -ErrorAction SilentlyContinue
if ($null -ne $var) {
$val = Get-Variable -Name $key -ErrorAction Stop | Select-Object -ExpandProperty Value -ErrorAction Stop
$params[$key] = $val
}
}
return $params
}
}
Loading

0 comments on commit 122cd5a

Please sign in to comment.