Skip to content

Commit

Permalink
Remove local development code
Browse files Browse the repository at this point in the history
  • Loading branch information
tsatam committed Aug 24, 2023
1 parent c3579d3 commit d7b0a63
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 32 deletions.
8 changes: 0 additions & 8 deletions python/az/aro/azext_aro/_client_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

import urllib3

from azext_aro.custom import rp_mode_development
from azext_aro.vendored_sdks.azure.mgmt.redhatopenshift.v2023_04_01 import AzureRedHatOpenShiftClient
from azure.cli.core.commands.client_factory import get_mgmt_service_client

Expand All @@ -12,13 +11,6 @@ def cf_aro(cli_ctx, *_):

opt_args = {}

if rp_mode_development():
opt_args = {
"base_url": "https://localhost:8443/",
"connection_verify": False
}
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)

client = get_mgmt_service_client(cli_ctx,
AzureRedHatOpenShiftClient,
**opt_args)
Expand Down
32 changes: 8 additions & 24 deletions python/az/aro/azext_aro/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ def aro_create(cmd, # pylint: disable=too-many-locals
tags=None,
version=None,
no_wait=False):
if not rp_mode_development():
resource_client = get_mgmt_service_client(
cmd.cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES)
provider = resource_client.providers.get('Microsoft.RedHatOpenShift')
if provider.registration_state != 'Registered':
raise UnauthorizedError('Microsoft.RedHatOpenShift provider is not registered.',
'Run `az provider register -n Microsoft.RedHatOpenShift --wait`.')
resource_client = get_mgmt_service_client(
cmd.cli_ctx, ResourceType.MGMT_RESOURCE_RESOURCES)
provider = resource_client.providers.get('Microsoft.RedHatOpenShift')
if provider.registration_state != 'Registered':
raise UnauthorizedError('Microsoft.RedHatOpenShift provider is not registered.',
'Run `az provider register -n Microsoft.RedHatOpenShift --wait`.')

validate_subnets(master_subnet, worker_subnet)

Expand Down Expand Up @@ -110,10 +109,7 @@ def aro_create(cmd, # pylint: disable=too-many-locals
if not rp_client_sp_id:
raise ResourceNotFoundError("RP service principal not found.")

if rp_mode_development():
worker_vm_size = worker_vm_size or 'Standard_D2s_v3'
else:
worker_vm_size = worker_vm_size or 'Standard_D4s_v3'
worker_vm_size = worker_vm_size or 'Standard_D4s_v3'

if apiserver_visibility is not None:
apiserver_visibility = apiserver_visibility.capitalize()
Expand Down Expand Up @@ -420,15 +416,6 @@ def aro_update(cmd,
resource_name=resource_name,
parameters=ocUpdate)


def rp_mode_development():
return os.environ.get('RP_MODE', '').lower() == 'development'


def rp_mode_production():
return os.environ.get('RP_MODE', '') == ''


def generate_random_id():
random_id = (random.choice('abcdefghijklmnopqrstuvwxyz') +
''.join(random.choice('abcdefghijklmnopqrstuvwxyz1234567890')
Expand Down Expand Up @@ -575,10 +562,7 @@ def cluster_application_update(cli_ctx,


def resolve_rp_client_id():
if rp_mode_production():
return FP_CLIENT_ID

return os.environ.get('AZURE_FP_CLIENT_ID', FP_CLIENT_ID)
return FP_CLIENT_ID


def ensure_resource_permissions(cli_ctx, oc, fail, sp_obj_ids):
Expand Down

0 comments on commit d7b0a63

Please sign in to comment.