Skip to content

Commit

Permalink
Remove dependency on msazurerest
Browse files Browse the repository at this point in the history
  • Loading branch information
aavalang committed Oct 15, 2024
1 parent fa68215 commit ffef2d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/bastion/azext_bastion/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
UnrecognizedArgumentError, CLIInternalError, ClientRequestError
from azure.cli.core.commands.client_factory import get_subscription_id
from knack.log import get_logger
from msrestazure.tools import is_valid_resource_id
from azure.mgmt.core.tools import is_valid_resource_id
from .BastionServiceConstants import BastionSku
from .aaz.latest.network.bastion import Create as _BastionCreate

Expand Down
10 changes: 4 additions & 6 deletions src/bastion/azext_bastion/tunnel.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import websocket
from websocket import create_connection, WebSocket

from msrestazure.azure_exceptions import CloudError
from azure.core.exceptions import HttpResponseError
from azure.cli.core._profile import Profile
from azure.cli.core.util import should_disable_connection_verify

Expand Down Expand Up @@ -106,10 +106,9 @@ def _get_auth_token(self):

if response.status_code not in [200]:
if response_json is not None and response_json["message"] is not None:
exp = CloudError(response, error=response_json["message"])
raise HttpResponseError(response = response, message=response_json["message"])
else:
exp = CloudError(response)
raise exp
raise HttpResponseError(response = response)

self.last_token = response_json["authToken"]
self.node_id = response_json["nodeId"]
Expand Down Expand Up @@ -224,8 +223,7 @@ def cleanup(self):
if response.status_code == 404:
logger.info('Session already deleted')
elif response.status_code not in [200, 204]:
exp = CloudError(response)
raise exp
raise HttpResponseError(response = response)

self.last_token = None
self.node_id = None
Expand Down

0 comments on commit ffef2d1

Please sign in to comment.