Merge "Build list of enabled os-collect-config collectors"
This commit is contained in:
commit
1211d6340e
@ -581,6 +581,9 @@ class Server(stack_user.StackUser, sh.SchedulerHintsMixin,
|
||||
meta['deployments'] = meta.get('deployments', [])
|
||||
meta['os-collect-config'] = meta.get('os-collect-config', {})
|
||||
occ = meta['os-collect-config']
|
||||
collectors = ['ec2']
|
||||
occ['collectors'] = collectors
|
||||
|
||||
# set existing values to None to override any boot-time config
|
||||
occ_keys = ('heat', 'zaqar', 'cfn', 'request')
|
||||
for occ_key in occ_keys:
|
||||
@ -598,21 +601,18 @@ class Server(stack_user.StackUser, sh.SchedulerHintsMixin,
|
||||
'project_id': self.stack.stack_user_project_id,
|
||||
'stack_id': self.stack.identifier().stack_path(),
|
||||
'resource_name': self.name}})
|
||||
collectors.append('heat')
|
||||
|
||||
elif self.transport_zaqar_message(props):
|
||||
queue_id = self.physical_resource_name()
|
||||
self.data_set('metadata_queue_id', queue_id)
|
||||
zaqar_plugin = self.client_plugin('zaqar')
|
||||
zaqar = zaqar_plugin.create_for_tenant(
|
||||
self.stack.stack_user_project_id, self._user_token())
|
||||
queue = zaqar.queue(queue_id)
|
||||
occ.update({'zaqar': {
|
||||
'user_id': self._get_user_id(),
|
||||
'password': self.password,
|
||||
'auth_url': self.context.auth_url,
|
||||
'project_id': self.stack.stack_user_project_id,
|
||||
'queue_id': queue_id}})
|
||||
queue.post({'body': meta, 'ttl': zaqar_plugin.DEFAULT_TTL})
|
||||
collectors.append('zaqar')
|
||||
|
||||
elif self.transport_poll_server_cfn(props):
|
||||
heat_client_plugin = self.stack.clients.client_plugin('heat')
|
||||
@ -623,6 +623,7 @@ class Server(stack_user.StackUser, sh.SchedulerHintsMixin,
|
||||
'secret_access_key': self.secret_key,
|
||||
'stack_name': self.stack.name,
|
||||
'path': '%s.Metadata' % self.name}})
|
||||
collectors.append('cfn')
|
||||
|
||||
elif self.transport_poll_temp_url(props):
|
||||
container = self.physical_resource_name()
|
||||
@ -639,13 +640,28 @@ class Server(stack_user.StackUser, sh.SchedulerHintsMixin,
|
||||
self.data_set('metadata_put_url', put_url)
|
||||
self.data_set('metadata_object_name', object_name)
|
||||
|
||||
collectors.append('request')
|
||||
occ.update({'request': {
|
||||
'metadata_url': url}})
|
||||
|
||||
collectors.append('local')
|
||||
self.metadata_set(meta)
|
||||
|
||||
# push replacement polling config to any existing push-based sources
|
||||
queue_id = self.data().get('metadata_queue_id')
|
||||
if queue_id:
|
||||
zaqar_plugin = self.client_plugin('zaqar')
|
||||
zaqar = zaqar_plugin.create_for_tenant(
|
||||
self.stack.stack_user_project_id, self._user_token())
|
||||
queue = zaqar.queue(queue_id)
|
||||
queue.post({'body': meta, 'ttl': zaqar_plugin.DEFAULT_TTL})
|
||||
|
||||
object_name = self.data().get('metadata_object_name')
|
||||
if object_name:
|
||||
container = self.physical_resource_name()
|
||||
self.client('swift').put_object(
|
||||
container, object_name, jsonutils.dumps(meta))
|
||||
|
||||
self.metadata_set(meta)
|
||||
|
||||
def _register_access_key(self):
|
||||
"""Access is limited to this resource, which created the keypair."""
|
||||
def access_allowed(resource_name):
|
||||
|
@ -769,7 +769,8 @@ class ServersTest(common.HeatTestCase):
|
||||
'path': 'WebServer.Metadata',
|
||||
'secret_access_key': '8901',
|
||||
'stack_name': 'software_config_s'
|
||||
}
|
||||
},
|
||||
'collectors': ['ec2', 'cfn', 'local']
|
||||
},
|
||||
'deployments': []
|
||||
}, server.metadata_get())
|
||||
@ -789,6 +790,7 @@ class ServersTest(common.HeatTestCase):
|
||||
'secret_access_key': '8901',
|
||||
'stack_name': 'software_config_s'
|
||||
},
|
||||
'collectors': ['ec2', 'cfn', 'local'],
|
||||
'polling_interval': 10
|
||||
},
|
||||
'deployments': []
|
||||
@ -850,7 +852,8 @@ class ServersTest(common.HeatTestCase):
|
||||
'resource_name': 'WebServer',
|
||||
'stack_id': 'software_config_s/%s' % stack.id,
|
||||
'user_id': '1234'
|
||||
}
|
||||
},
|
||||
'collectors': ['ec2', 'heat', 'local']
|
||||
},
|
||||
'deployments': []
|
||||
}, server.metadata_get())
|
||||
@ -869,6 +872,7 @@ class ServersTest(common.HeatTestCase):
|
||||
'stack_id': 'software_config_s/%s' % stack.id,
|
||||
'user_id': '1234'
|
||||
},
|
||||
'collectors': ['ec2', 'heat', 'local'],
|
||||
'polling_interval': 10
|
||||
},
|
||||
'deployments': []
|
||||
@ -930,6 +934,8 @@ class ServersTest(common.HeatTestCase):
|
||||
server.physical_resource_name(), object_name)
|
||||
self.assertEqual(test_path, urlparse.urlparse(metadata_put_url).path)
|
||||
self.assertEqual(test_path, urlparse.urlparse(metadata_url).path)
|
||||
sc.put_object.assert_called_once_with(
|
||||
container_name, object_name, jsonutils.dumps(md))
|
||||
|
||||
sc.head_container.return_value = {'x-container-object-count': '0'}
|
||||
server._delete_temp_url()
|
||||
@ -948,7 +954,8 @@ class ServersTest(common.HeatTestCase):
|
||||
'os-collect-config': {
|
||||
'request': {
|
||||
'metadata_url': metadata_url
|
||||
}
|
||||
},
|
||||
'collectors': ['ec2', 'request', 'local']
|
||||
},
|
||||
'deployments': []
|
||||
}, server.metadata_get())
|
||||
@ -963,6 +970,7 @@ class ServersTest(common.HeatTestCase):
|
||||
'request': {
|
||||
'metadata_url': metadata_url
|
||||
},
|
||||
'collectors': ['ec2', 'request', 'local'],
|
||||
'polling_interval': 10
|
||||
},
|
||||
'deployments': []
|
||||
@ -1038,7 +1046,8 @@ class ServersTest(common.HeatTestCase):
|
||||
'auth_url': 'http://server.test:5000/v2.0',
|
||||
'project_id': '8888',
|
||||
'queue_id': queue_id
|
||||
}
|
||||
},
|
||||
'collectors': ['ec2', 'zaqar', 'local']
|
||||
},
|
||||
'deployments': []
|
||||
}, server.metadata_get())
|
||||
@ -1055,6 +1064,7 @@ class ServersTest(common.HeatTestCase):
|
||||
'project_id': '8888',
|
||||
'queue_id': queue_id
|
||||
},
|
||||
'collectors': ['ec2', 'zaqar', 'local'],
|
||||
'polling_interval': 10
|
||||
},
|
||||
'deployments': []
|
||||
@ -1667,7 +1677,8 @@ class ServersTest(common.HeatTestCase):
|
||||
'path': 'WebServer.Metadata',
|
||||
'secret_access_key': '8901',
|
||||
'stack_name': 'update_meta_sc'
|
||||
}
|
||||
},
|
||||
'collectors': ['ec2', 'cfn', 'local']
|
||||
},
|
||||
'deployments': []}
|
||||
self.assertEqual(expected_md, server.metadata_get())
|
||||
@ -1703,6 +1714,7 @@ class ServersTest(common.HeatTestCase):
|
||||
'secret_access_key': '8901',
|
||||
'stack_name': 'update_meta_sc'
|
||||
},
|
||||
'collectors': ['ec2', 'cfn', 'local'],
|
||||
'polling_interval': 10
|
||||
},
|
||||
'deployments': []}
|
||||
@ -1738,6 +1750,7 @@ class ServersTest(common.HeatTestCase):
|
||||
'secret_access_key': '8901',
|
||||
'stack_name': 'update_meta_sc'
|
||||
},
|
||||
'collectors': ['ec2', 'cfn', 'local'],
|
||||
'polling_interval': 10
|
||||
},
|
||||
'deployments': []}
|
||||
@ -1784,6 +1797,7 @@ class ServersTest(common.HeatTestCase):
|
||||
'request': {
|
||||
'metadata_url': 'the_url',
|
||||
},
|
||||
'collectors': ['ec2', 'request', 'local'],
|
||||
'polling_interval': 10
|
||||
},
|
||||
'deployments': []}
|
||||
|
Loading…
Reference in New Issue
Block a user