-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmonasca_test_setup.py
59 lines (49 loc) · 1.63 KB
/
monasca_test_setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#
# Copyright 2015 Hewlett Packard
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import ceilometer
import os
import shutil
ceilo_dir = os.path.dirname(ceilometer.__file__)
ceilosca_files = {
'ceilosca/' + file: '%s/%s' % (ceilo_dir, file)
for file in
[
'monasca_client.py',
'publisher/monasca_data_filter.py',
'publisher/monclient.py',
'storage/impl_monasca.py'
]
}
# Copy the files to ceilometer venv dir. without this step
# python cannot load our files for unit testing
for src, dest in ceilosca_files.items():
shutil.copyfile(src, dest)
ceilo_parent_dir = os.path.dirname(os.path.abspath(
os.path.dirname(ceilometer.__file__)))
ceilosca_conf_files = {
file: '%s/%s' % (ceilo_parent_dir, file)
for file in
[
'etc/ceilometer/monasca_field_definitions.yaml',
'etc/ceilometer/pipeline.yaml',
'etc/ceilometer/ceilometer.conf',
'etc/ceilometer/policy.json'
]
}
dest_conf_dir = ceilo_parent_dir + '/etc/ceilometer'
if not os.path.exists(dest_conf_dir):
os.makedirs(dest_conf_dir)
for src, dest in ceilosca_conf_files.items():
shutil.copyfile(src, dest)