Bug - Testing in Apex with OpenStack master fails
[doctor.git] / doctor_tests / installer / common / restore_compute_config.py
1 ##############################################################################
2 # Copyright (c) 2018 Nokia Corporation and others.
3 #
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 ##############################################################################
9 import os
10 import shutil
11
12
13 def restore_cpu_allocation_ratio():
14     for nova_file_bak in ["/var/lib/config-data/puppet-generated/nova_libvirt/etc/nova/nova.bak",  # noqa
15                           "/var/lib/config-data/puppet-generated/nova/etc/nova/nova.bak",  # noqa
16                           "/etc/nova/nova.bak"]:
17         if os.path.isfile(nova_file_bak):
18             nova_file = nova_file_bak.replace(".bak", ".conf")
19             print('restoring nova.bak.')
20             shutil.copyfile(nova_file_bak, nova_file)
21             os.remove(nova_file_bak)
22             return
23     print('nova.bak does not exist.')
24     return
25
26 restore_cpu_allocation_ratio()