Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
itminedu
snf-image-creator
Commits
279f2c7d
Commit
279f2c7d
authored
Jun 26, 2012
by
Nikos Skalkotos
Browse files
Fix error message for non supported media source
parent
1f42adc8
Changes
1
Hide whitespace changes
Inline
Side-by-side
image_creator/disk.py
View file @
279f2c7d
...
...
@@ -45,9 +45,6 @@ import time
from
sendfile
import
sendfile
class
DiskError
(
Exception
):
pass
dd
=
get_command
(
'dd'
)
dmsetup
=
get_command
(
'dmsetup'
)
losetup
=
get_command
(
'losetup'
)
...
...
@@ -80,7 +77,8 @@ class Disk(object):
return
loop
def
_dir_to_disk
(
self
):
raise
NotImplementedError
raise
FatalError
(
"Using a directory as media source is not supported "
"yet!"
)
def
cleanup
(
self
):
"""Cleanup internal data. This needs to be called before the
...
...
@@ -103,10 +101,10 @@ class Disk(object):
sourcedev
=
self
.
source
mode
=
os
.
stat
(
self
.
source
).
st_mode
if
stat
.
S_ISDIR
(
mode
):
success
(
'looks like a directory'
)
self
.
out
.
success
(
'looks like a directory'
)
return
self
.
_losetup
(
self
.
_dir_to_disk
())
elif
stat
.
S_ISREG
(
mode
):
success
(
'looks like an image file'
)
self
.
out
.
success
(
'looks like an image file'
)
sourcedev
=
self
.
_losetup
(
self
.
source
)
elif
not
stat
.
S_ISBLK
(
mode
):
raise
ValueError
(
"Invalid media source. Only block devices, "
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment