Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
snf-image-creator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
itminedu
snf-image-creator
Commits
dbd7016c
Commit
dbd7016c
authored
Aug 01, 2014
by
Nikos Skalkotos
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
windows: Use OSBase's cleanup mechanism overall
Use _add_cleanup and _cleanup in do_sysprep
parent
f593e333
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
24 deletions
+28
-24
image_creator/os_type/windows/__init__.py
image_creator/os_type/windows/__init__.py
+28
-24
No files found.
image_creator/os_type/windows/__init__.py
View file @
dbd7016c
...
...
@@ -502,15 +502,25 @@ class Windows(OSBase):
self
.
out
.
output
(
"Preparing media for boot ..."
,
False
)
with
self
.
mount
(
readonly
=
False
,
silent
=
True
):
activated
=
self
.
registry
.
reset_account
(
self
.
vm
.
admin
.
rid
)
v_val
=
self
.
registry
.
reset_passwd
(
self
.
vm
.
admin
.
rid
)
disabled_remote_uac
=
self
.
registry
.
update_uac_remote_setting
(
1
)
disabled_uac
=
self
.
registry
.
update_uac
(
0
)
self
.
_add_boot_scripts
()
if
not
self
.
registry
.
reset_account
(
self
.
vm
.
admin
.
rid
):
self
.
_add_cleanup
(
'sysprep'
,
self
.
registry
.
reset_account
,
self
.
vm
.
admin
.
rid
,
False
)
if
self
.
registry
.
update_uac
(
0
):
self
.
_add_cleanup
(
'sysprep'
,
self
.
registry
.
update_uac
,
1
)
if
self
.
registry
.
update_uac_remote_setting
(
1
):
self
.
_add_cleanup
(
'sysprep'
,
self
.
registry
.
update_uac_remote_setting
,
0
)
# disable the firewalls
firewall_states
=
self
.
registry
.
update_firewalls
(
0
,
0
,
0
)
self
.
_add_cleanup
(
'sysprep'
,
self
.
registry
.
update_firewalls
,
*
self
.
registry
.
update_firewalls
(
0
,
0
,
0
))
v_val
=
self
.
registry
.
reset_passwd
(
self
.
vm
.
admin
.
rid
)
self
.
_add_boot_scripts
()
# Delete the pagefile. It will be recreated when the system boots
try
:
...
...
@@ -569,20 +579,11 @@ class Windows(OSBase):
self
.
out
.
warn
(
"The boot changes cannot be reverted. "
"The snapshot may be in a corrupted state."
)
else
:
if
disabled_remote_uac
:
self
.
registry
.
update_uac_remote_setting
(
0
)
if
disabled_uac
:
self
.
registry
.
update_uac
(
1
)
if
not
activated
:
self
.
registry
.
reset_account
(
self
.
vm
.
admin
.
rid
,
False
)
if
not
self
.
sysprepped
:
# Reset the old password
self
.
registry
.
reset_passwd
(
self
.
vm
.
admin
.
rid
,
v_val
)
self
.
registry
.
update_firewalls
(
*
firewall_states
)
self
.
_cleanup
(
'sysprep'
)
self
.
out
.
success
(
"done"
)
def
_exec_sysprep_tasks
(
self
):
...
...
@@ -834,13 +835,15 @@ class Windows(OSBase):
"""Upload the VirtIO drivers and installation scripts to the media.
"""
with
self
.
mount
(
readonly
=
False
,
silent
=
True
):
v_val
=
self
.
registry
.
reset_passwd
(
self
.
vm
.
admin
.
rid
)
self
.
_add_cleanup
(
'virtio'
,
self
.
registry
.
reset_passwd
,
self
.
vm
.
admin
.
rid
,
v_val
)
# Reset Password
self
.
_add_cleanup
(
'virtio'
,
self
.
registry
.
reset_passwd
,
self
.
vm
.
admin
.
rid
,
self
.
registry
.
reset_passwd
(
self
.
vm
.
admin
.
rid
))
active
=
self
.
registry
.
reset_account
(
self
.
vm
.
admin
.
ri
d
)
# Enable admin account (if neede
d)
self
.
_add_cleanup
(
'virtio'
,
self
.
registry
.
reset_account
,
self
.
vm
.
admin
.
rid
,
active
)
self
.
vm
.
admin
.
rid
,
self
.
registry
.
reset_account
(
self
.
vm
.
admin
.
rid
))
if
self
.
registry
.
update_uac
(
0
):
self
.
_add_cleanup
(
'virtio'
,
self
.
registry
.
update_uac
,
1
)
...
...
@@ -848,9 +851,10 @@ class Windows(OSBase):
# We disable this with powershell scripts
self
.
registry
.
enable_autologon
(
self
.
vm
.
admin
.
name
)
active
=
self
.
registry
.
reset_first_logon_animation
(
False
)
self
.
_add_cleanup
(
'virtio'
,
self
.
registry
.
reset_first_logon_animation
,
active
)
# Disable first logon animation (if needed)
self
.
_add_cleanup
(
'virtio'
,
self
.
registry
.
reset_first_logon_animation
,
self
.
registry
.
reset_first_logon_animation
(
False
))
tmp
=
uuid
.
uuid4
().
hex
self
.
image
.
g
.
mkdir_p
(
"%s/%s"
%
(
self
.
systemroot
,
tmp
))
...
...
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