Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Fix CLI team_id detection #88

Closed
wants to merge 1 commit into from

3 participants

@mhupman

Fixes the CLI --team issue @ksuther found in nomad/cupertino#83. I didn't see any particular reason why we couldn't just use the team accessor instead of the instance variable, but my ruby-foo is weak. Confirmed that this works for CLI and programmatic usage.

Alternatively, we could abandon the backwards compatibility and deprecate Agent::team_id, but that might require a major version bump.

@ksuther

Thanks, this seems to work for me as well. I didn't bother submitting a PR, as I'm sure I would have just done something idiomatically incorrect in Ruby :)

@mattt mattt referenced this pull request from a commit
@mattt mattt [Issue #88] Fixing teams once and for all eb3309e
@mattt
Owner

Thanks for your patch, @mhupman, but I decided to finally go in and fix all of the team selection logic once and for all with eb3309e. It had been monkey-patched and iterated so many times by so many different people that it completely lost any coherence. This patch makes everything make sense again.

@mattt mattt closed this
@mhupman

Sounds good, glad to see a fix! :rocket:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 22, 2013
  1. @mhupman
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/cupertino/provisioning_portal/helpers.rb
View
8 lib/cupertino/provisioning_portal/helpers.rb
@@ -37,12 +37,12 @@ def team_id
team_names = teams.collect(&:first)
team_ids = teams.collect(&:last)
- if @team.nil?
+ if self.team.nil?
selected_team_name = choose "Select a team:", *team_names
teams.detect { |t| t.first == selected_team_name }.last
- elsif team_ids.member? @team
- @team
- elsif team = teams.detect { |t| t.first.start_with?(@team) }
+ elsif team_ids.member? self.team
+ self.team
+ elsif team = teams.detect { |t| t.first.start_with?(self.team) }
team.last
else
say_error "Team should be a name or identifier" and abort
Something went wrong with that request. Please try again.