Get-OctopusResourceModelcmdlet which will simplify creating my mock objects if I change my script to use
-ResourceOnlythroughout. Many thanks for the pointer.
Get-OctopusResourceModelthat made life easier when using it to create the test data objects I was talking about above... see what you think.
BeginProcessingmethod is something I already did in my refactoring branch :) https://github.com/Dalmirog/OctoPosh/blob/enh_addingGenericFunctions/Octoposh/Cmdlets/GetOctopusResourceModel.cs
As 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
2 - 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
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
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
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
@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.
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
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.