diff options
| author | Jenkins <jenkins@review.openstack.org> | 2013-01-26 16:59:43 +0000 |
|---|---|---|
| committer | Gerrit Code Review <review@openstack.org> | 2013-01-26 16:59:43 +0000 |
| commit | e1ce3878b951ea491548c129453bb84a77205649 (patch) | |
| tree | e1cf871abdccf7a4771f782793be0605bf390db5 /nova/virt | |
| parent | c9af3eed35eb56e154235119fa130e8ba9e8d8fd (diff) | |
| parent | ac8a9d80d035f19c251935491d4bf5672f5e3b6b (diff) | |
Merge "Baremetal/utils should not log certain exceptions"
Diffstat (limited to 'nova/virt')
| -rw-r--r-- | nova/virt/baremetal/utils.py | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/nova/virt/baremetal/utils.py b/nova/virt/baremetal/utils.py index efc5199db..fa2c05983 100644 --- a/nova/virt/baremetal/utils.py +++ b/nova/virt/baremetal/utils.py @@ -15,6 +15,7 @@ # License for the specific language governing permissions and limitations # under the License. +import errno import os import shutil @@ -44,8 +45,11 @@ def inject_into_image(image, key, net, metadata, admin_password, def unlink_without_raise(path): try: os.unlink(path) - except OSError: - LOG.exception(_("Failed to unlink %s") % path) + except OSError, e: + if e.errno == errno.ENOENT: + return + else: + LOG.warn(_("Failed to unlink %(path)s, error: %(e)s") % locals()) def rmtree_without_raise(path): @@ -64,9 +68,12 @@ def write_to_file(path, contents): def create_link_without_raise(source, link): try: os.symlink(source, link) - except OSError: - LOG.exception(_("Failed to create symlink from %(source)s to %(link)s") - % locals()) + except OSError, e: + if e.errno == errno.EEXIST: + return + else: + LOG.warn(_("Failed to create symlink from %(source)s to %(link)s" + ", error: %(e)s") % locals()) def random_alnum(count): |
