Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can i delete a variable from an specific Machine? #7

Open
javihm opened this issue Mar 14, 2017 · 1 comment
Open

How can i delete a variable from an specific Machine? #7

javihm opened this issue Mar 14, 2017 · 1 comment
Assignees

Comments

@javihm
Copy link

javihm commented Mar 14, 2017

I've probed with somenthing like that...

Get-OctoVariable -Project $proyectName | Where-Object { $.Name -like $nameVariable -and $.Machine -like $nameTarget } | Remove-OctoVariable -Project $proyectName

@Swoogan Swoogan self-assigned this Oct 17, 2017
@Swoogan
Copy link
Owner

Swoogan commented Sep 25, 2018

I'm not sure. Can you try

$variables = Get-OctoVariable -Project $proyectName | Where-Object { $.Name -like $nameVariable}
foreach ($var in $variables) {
  foreach ($key in $var.Scope) {
    if ($key -eq [Octopus.Client.Model.ScopeField]::Machine -and $var.Scope[$key] -eq $nameTarget) {
      # delete
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants