BeginProcessing
method is something I already did in my refactoring branch :) https://github.com/Dalmirog/OctoPosh/blob/enh_addingGenericFunctions/Octoposh/Cmdlets/GetOctopusResourceModel.csAs for the addition of VariableSetResource
: In Octopus a VariableSetResource
is a type of object that holds a collection of variables. This VariableSetResource
can belong to 2 other different kinds of objects:
1 - a ProjectResource
2 - a LibraryVariableSetResource
A VariableSetResource
object doesn't exist by itself, but only as a child object of these 2. Therefore the only organic way to create a VariableSetResource
must be through the creation of either a ProjectResource
or a LibraryVariableSet
resource.
For that reason in the snippet I gave you in line 10 I'm creating a LibraryVariableSet
, and then in line 13 I'm getting the VariableSetResource
that was associated with the LibraryVariableSet
that I previously created. I'm never directly creating a VariableSetResource
.
I'm afraid that if the module gives users the ability to create orphan an VariableSetResource
, It'll confuse more ppl than it would help. Advanced users such as yourself should be able to work around this by creating a VariableSetResource
using raw powershell like new-object Octopus.Client.Model.VariableSet
That said, I'm curious of how are you setting up your tests in a way that you need to create an orphan VariableSetResource
like this.
/api/variables
) so I don't see it has inherently wrong - presumably the API has consistency checks to ensure that the 'OwnerId' property is valid to avoid actual orphans?.
New-*
cmdlets would be an effective way of leading them into the 'pit of success' of only creating the right types objects?
Update-OctopusResource
- mocking a function in Pester doesn't override its parameter validation so when I attempted to use my original mock object (a hashtable that mimicked the required properties), it didn't match the required type Octopus.Client.Mode.Resource
.
@Dalmirog any example on how to delete releases? I am trying Remove-OctopusResource -Resource $release but it is throwing error Remove-OctopusResource : Cannot bind parameter 'Resource'. Cannot convert the "Octoposh.Model.OutputOctopusRelease" value of type
"Octoposh.Model.OutputOctopusRelease" to type "Octopus.Client.Model.Resource". hey @Dalmirog not sure if you had chance to look into this. Appreciate your help.
@ConwayO
New-OctopusAPIKey - I simply didn't port this cmdlet after porting things to C#. I have #259 open for it. I'll do it this week as I've been asked about it quite enough :)
Environment question - Not sure Im following this one. Which cmdlet are you running and what you mean by "skip 10"
calling API directly - Yes you can run $c = new-Octopusconnection
. Then you could do $c.repository.projects.findall()
for example to get all the projects. $c
will be an object that holds an authenticated connection with your Octopus instance. Is this what you needed?
@jigneshjdesai about using Octo.exe delete-releases
, here's do documentation for it: https://octopus.com/docs/api-and-integration/octo.exe-command-line/deleting-releases
Remember that you can download Octo.exe
using Octoposh
as explained here: http://octoposh.readthedocs.io/en/latest/advancedexamples/running-deployments-with-octoposh/
Hello, I need some help with Get-OctopusDeployment. I am using Octopus 3.4.13 and Octoposh 0.6.11.
I have a project and environment that have 34 deployments listed in the DeploymentHistory table in the database. Get-OctopusDeployment throws this error when I try
PS C:\WINDOWS\system32> Get-OctopusDeployment -ProjectName Myproject -EnvironmentName Myproject_prod
Get-OctopusDeployment : Nullable object must have a value.
At line:1 char:1
Get-OctopusDeployment works fine for other projects with either more or fewer deployments. The project with errors has Successful, Failed and Cancelled deployments. That is also the case with projects that do not have errors.
getting Sequence contains no elements error. I have been trying to use octoposh after a long break doing other things. I installed latest module but have errors on both windows and pwsh that are same with some commandlet vs 2018.4.1 version such as get-octopusenvironment (Get-OctopusProject | select -First 2).Count
Get-OctopusProject : Sequence contains no elements
At line:1 char:2
(Get-OctopusMachine | select -First 2).Count
2
(Get-OctopusEnvironment | select -First 2).Count
Get-OctopusEnvironment : Sequence contains no elements
At line:1 char:2
(Get-OctopusUser | select -First 2).Count
2
$VariableSets = Get-OctopusVariableSet -LibrarySetName * -IncludeUsage
OctopusUrl OctopusApiKey
http://octopus.xxx.io API-Dxxxxxxxxxxxxxxxxxxx
Get-OctopusVariableSet : Unable to process response from server: Error converting value "AmazonWebServicesAccount" to type 'Octopus.Client.Model.VariableType'. Path 'Variables[0].Type', line 22, position
40.. Response content: {
"Id": "variableset-LibraryVariableSets-522",
"OwnerId": "LibraryVariableSets-522",
"Versi
At line:6 char:17
PS C:\WINDOWS\system32>