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
ce66ae38
Commit
ce66ae38
authored
11 years ago
by
Nikos Skalkotos
Browse files
Options
Downloads
Patches
Plain Diff
Check if scrubbing is supported
Don't try to scrub data unless the used guestfs appliance supports it
parent
ab694a5e
No related branches found
Branches containing commit
Tags
v0.2
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
+7
-0
7 additions, 0 deletions
image_creator/os_type/__init__.py
image_creator/os_type/unix.py
+7
-2
7 additions, 2 deletions
image_creator/os_type/unix.py
with
14 additions
and
2 deletions
image_creator/os_type/__init__.py
+
7
−
0
View file @
ce66ae38
...
@@ -85,6 +85,13 @@ class OSBase(object):
...
@@ -85,6 +85,13 @@ class OSBase(object):
self
.
out
=
output
self
.
out
=
output
self
.
meta
=
{}
self
.
meta
=
{}
# Many guestfs compilations don't support scrub
self
.
_scrub_support
=
True
try
:
self
.
g
.
available
([
'
scrub
'
])
except
RuntimeError
:
self
.
_scrub_support
=
False
def
collect_metadata
(
self
):
def
collect_metadata
(
self
):
"""
Collect metadata about the OS
"""
"""
Collect metadata about the OS
"""
try
:
try
:
...
...
This diff is collapsed.
Click to expand it.
image_creator/os_type/unix.py
+
7
−
2
View file @
ce66ae38
...
@@ -139,12 +139,17 @@ class Unix(OSBase):
...
@@ -139,12 +139,17 @@ class Unix(OSBase):
self
.
out
.
output
(
"
Removing sensitive user data under %s
"
%
self
.
out
.
output
(
"
Removing sensitive user data under %s
"
%
"
"
.
join
(
homedirs
))
"
"
.
join
(
homedirs
))
action
=
self
.
g
.
rm_rf
if
self
.
_scrub_support
:
action
=
self
.
g
.
scrub_file
else
:
self
.
out
.
warn
(
"
Sensitive data won
'
t be scrubbed (not supported)
"
)
for
homedir
in
homedirs
:
for
homedir
in
homedirs
:
for
data
in
self
.
sensitive_userdata
:
for
data
in
self
.
sensitive_userdata
:
fname
=
"
%s/%s
"
%
(
homedir
,
data
)
fname
=
"
%s/%s
"
%
(
homedir
,
data
)
if
self
.
g
.
is_file
(
fname
):
if
self
.
g
.
is_file
(
fname
):
self
.
g
.
scrub_file
(
fname
)
action
(
fname
)
elif
self
.
g
.
is_dir
(
fname
):
elif
self
.
g
.
is_dir
(
fname
):
self
.
_foreach_file
(
fname
,
self
.
g
.
scrub_file
,
ftype
=
'
r
'
)
self
.
_foreach_file
(
fname
,
action
,
ftype
=
'
r
'
)
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :
# vim: set sta sts=4 shiftwidth=4 sw=4 et ai :
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