~ubuntu-branches/ubuntu/quantal/nova/quantal-proposed

« back to all changes in this revision

Viewing changes to plugins/xenserver/xenapi/etc/xapi.d/plugins/kernel

  • Committer: Package Import Robot
  • Author(s): Chuck Short
  • Date: 2012-08-16 14:04:11 UTC
  • mto: This revision was merged to the branch mainline in revision 84.
  • Revision ID: package-import@ubuntu.com-20120816140411-0mr4n241wmk30t9l
Tags: upstream-2012.2~f3
ImportĀ upstreamĀ versionĀ 2012.2~f3

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
 
21
21
"""Handle the manipulation of kernel images."""
22
22
 
 
23
import errno
23
24
import os
24
25
import shutil
25
26
 
106
107
    return filename
107
108
 
108
109
 
 
110
def _remove_file(filepath):
 
111
    try:
 
112
        os.remove(filepath)
 
113
    except OSError, exc:
 
114
        if exc.errno != errno.ENOENT:
 
115
            raise
 
116
 
 
117
 
109
118
def remove_kernel_ramdisk(session, args):
110
119
    """Removes kernel and/or ramdisk from dom0's file system"""
111
120
    kernel_file = optional(args, 'kernel-file')
112
121
    ramdisk_file = optional(args, 'ramdisk-file')
113
122
    if kernel_file:
114
 
        os.remove(kernel_file)
 
123
        _remove_file(kernel_file)
115
124
    if ramdisk_file:
116
 
        os.remove(ramdisk_file)
 
125
        _remove_file(ramdisk_file)
117
126
    return "ok"
118
127
 
119
128