Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
bf63231
flexible server migration
DaeunYim Feb 7, 2021
a018b7d
single server migration draft
DaeunYim Feb 8, 2021
65fe403
style fixed
DaeunYim Feb 8, 2021
5abef3c
allow large reponse for proxy test
DaeunYim Feb 8, 2021
8b16281
singles server test fixed
DaeunYim Feb 9, 2021
75cd854
minor bugs fixed
DaeunYim Feb 9, 2021
822c738
linter and style issues fixed
DaeunYim Feb 9, 2021
dfe3896
config files added
DaeunYim Feb 10, 2021
bdd876c
empty commit
DaeunYim Feb 10, 2021
7a144d7
empty commit
DaeunYim Feb 18, 2021
ecd6dd2
pulled dev repo
DaeunYim Mar 2, 2021
6d83a71
pulled from dev
DaeunYim Mar 3, 2021
221f2e4
fix recording files for the migration code
DaeunYim Mar 3, 2021
f037cac
fixed mariadb failing test case
DaeunYim Mar 3, 2021
8acc000
fix for failing test cases
DaeunYim Mar 4, 2021
8fd0fa0
fixed typo
DaeunYim Mar 4, 2021
0c25766
Merge branch 'dev' of https://github.com/Azure/azure-cli into python-…
DaeunYim Mar 5, 2021
fdce3c9
change datetime function to accomodate python 3.6
DaeunYim Mar 6, 2021
cc30375
takes care of two different time input
DaeunYim Mar 6, 2021
ab1eb2e
style fixed
DaeunYim Mar 6, 2021
2154e3a
restore source parameter added
DaeunYim Mar 9, 2021
7486023
bug fix auth, LRO polling commands, object create by dict
DaeunYim Mar 10, 2021
16aa866
Merge branch 'python-sdk-migration-2' of https://github.com/DaeunYim/…
DaeunYim Mar 10, 2021
dfe33e0
restore reverted to no source parameters
DaeunYim Mar 10, 2021
62d0d4c
db for pg
DaeunYim Mar 10, 2021
d317139
added pg db tests
DaeunYim Mar 10, 2021
dc9e44c
help text updated and recording files updated with the database change
DaeunYim Mar 11, 2021
0ef1240
empty commit
DaeunYim Mar 11, 2021
98b9265
Merge branch 'dev' into python-sdk-migration-2
DaeunYim Mar 11, 2021
e85714d
empty commit
DaeunYim Mar 11, 2021
f2e589f
Merge branch 'dev' into s184
DaeunYim Mar 11, 2021
5477413
revert resource module
DaeunYim Mar 11, 2021
61ce4e1
Merge branch 's184' of https://github.com/DaeunYim/azure-cli into s184
DaeunYim Mar 11, 2021
3d71790
id = child name fix
DaeunYim Mar 12, 2021
bb840b3
Merge branch 'python-sdk-migration-2' of https://github.com/DaeunYim/…
DaeunYim Mar 12, 2021
45703ac
Merge branch 'dev' of https://github.com/Azure/azure-cli into python-…
DaeunYim Mar 15, 2021
945de4d
network module test failure fixed
DaeunYim Mar 15, 2021
415d161
pulled migration branch
DaeunYim Mar 15, 2021
1953b87
pulled merged sdk migration
DaeunYim Mar 16, 2021
11cc8ea
remove and fix rdbms params file
DaeunYim Mar 16, 2021
52feb43
fix typo
DaeunYim Mar 17, 2021
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
Prev Previous commit
Next Next commit
fix for failing test cases
  • Loading branch information
