Ensure utils.find_config() raises correctly on failure to find config

This commit is contained in:
Kiall Mac Innes
2012-10-24 19:41:31 +01:00
parent 6c31049262
commit 341c756c50

View File

@@ -14,10 +14,13 @@
# License for the specific language governing permissions and limitations
# under the License.
import os
from moniker.openstack.common import log as logging
from moniker.openstack.common import cfg
from moniker.openstack.common.notifier import api as notifier_api
from moniker import exceptions
LOG = logging.getLogger(__name__)
def notify(context, service, event_type, payload):
priority = 'INFO'
@@ -47,7 +50,8 @@ def find_config(config_path):
]
for path in possible_locations:
LOG.debug('Checking path: %s' % path)
if os.path.exists(path):
return os.path.abspath(path)
raise exceptions.ConfigNotFound(os.path.abspath(config_path))
raise exceptions.ConfigNotFound(config_path)