tone down the warning for missing configuration file

The warning logged when we can't load a configuration file looks like an
error because it has "Errno" in it. It's not really an error, though, so
log a more gentle message saying that the configuration file does not
exist where we expect to find it.

Change-Id: I30698162615b494f4ed2d23f119309e9fcdf3edd
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann
2016-12-22 13:48:02 -05:00
parent 46c39de6af
commit 8756c1dd2a

View File

@@ -9,6 +9,7 @@
# 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 errno
import logging
import os.path
@@ -152,8 +153,12 @@ class Config(object):
with open(self._filename, 'r') as fd:
self._contents = yaml.safe_load(fd)
except IOError as err:
LOG.info('did not load config file %s: %s',
self._filename, err)
if err.errno == errno.ENOENT:
LOG.info('no configuration file in %s',
self._filename)
else:
LOG.warning('did not load config file %s: %s',
self._filename, err)
else:
self.override(**self._contents)