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

Fix expired session login redirect. #170

Merged
merged 2 commits into from
Jul 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]
### Added
- `cb info` now displays `tailscale` status.
- `cb network` now manages firewall rules and supports the following
subcommands: `add-firewall-rule`, `list-firewall-rules`,
`remove-firewall-rule` and `update-firewall-rule`.
Expand All @@ -16,6 +17,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `cb firewall` deprecated in favor of `cb network`.

### Fixed
- Expired session handling not prompting for new login.
- `cb list` completion to include `--format`.

## [3.5.1] - 2024-05-09
Expand Down
1 change: 1 addition & 0 deletions spec/cb/cluster_info_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Spectator.describe CB::ClusterInfo do
platform: aws
region: us-east-2
maintenance window: no window set. Default to: 00:00-23:59
tailscale active: false
network: nfpvoqooxzdrriu6w3bhqo55c4
firewall: no rules\n
EXPECTED
Expand Down
1 change: 1 addition & 0 deletions spec/support/factory.cr
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ module Factory
maintenance_window_start: nil,
network_id: "nfpvoqooxzdrriu6w3bhqo55c4",
storage: 1234,
tailscale_active: false,
}.merge(params)

CB::Model::Cluster.new **params
Expand Down
1 change: 1 addition & 0 deletions src/cb/cluster_info.cr
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class CB::ClusterInfo < CB::APIAction
"platform" => c.provider_id,
"region" => c.region_id,
"maintenance window" => MaintenanceWindow.new(c.maintenance_window_start).explain,
"tailscale active" => c.tailscale_active,
}

if source = c.source_cluster_id
Expand Down
11 changes: 3 additions & 8 deletions src/cli.cr
Original file line number Diff line number Diff line change
Expand Up @@ -1006,14 +1006,9 @@ rescue e : CB::Program::Error

exit 1
rescue e : CB::Client::Error
if e.unauthorized?
# if PROG.ensure_token_still_good
# STDERR << "error".colorize.t_warn << ": Token had expired, but has been refreshed. Please try again.\n"
# exit 1
# end
end
STDERR.puts e
exit 2
STDERR << "error".colorize.red.bold << ": #{e.message}\n"
exit 2 unless e.unauthorized?
CB::Login.new.run
rescue e
capture_error e
exit 3
Expand Down