Fix for updating the name in case of host record and network view and also display meaningful error in case of connection timeout (#40597)

* To fix following github issues 35774, 36574 and 39494

* To fix following github issues 35774, 36574 and 39494

* To fix following github issues 35774, 36574 and 39494

* To fix following github issues 35774, 36574 and 39494

* To fix following github issues 35774, 36574 and 39494

* To fix following github issues 35774, 36574 and 39494

* removed old_name new entry to make ui cleaner

* removed old_name new entry to make ui cleaner

* removed old_name new entry to make ui cleaner

* removed old_name new entry to make ui cleaner

* removed old_name new entry to make ui cleaner

* removed old_name new entry to make ui cleaner

* to resolve the bug 40709

* reslove shippable error

* reslove shippable error

* reslove shippable error

* reslove shippable error

* reslove shippable error

* reslove shippable error

* reslove shippable error

* reslove shippable error

* reslove shippable error

* to fix shippable nios automation error

* modified the name input parsing method

* modified the name input parsing method

* modified the name input parsing method

* modified the name input parsing method

* modified the name input parsing method

* modified the name input parsing method

* modified the name input parsing method

* modified the name input parsing method

* modified the name input parsing method

* shippable error fix

* shippable error fix

* shippable error fix

* shippable error fix

* shippable error fix

* review comment fix

* shippable error fix

* shippable error fix
This commit is contained in:
Sumit Jaiswal
2018-05-31 12:25:15 +05:30
committed by GitHub
parent 6d3a1786cc
commit 81510970ae
13 changed files with 156 additions and 135 deletions

View File

@@ -56,7 +56,7 @@ class TestNiosApi(unittest.TestCase):
{
"comment": "test comment",
"_ref": "networkview/ZG5zLm5ldHdvcmtfdmlldyQw:default/true",
"name": "default",
"name": self.module._check_type_dict().__getitem__(),
"extattrs": {}
}
]
@@ -144,6 +144,7 @@ class TestNiosApi(unittest.TestCase):
kwargs = copy.deepcopy(test_object[0])
kwargs['extattrs']['Site']['value'] = 'update'
kwargs['name'] = self.module._check_type_dict().__getitem__()
del kwargs['_ref']
wapi = self._get_wapi(test_object)
@@ -159,7 +160,7 @@ class TestNiosApi(unittest.TestCase):
test_object = [{
"comment": "test comment",
"_ref": "networkview/ZG5zLm5ldHdvcmtfdmlldyQw:default/true",
"name": "default",
"name": self.module._check_type_dict().__getitem__(),
"extattrs": {'Site': {'value': 'test'}}
}]
@@ -190,7 +191,7 @@ class TestNiosApi(unittest.TestCase):
res = wapi.run('testobject', test_spec)
self.assertTrue(res['changed'])
wapi.create_object.assert_called_once_with('testobject', {'name': 'ansible'})
wapi.create_object.assert_called_once_with('testobject', {'name': self.module._check_type_dict().__getitem__()})
def test_wapi_delete(self):
self.module.params = {'provider': None, 'state': 'absent', 'name': 'ansible',
@@ -240,6 +241,7 @@ class TestNiosApi(unittest.TestCase):
kwargs = test_object[0].copy()
ref = kwargs.pop('_ref')
kwargs['comment'] = 'updated comment'
kwargs['name'] = self.module._check_type_dict().__getitem__()
del kwargs['network_view']
del kwargs['extattrs']

View File

@@ -75,7 +75,7 @@ class TestNiosDnsViewModule(TestNiosModule):
res = wapi.run('testobject', test_spec)
self.assertTrue(res['changed'])
wapi.create_object.assert_called_once_with('testobject', {'name': 'ansible-dns'})
wapi.create_object.assert_called_once_with('testobject', {'name': self.module._check_type_dict().__getitem__()})
def test_nios_dns_view_update_comment(self):
self.module.params = {'provider': None, 'state': 'present', 'name': 'ansible-dns',

View File

@@ -64,7 +64,6 @@ class TestNiosHostRecordModule(TestNiosModule):
'comment': None, 'extattrs': None}
test_object = None
test_spec = {
"name": {"ib_req": True},
"comment": {},
@@ -76,7 +75,7 @@ class TestNiosHostRecordModule(TestNiosModule):
res = wapi.run('testobject', test_spec)
self.assertTrue(res['changed'])
wapi.create_object.assert_called_once_with('testobject', {'name': 'ansible'})
wapi.create_object.assert_called_once_with('testobject', {'name': self.module._check_type_dict().__getitem__()})
def test_nios_host_record_remove(self):
self.module.params = {'provider': None, 'state': 'absent', 'name': 'ansible',
@@ -128,7 +127,7 @@ class TestNiosHostRecordModule(TestNiosModule):
wapi.update_object.called_once_with(test_object)
def test_nios_host_record_update_record_name(self):
self.module.params = {'provider': None, 'state': 'present', 'name': 'default', 'old_name': 'old_default',
self.module.params = {'provider': None, 'state': 'present', 'name': {'new_name': 'default', 'old_name': 'old_default'},
'comment': 'comment', 'extattrs': None}
test_object = [

View File

@@ -100,20 +100,20 @@ class TestNiosNetworkModule(TestNiosModule):
self.assertTrue(res['changed'])
def test_nios_network_ipv6_dhcp_update(self):
self.module.params = {'provider': None, 'state': 'present', 'network': 'fe80::/64',
self.module.params = {'provider': None, 'state': 'present', 'ipv6network': 'fe80::/64',
'comment': 'updated comment', 'extattrs': None}
test_object = [
{
"comment": "test comment",
"_ref": "ipv6network/ZG5zLm5ldHdvcmtfdmlldyQw:default/true",
"network": "fe80::/64",
"ipv6network": "fe80::/64",
"extattrs": {'options': {'name': 'test', 'value': 'ansible.com'}}
}
]
test_spec = {
"network": {"ib_req": True},
"ipv6network": {"ib_req": True},
"comment": {},
"extattrs": {}
}
@@ -148,13 +148,13 @@ class TestNiosNetworkModule(TestNiosModule):
wapi.delete_object.assert_called_once_with(ref)
def test_nios_network_ipv6_create(self):
self.module.params = {'provider': None, 'state': 'present', 'network': 'fe80::/64',
self.module.params = {'provider': None, 'state': 'present', 'ipv6network': 'fe80::/64',
'comment': None, 'extattrs': None}
test_object = None
test_spec = {
"network": {"ib_req": True},
"ipv6network": {"ib_req": True},
"comment": {},
"extattrs": {}
}
@@ -164,10 +164,10 @@ class TestNiosNetworkModule(TestNiosModule):
res = wapi.run('testobject', test_spec)
self.assertTrue(res['changed'])
wapi.create_object.assert_called_once_with('testobject', {'network': 'fe80::/64'})
wapi.create_object.assert_called_once_with('testobject', {'ipv6network': 'fe80::/64'})
def test_nios_network_ipv6_remove(self):
self.module.params = {'provider': None, 'state': 'absent', 'network': 'fe80::/64',
self.module.params = {'provider': None, 'state': 'absent', 'ipv6network': 'fe80::/64',
'comment': None, 'extattrs': None}
ref = "ipv6network/ZG5zLm5ldHdvcmtfdmlldyQw:ansible/false"
@@ -175,12 +175,12 @@ class TestNiosNetworkModule(TestNiosModule):
test_object = [{
"comment": "test comment",
"_ref": ref,
"network": "fe80::/64",
"ipv6network": "fe80::/64",
"extattrs": {'Site': {'value': 'test'}}
}]
test_spec = {
"network": {"ib_req": True},
"ipv6network": {"ib_req": True},
"comment": {},
"extattrs": {}
}

View File

@@ -75,7 +75,7 @@ class TestNiosNetworkViewModule(TestNiosModule):
res = wapi.run('testobject', test_spec)
self.assertTrue(res['changed'])
wapi.create_object.assert_called_once_with('testobject', {'name': 'ansible'})
wapi.create_object.assert_called_once_with('testobject', {'name': self.module._check_type_dict().__getitem__()})
def test_nios_network_view_update_comment(self):
self.module.params = {'provider': None, 'state': 'present', 'name': 'default',

View File

@@ -59,13 +59,13 @@ class TestNiosZoneModule(TestNiosModule):
self.load_config.return_value = dict(diff=None, session='session')
def test_nios_zone_create(self):
self.module.params = {'provider': None, 'state': 'present', 'name': 'ansible.com',
self.module.params = {'provider': None, 'state': 'present', 'fqdn': 'ansible.com',
'comment': None, 'extattrs': None}
test_object = None
test_spec = {
"name": {"ib_req": True},
"fqdn": {"ib_req": True},
"comment": {},
"extattrs": {}
}
@@ -75,10 +75,10 @@ class TestNiosZoneModule(TestNiosModule):
res = wapi.run('testobject', test_spec)
self.assertTrue(res['changed'])
wapi.create_object.assert_called_once_with('testobject', {'name': 'ansible.com'})
wapi.create_object.assert_called_once_with('testobject', {'fqdn': 'ansible.com'})
def test_nios_zone_remove(self):
self.module.params = {'provider': None, 'state': 'absent', 'name': 'ansible.com',
self.module.params = {'provider': None, 'state': 'absent', 'fqdn': 'ansible.com',
'comment': None, 'extattrs': None}
ref = "zone/ZG5zLm5ldHdvcmtfdmlldyQw:ansible/false"
@@ -86,12 +86,12 @@ class TestNiosZoneModule(TestNiosModule):
test_object = [{
"comment": "test comment",
"_ref": ref,
"name": "ansible.com",
"fqdn": "ansible.com",
"extattrs": {'Site': {'value': 'test'}}
}]
test_spec = {
"name": {"ib_req": True},
"fqdn": {"ib_req": True},
"comment": {},
"extattrs": {}
}
@@ -102,20 +102,20 @@ class TestNiosZoneModule(TestNiosModule):
wapi.delete_object.assert_called_once_with(ref)
def test_nios_zone_update_comment(self):
self.module.params = {'provider': None, 'state': 'present', 'name': 'ansible.com',
self.module.params = {'provider': None, 'state': 'present', 'fqdn': 'ansible.com',
'comment': 'updated comment', 'extattrs': None}
test_object = [
{
"comment": "test comment",
"_ref": "zone/ZG5zLm5ldHdvcmtfdmlldyQw:default/true",
"name": "ansible.com",
"fqdn": "ansible.com",
"extattrs": {'Site': {'value': 'test'}}
}
]
test_spec = {
"name": {"ib_req": True},
"fqdn": {"ib_req": True},
"comment": {},
"extattrs": {}
}