Disable ec2 collector for deployed-server
In the deployed-server metadata that configures os-collect-config, the ec2 collector should not be enabled. ec2 metadata is not typically available when using the deployed-server resource. Closes-Bug: #1669842 Change-Id: I33e062b70fdf298908656a8ed3e62ac7cae16a37
This commit is contained in:
parent
ab267e763a
commit
00b82577f1
@ -688,6 +688,7 @@ class Server(server_base.BaseServer, sh.SchedulerHintsMixin,
|
|||||||
super(Server, self).__init__(name, json_snippet, stack)
|
super(Server, self).__init__(name, json_snippet, stack)
|
||||||
if self.user_data_software_config():
|
if self.user_data_software_config():
|
||||||
self._register_access_key()
|
self._register_access_key()
|
||||||
|
self.default_collectors = ['ec2']
|
||||||
|
|
||||||
def _config_drive(self):
|
def _config_drive(self):
|
||||||
# This method is overridden by the derived CloudServer resource
|
# This method is overridden by the derived CloudServer resource
|
||||||
|
@ -36,6 +36,7 @@ class BaseServer(stack_user.StackUser):
|
|||||||
|
|
||||||
def __init__(self, name, json_snippet, stack):
|
def __init__(self, name, json_snippet, stack):
|
||||||
super(BaseServer, self).__init__(name, json_snippet, stack)
|
super(BaseServer, self).__init__(name, json_snippet, stack)
|
||||||
|
self.default_collectors = []
|
||||||
|
|
||||||
def _server_name(self):
|
def _server_name(self):
|
||||||
name = self.properties[self.NAME]
|
name = self.properties[self.NAME]
|
||||||
@ -48,7 +49,7 @@ class BaseServer(stack_user.StackUser):
|
|||||||
meta['deployments'] = meta.get('deployments', [])
|
meta['deployments'] = meta.get('deployments', [])
|
||||||
meta['os-collect-config'] = meta.get('os-collect-config', {})
|
meta['os-collect-config'] = meta.get('os-collect-config', {})
|
||||||
occ = meta['os-collect-config']
|
occ = meta['os-collect-config']
|
||||||
collectors = ['ec2']
|
collectors = list(self.default_collectors)
|
||||||
occ['collectors'] = collectors
|
occ['collectors'] = collectors
|
||||||
|
|
||||||
# set existing values to None to override any boot-time config
|
# set existing values to None to override any boot-time config
|
||||||
|
@ -137,7 +137,7 @@ class DeployedServersTest(common.HeatTestCase):
|
|||||||
'request': {
|
'request': {
|
||||||
'metadata_url': metadata_url
|
'metadata_url': metadata_url
|
||||||
},
|
},
|
||||||
'collectors': ['ec2', 'request', 'local']
|
'collectors': ['request', 'local']
|
||||||
},
|
},
|
||||||
'deployments': []
|
'deployments': []
|
||||||
}, server.metadata_get())
|
}, server.metadata_get())
|
||||||
@ -188,7 +188,7 @@ class DeployedServersTest(common.HeatTestCase):
|
|||||||
'secret_access_key': '8901',
|
'secret_access_key': '8901',
|
||||||
'stack_name': 'server_sc_s'
|
'stack_name': 'server_sc_s'
|
||||||
},
|
},
|
||||||
'collectors': ['ec2', 'cfn', 'local']
|
'collectors': ['cfn', 'local']
|
||||||
},
|
},
|
||||||
'deployments': []
|
'deployments': []
|
||||||
}, server.metadata_get())
|
}, server.metadata_get())
|
||||||
@ -208,7 +208,7 @@ class DeployedServersTest(common.HeatTestCase):
|
|||||||
'secret_access_key': '8901',
|
'secret_access_key': '8901',
|
||||||
'stack_name': 'server_sc_s'
|
'stack_name': 'server_sc_s'
|
||||||
},
|
},
|
||||||
'collectors': ['ec2', 'cfn', 'local'],
|
'collectors': ['cfn', 'local'],
|
||||||
'polling_interval': 10
|
'polling_interval': 10
|
||||||
},
|
},
|
||||||
'deployments': []
|
'deployments': []
|
||||||
@ -251,7 +251,7 @@ class DeployedServersTest(common.HeatTestCase):
|
|||||||
'stack_id': 'server_heat_s/%s' % stack.id,
|
'stack_id': 'server_heat_s/%s' % stack.id,
|
||||||
'user_id': '1234'
|
'user_id': '1234'
|
||||||
},
|
},
|
||||||
'collectors': ['ec2', 'heat', 'local']
|
'collectors': ['heat', 'local']
|
||||||
},
|
},
|
||||||
'deployments': []
|
'deployments': []
|
||||||
}, server.metadata_get())
|
}, server.metadata_get())
|
||||||
@ -270,7 +270,7 @@ class DeployedServersTest(common.HeatTestCase):
|
|||||||
'stack_id': 'server_heat_s/%s' % stack.id,
|
'stack_id': 'server_heat_s/%s' % stack.id,
|
||||||
'user_id': '1234'
|
'user_id': '1234'
|
||||||
},
|
},
|
||||||
'collectors': ['ec2', 'heat', 'local'],
|
'collectors': ['heat', 'local'],
|
||||||
'polling_interval': 10
|
'polling_interval': 10
|
||||||
},
|
},
|
||||||
'deployments': []
|
'deployments': []
|
||||||
@ -327,7 +327,7 @@ class DeployedServersTest(common.HeatTestCase):
|
|||||||
'project_id': '8888',
|
'project_id': '8888',
|
||||||
'queue_id': queue_id
|
'queue_id': queue_id
|
||||||
},
|
},
|
||||||
'collectors': ['ec2', 'zaqar', 'local']
|
'collectors': ['zaqar', 'local']
|
||||||
},
|
},
|
||||||
'deployments': []
|
'deployments': []
|
||||||
}, server.metadata_get())
|
}, server.metadata_get())
|
||||||
@ -344,7 +344,7 @@ class DeployedServersTest(common.HeatTestCase):
|
|||||||
'project_id': '8888',
|
'project_id': '8888',
|
||||||
'queue_id': queue_id
|
'queue_id': queue_id
|
||||||
},
|
},
|
||||||
'collectors': ['ec2', 'zaqar', 'local'],
|
'collectors': ['zaqar', 'local'],
|
||||||
'polling_interval': 10
|
'polling_interval': 10
|
||||||
},
|
},
|
||||||
'deployments': []
|
'deployments': []
|
||||||
|
Loading…
Reference in New Issue
Block a user