Skip to content
This repository has been archived by the owner on Aug 10, 2024. It is now read-only.

Commit

Permalink
Remove PostgreSQL from AzCloud plugin
Browse files Browse the repository at this point in the history
Removed PosgreSQL from AzCloud plugin as this has been moved to the
`AzPostgres` cloud plugin
  • Loading branch information
mitprasoon committed Jan 10, 2020
1 parent f0ee75c commit 8e9aed1
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 36 deletions.
10 changes: 2 additions & 8 deletions cloudmarker/clouds/azcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from azure.mgmt.compute import ComputeManagementClient
from azure.mgmt.network import NetworkManagementClient
from azure.mgmt.rdbms.mysql import MySQLManagementClient
from azure.mgmt.rdbms.postgresql import PostgreSQLManagementClient
from azure.mgmt.resource import ResourceManagementClient, SubscriptionClient
from azure.mgmt.storage import StorageManagementClient
from azure.mgmt.web import WebSiteManagementClient
Expand Down Expand Up @@ -90,7 +89,7 @@ def _get_subscriptions(self):
record_types = ('virtual_machine', 'app_gateway', 'lb', 'nic',
'nsg', 'public_ip', 'storage_account',
'resource_group', 'mysql_server',
'postgresql_server', 'web_apps', 'subscription')
'web_apps', 'subscription')

tenant = self._tenant
for sub_index, sub in enumerate(sub_list):
Expand Down Expand Up @@ -225,10 +224,6 @@ def _get_resource_iterator(record_type, credentials,
client = MySQLManagementClient(credentials, sub_id)
return client.servers.list()

if record_type == 'postgresql_server':
client = PostgreSQLManagementClient(credentials, sub_id)
return client.servers.list()

if record_type == 'web_apps':
client = WebSiteManagementClient(credentials, sub_id)
return client.web_apps.list()
Expand Down Expand Up @@ -262,7 +257,6 @@ def _get_record(iterator, azure_record_type, max_recs,
record_type_map = {
'virtual_machine': 'compute',
'mysql_server': 'rdbms',
'postgresql_server': 'rdbms',
}

for i, v in enumerate(iterator):
Expand Down Expand Up @@ -295,7 +289,7 @@ def _get_record(iterator, azure_record_type, max_recs,
yield from _get_normalized_firewall_rules(
record, sub_index, sub, tenant)

if azure_record_type in ['mysql_server', 'postgresql_server']:
if azure_record_type in ['mysql_server']:
yield from _get_normalized_rdbms_record(record)
return

Expand Down
28 changes: 0 additions & 28 deletions cloudmarker/test/test_azcloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,6 @@ def setUp(self):
self._MockMySQLManagementClient = m
m().servers.list.return_value = [mock_record]

m = self._patch('PostgreSQLManagementClient')
self._MockPostgreSQLManagementClient = m
m().servers.list.return_value = [mock_record]

def test_nsg_single_security_rule(self):
mock_nsg_dict = {'security_rules': [{}]}
mock_nsg = SimpleMock(mock_nsg_dict)
Expand Down Expand Up @@ -584,27 +580,3 @@ def test_mysql_server_record(self):
'azure_mysql_server_id')
self.assertEqual(records[0]['com']['record_type'],
'rdbms')

def test_postgresql_server_record(self):
mock_postgresql_server_dict = {
'id': 'azure_postgresql_server_id',
'ssl_enforcement': 'Enabled',
}
mock_postgresql_server = SimpleMock(mock_postgresql_server_dict)

m = self._MockPostgreSQLManagementClient
m().servers.list.return_value = [mock_postgresql_server]

records = list(azcloud.AzCloud('', '', '').read())
records = [
r for r in records
if r['ext']['record_type'] == 'postgresql_server'
]
self.assertEqual(records[0]['com']['tls_enforced'],
True)
self.assertEqual(records[0]['ext']['reference'],
'azure_postgresql_server_id')
self.assertEqual(records[0]['com']['reference'],
'azure_postgresql_server_id')
self.assertEqual(records[0]['com']['record_type'],
'rdbms')

0 comments on commit 8e9aed1

Please sign in to comment.