DaeunYim committed Mar 4, 2021
commit 8acc000097590e1e5435cd24020dbc597d46fd2d
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def create_firewall_rule(db_context, cmd, resource_group_name, server_name, star
firewall = firewall_rule_create_func(firewall_client, resource_group_name, server_name, firewall_rule_name=firewall_name,
start_ip_address=start_ip, end_ip_address=end_ip)

return firewall.name
return firewall.result()


# pylint: disable=inconsistent-return-statements
Expand Down
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/rdbms/_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ def create_firewall_rule(cmd, resource_group_name, server_name, start_ip, end_ip

firewall = firewall_client.begin_create_or_update(resource_group_name, server_name, firewall_name, parameters)

return firewall.name
return firewall.result().name
2 changes: 1 addition & 1 deletion src/azure-cli/azure/cli/command_modules/rdbms/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ def _server_delete(cmd, client, resource_group_name, server_name):
local_context_file = cmd.cli_ctx.local_context._get_local_context_file() # pylint: disable=protected-access
local_context_file.remove_option('{}'.format(database_engine), 'server_name')

return result
return result.result()


def _get_sku_name(tier, family, capacity):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def firewall_rule_delete_func(client, resource_group_name, server_name, firewall
result = client.begin_delete(resource_group_name, server_name, firewall_rule_name)
except Exception as ex: # pylint: disable=broad-except
logger.error(ex)
return result
return result.result()


def flexible_firewall_rule_custom_getter(client, resource_group_name, server_name, firewall_rule_name):
Expand Down Expand Up @@ -132,7 +132,7 @@ def database_delete_func(client, resource_group_name=None, server_name=None, dat
result = client.begin_delete(resource_group_name, server_name, database_name)
except Exception as ex: # pylint: disable=broad-except
logger.error(ex)
return result
return result.result()


def user_confirmation(message, yes=False):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# --------------------------------------------------------------------------------------------

# pylint: disable=unused-argument, line-too-long

import datetime as dt
from datetime import datetime
from msrestazure.azure_exceptions import CloudError
from msrestazure.tools import resource_id, is_valid_resource_id, parse_resource_id # pylint: disable=import-error
from knack.log import get_logger
Expand Down Expand Up @@ -142,6 +143,9 @@ def flexible_server_restore(cmd, client, resource_group_name, server_name, sourc
else:
raise ValueError('The provided source-server {} is invalid.'.format(source_server))

restore_point_in_time = datetime.fromisoformat(restore_point_in_time)
restore_point_in_time = restore_point_in_time.replace(tzinfo=dt.timezone.utc)

parameters = mysql_flexibleservers.models.Server(
source_server_id=source_server,
restore_point_in_time=restore_point_in_time,
Expand Down Expand Up @@ -289,6 +293,7 @@ def flexible_server_update_custom_func(cmd, instance,
instance.delegated_subnet_arguments.subnet_arm_resource_id = subnet_arm_resource_id

if maintenance_window:
logger.warning('If you are updating maintenancw window with other parameter, maintenance window will be updated first. Please update the other parameters later.')
# if disabled is pass in reset to default values
if maintenance_window.lower() == "disabled":
day_of_week = start_hour = start_minute = 0
Expand All @@ -311,15 +316,16 @@ def flexible_server_update_custom_func(cmd, instance,
instance.maintenance_window.start_minute = start_minute
instance.maintenance_window.custom_window = custom_window

return ServerForUpdate(maintenance_window=instance.maintenance_window)

params = ServerForUpdate(sku=instance.sku,
storage_profile=instance.storage_profile,
administrator_login_password=administrator_login_password,
ssl_enforcement=ssl_enforcement,
delegated_subnet_arguments=instance.delegated_subnet_arguments,
tags=tags,
ha_enabled=ha_enabled,
replication_role=replication_role,
maintenance_window=instance.maintenance_window)
replication_role=replication_role)

if assign_identity:
if server_module_path.find('mysql'):
Expand Down Expand Up @@ -351,7 +357,7 @@ def server_delete_func(cmd, client, resource_group_name=None, server_name=None,
except Exception as ex: # pylint: disable=broad-except
logger.error(ex)
raise CLIError(ex)
return result
return result.result()


# Parameter update command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# --------------------------------------------------------------------------------------------

# pylint: disable=unused-argument, line-too-long

import datetime as dt
from datetime import datetime
from msrestazure.azure_exceptions import CloudError
from msrestazure.tools import resource_id, is_valid_resource_id, parse_resource_id # pylint: disable=import-error
from knack.log import get_logger
Expand Down Expand Up @@ -141,13 +142,15 @@ def flexible_server_restore(cmd, client,
else:
source_server_id = source_server

restore_point_in_time = datetime.fromisoformat(restore_point_in_time)
restore_point_in_time = restore_point_in_time.replace(tzinfo=dt.timezone.utc)

parameters = postgresql_flexibleservers.models.Server(
point_in_time_utc=restore_point_in_time,
source_server_name=source_server, # this should be the source server name, not id
create_mode="PointInTimeRestore",
availability_zone=zone,
location=location,
server_name=server_name)
location=location)

# Retrieve location from same location as source server
id_parts = parse_resource_id(source_server_id)
Expand Down Expand Up @@ -256,7 +259,7 @@ def server_delete_func(cmd, client, resource_group_name=None, server_name=None,
except Exception as ex: # pylint: disable=broad-except
logger.error(ex)
raise CLIError(ex)
return result
return result.result()


# Wait command
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interactions:
uri: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.DBForMySql/flexibleServers/azuredbclitest-000002?api-version=2020-07-01-preview
response:
body:
string: '{"sku":{"name":"Standard_B1ms","tier":"Burstable","capacity":0},"properties":{"administratorLogin":"violentBobcat3","storageProfile":{"storageMB":262144,"storageIops":640,"backupRetentionDays":7,"storageAutogrow":"Disabled","fileStorageSkuName":"Premium_LRS"},"version":"5.7","state":"Ready","haState":"NotEnabled","fullyQualifiedDomainName":"azuredbclitest-000002.mysql.database.azure.com","sourceServerId":"","publicNetworkAccess":"Enabled","sslEnforcement":"Disabled","haEnabled":"Disabled","availabilityZone":"3","earliestRestoreDate":"2020-12-30T06:04:38.002554+00:00","maintenanceWindow":{"customWindow":"Disabled","dayOfWeek":0,"startHour":0,"startMinute":0},"replicationRole":"None","replicaCapacity":10,"byokEnforcement":"Disabled"},"location":"East
string: '{"sku":{"name":"Standard_B1ms","tier":"Burstable","capacity":0},"properties":{"administratorLogin":"violentBobcat3","storageProfile":{"storageMB":262144,"storageIops":640,"backupRetentionDays":7,"storageAutogrow":"Disabled","fileStorageSkuName":"Premium_LRS"},"version":"5.7","state":"Ready","haState":"NotEnabled","fullyQualifiedDomainName":"azuredbclitest-000002.mysql.database.azure.com","sourceServerId":"","publicNetworkAccess":"Enabled","sslEnforcement":"Disabled","haEnabled":"Disabled","availabilityZone":"3","earliestRestoreDate":"2020-12-30T06:04:38.002554+00:00","maintenanceWindow":{"customWindow":"Disabled","dayOfWeek":0,"startHour":0,"startMinute":0},"replicationRole":"Source","replicaCapacity":10,"byokEnforcement":"Disabled"},"location":"East
US 2 EUAP","id":"/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/clitest.rg000001/providers/Microsoft.DBforMySQL/flexibleServers/azuredbclitest-000002","name":"azuredbclitest-000002","type":"Microsoft.DBforMySQL/flexibleServers"}'
headers:
cache-control:
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ def _test_flexible_server_update_scale_down(self, database_engine, resource_grou
checks=[JMESPathCheck('sku.tier', tier),
JMESPathCheck('sku.name', sku_name)])

def _test_flexible_server_upadte_mmw(self, database_engine, resource_group, server):
def _test_flexible_server_update_mmw(self, database_engine, resource_group, server):

self.cmd('{} flexible-server update -g {} -n {} --maintenance-window Mon:1:30'
.format(database_engine, resource_group, server),
Expand Down Expand Up @@ -587,7 +587,10 @@ def _test_mgmt_validator(self, database_engine, resource_group):
elif database_engine == 'mysql':
tier = 'GeneralPurpose'
version = 5.7
sku_name = 'Standard_D2s_v3'
if location == 'eastus2euap':
sku_name = 'Standard_D2s_v3'
else:
sku_name = 'Standard_D2ds_v4'
storage_size = 20
storage_size_mb = storage_size * 1024
backup_retention = 10
Expand Down Expand Up @@ -648,7 +651,7 @@ def _test_flexible_server_replica_stop(self, database_engine, resource_group, ma

result = self.cmd('{} flexible-server show -g {} --name {} '
.format(database_engine, resource_group, master_server),
checks=[JMESPathCheck('replicationRole', 'None')]).get_output_in_json()
checks=[JMESPathCheck('replicationRole', 'Source')]).get_output_in_json()

self.cmd('{} flexible-server replica stop-replication -g {} --name {} --yes'
.format(database_engine, resource_group, replicas[0]),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ def _test_flexible_server_local_context(self, database_engine, resource_group):

local_context_info = self.cmd('config param-persist show').get_output_in_json()

self.cmd('{} flexible-server show'.format(database_engine),
checks=[JMESPathCheck('resourceGroup', local_context_info['all']['resource_group_name']),
JMESPathCheck('location', 'East US 2 EUAP'),
JMESPathCheck('name', local_context_info[database_engine + ' flexible-server']['server_name']),
JMESPathCheck('administratorLogin', local_context_info[database_engine + ' flexible-server']['administrator_login'])])
show_result = self.cmd('{} flexible-server show'.format(database_engine),
checks=[JMESPathCheck('resourceGroup', local_context_info['all']['resource_group_name']),
JMESPathCheck('name', local_context_info[database_engine + ' flexible-server']['server_name']),
JMESPathCheck('administratorLogin', local_context_info[database_engine + ' flexible-server']['administrator_login'])]).get_output_in_json()
self.assertEqual(''.join(show_result['location'].lower().split()), location)

self.cmd('{} flexible-server show-connection-string'.format(database_engine),
checks=[StringContainCheck(local_context_info[database_engine + ' flexible-server']['administrator_login'])]).get_output_in_json()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,14 +93,14 @@ def test_mysql_flexible_server_update_scale_up(self):
def test_mysql_flexible_server_update_scale_down(self):
self._test_flexible_server_update_scale_down('mysql', self.resource_group, self.server)

# @AllowLargeResponse()
# @pytest.mark.depends(on=['MySqlFlexibleServerMgmtScenarioTest::test_mysql_flexible_server_update_scale_down'])
# def test_mysql_flexible_server_upadte_mmw(self):
# self._test_flexible_server_upadte_mmw('mysql', self.resource_group, self.server)
@AllowLargeResponse()
@pytest.mark.depends(on=['MySqlFlexibleServerMgmtScenarioTest::test_mysql_flexible_server_update_scale_down'])
def test_mysql_flexible_server_update_mmw(self):
self._test_flexible_server_update_mmw('mysql', self.resource_group, self.server)

@AllowLargeResponse()
@pytest.mark.order(8)
@pytest.mark.depends(on=['MySqlFlexibleServerMgmtScenarioTest::test_mysql_flexible_server_update_scale_down'])
@pytest.mark.depends(on=['MySqlFlexibleServerMgmtScenarioTest::test_mysql_flexible_server_update_mmw'])
def test_mysql_flexible_server_update_tag(self):
self._test_flexible_server_update_tag('mysql', self.resource_group, self.server)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,12 @@ def test_postgres_flexible_server_update_scale_down(self):
@AllowLargeResponse()
@pytest.mark.order(8)
@pytest.mark.depends(on=['PostgresFlexibleServerMgmtScenarioTest::test_postgres_flexible_server_update_scale_down'])
def test_postgres_flexible_server_upadte_mmw(self):
self._test_flexible_server_upadte_mmw('postgres', self.resource_group, self.server)
def test_postgres_flexible_server_update_mmw(self):
self._test_flexible_server_update_mmw('postgres', self.resource_group, self.server)

@AllowLargeResponse()
@pytest.mark.order(9)
@pytest.mark.depends(on=['PostgresFlexibleServerMgmtScenarioTest::test_postgres_flexible_server_upadte_mmw'])
@pytest.mark.depends(on=['PostgresFlexibleServerMgmtScenarioTest::test_postgres_flexible_server_update_mmw'])
def test_postgres_flexible_server_update_tag(self):
self._test_flexible_server_update_tag('postgres', self.resource_group, self.server)

Expand Down