1 ##############################################################################
2 # Copyright (c) 2017 ZTE Corporation and others.
4 # All rights reserved. This program and the accompanying materials
5 # are made available under the terms of the Apache License, Version 2.0
6 # which accompanies this distribution, and is available at
7 # http://www.apache.org/licenses/LICENSE-2.0
8 ##############################################################################
13 cbase = "/var/lib/config-data/puppet-generated/ceilometer"
14 if not os.path.isdir(cbase):
18 def restore_ep_config():
19 ep_file = cbase + '/etc/ceilometer/event_pipeline.yaml'
20 ep_file_bak = cbase + '/etc/ceilometer/event_pipeline.yaml.bak'
22 if not os.path.isfile(ep_file_bak):
23 print('Bak_file:%s does not exist.' % ep_file_bak)
26 shutil.copyfile(ep_file_bak, ep_file)
27 os.remove(ep_file_bak)
31 def restore_ed_config():
32 ed_file = cbase + '/etc/ceilometer/event_definitions.yaml'
33 ed_file_bak = cbase + '/etc/ceilometer/event_definitions.bak'
35 if not os.path.isfile(ed_file_bak):
36 print("Bak_file doesn't exist: %s." % ed_file_bak)
38 print('restore: %s' % ed_file)
39 if os.stat(ed_file_bak).st_size == 0:
40 print('Bak_file empty, so removing also: %s' % ed_file)
43 shutil.copyfile(ed_file_bak, ed_file)
44 os.remove(ed_file_bak)