Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
snf-image-creator
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
itminedu
snf-image-creator
Commits
a38447ba
Commit
a38447ba
authored
11 years ago
by
Nikos Skalkotos
Browse files
Options
Downloads
Patches
Plain Diff
In _foreach_file check if the directory exists
Otherwise print a warning.
parent
6a7a5d4e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
image_creator/os_type/__init__.py
+4
-0
4 additions, 0 deletions
image_creator/os_type/__init__.py
image_creator/os_type/unix.py
+1
-3
1 addition, 3 deletions
image_creator/os_type/unix.py
with
5 additions
and
3 deletions
image_creator/os_type/__init__.py
+
4
−
0
View file @
a38447ba
...
@@ -320,6 +320,10 @@ class OSBase(object):
...
@@ -320,6 +320,10 @@ class OSBase(object):
* exclude: Exclude all files that follow this pattern.
* exclude: Exclude all files that follow this pattern.
"""
"""
if
not
self
.
image
.
g
.
is_dir
(
directory
):
self
.
out
.
warn
(
"
Directory: `%s
'
does not exist!
"
%
directory
)
return
maxdepth
=
None
if
'
maxdepth
'
not
in
kargs
else
kargs
[
'
maxdepth
'
]
maxdepth
=
None
if
'
maxdepth
'
not
in
kargs
else
kargs
[
'
maxdepth
'
]
if
maxdepth
==
0
:
if
maxdepth
==
0
:
return
return
...
...
This diff is collapsed.
Click to expand it.
image_creator/os_type/unix.py
+
1
−
3
View file @
a38447ba
...
@@ -108,9 +108,7 @@ class Unix(OSBase):
...
@@ -108,9 +108,7 @@ class Unix(OSBase):
def
cleanup_mail
(
self
):
def
cleanup_mail
(
self
):
"""
Remove all files under /var/mail and /var/spool/mail
"""
"""
Remove all files under /var/mail and /var/spool/mail
"""
if
self
.
image
.
g
.
is_dir
(
'
/var/spool/mail
'
):
self
.
_foreach_file
(
'
/var/spool/mail
'
,
self
.
image
.
g
.
rm_rf
,
maxdepth
=
1
)
self
.
_foreach_file
(
'
/var/spool/mail
'
,
self
.
image
.
g
.
rm_rf
,
maxdepth
=
1
)
self
.
_foreach_file
(
'
/var/mail
'
,
self
.
image
.
g
.
rm_rf
,
maxdepth
=
1
)
self
.
_foreach_file
(
'
/var/mail
'
,
self
.
image
.
g
.
rm_rf
,
maxdepth
=
1
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment