def set_cloud(cloud_name, profile=None): try: switch_active_cloud(cloud_name) if profile: modify_cloud(cloud_name=cloud_name, profile=profile) except CloudNotRegisteredException as e: raise CLIError(e)
def test_switch_active_cloud(self, subscription_setter): cli = mock.MagicMock() switch_active_cloud(cli, 'AzureGermanCloud') self.assertEqual(cli.cloud.name, 'AzureGermanCloud') switch_active_cloud(cli, 'AzureChinaCloud') self.assertEqual(cli.cloud.name, 'AzureChinaCloud')
def test_switch_active_cloud(self, subscription_setter): cli = mock.MagicMock() switch_active_cloud(cli, 'AzureGermanCloud') self.assertEqual(cli.cloud.name, 'AzureGermanCloud') switch_active_cloud(cli, 'AzureChinaCloud') self.assertEqual(cli.cloud.name, 'AzureChinaCloud')
def set_cloud(cmd, cloud_name, profile=None): try: switch_active_cloud(cmd.cli_ctx, cloud_name) if profile: modify_cloud(cmd, cloud_name=cloud_name, profile=profile) except CloudNotRegisteredException as e: raise CLIError(e)
def set_cloud(cloud_name): try: switch_active_cloud(cloud_name) except CloudNotRegisteredException as e: raise CLIError(e)
def set_cloud(cloud_name): try: switch_active_cloud(cloud_name) except CloudNotRegisteredException as e: raise CLIError(e)