Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
slapos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Guillaume Hervier
slapos
Commits
54ea7e4e
Commit
54ea7e4e
authored
Jul 04, 2013
by
Cédric de Saint Martin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't reset zope password each time.
By don't creating the inituser file if it has already been done once.
parent
be7c4bf1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
2 deletions
+24
-2
slapos/recipe/generic_zope/__init__.py
slapos/recipe/generic_zope/__init__.py
+12
-1
slapos/recipe/generic_zope_zeo_client/__init__.py
slapos/recipe/generic_zope_zeo_client/__init__.py
+12
-1
No files found.
slapos/recipe/generic_zope/__init__.py
View file @
54ea7e4e
...
@@ -35,11 +35,22 @@ _isurl = re.compile('([a-zA-Z0-9+.-]+)://').match
...
@@ -35,11 +35,22 @@ _isurl = re.compile('([a-zA-Z0-9+.-]+)://').match
# based on Zope2.utilities.mkzopeinstance.write_inituser
# based on Zope2.utilities.mkzopeinstance.write_inituser
def
Zope2InitUser
(
path
,
username
,
password
):
def
Zope2InitUser
(
path
,
username
,
password
):
# Set password only once
# Currently, rely on existence of a simple file:
# Create it the first time, then next time, detect this file and do no-op.
inituser_done_path
=
'%s_done'
%
path
if
os
.
path
.
exists
(
inituser_done_path
):
return
if
os
.
path
.
exists
(
path
):
return
open
(
path
,
'w'
).
write
(
''
)
open
(
path
,
'w'
).
write
(
''
)
os
.
chmod
(
path
,
0600
)
os
.
chmod
(
path
,
0600
)
open
(
path
,
"w"
).
write
(
'%s:{SHA}%s
\
n
'
%
(
open
(
path
,
'w'
).
write
(
'%s:{SHA}%s
\
n
'
%
(
username
,
binascii
.
b2a_base64
(
hashlib
.
sha1
(
password
).
digest
())[:
-
1
]))
username
,
binascii
.
b2a_base64
(
hashlib
.
sha1
(
password
).
digest
())[:
-
1
]))
open
(
inituser_done_path
,
'w'
).
write
(
'"inituser" file already created once.'
)
class
Recipe
(
GenericBaseRecipe
):
class
Recipe
(
GenericBaseRecipe
):
def
_options
(
self
,
options
):
def
_options
(
self
,
options
):
options
[
'password'
]
=
self
.
generatePassword
()
options
[
'password'
]
=
self
.
generatePassword
()
...
...
slapos/recipe/generic_zope_zeo_client/__init__.py
View file @
54ea7e4e
...
@@ -35,11 +35,22 @@ _isurl = re.compile('([a-zA-Z0-9+.-]+)://').match
...
@@ -35,11 +35,22 @@ _isurl = re.compile('([a-zA-Z0-9+.-]+)://').match
# based on Zope2.utilities.mkzopeinstance.write_inituser
# based on Zope2.utilities.mkzopeinstance.write_inituser
def
Zope2InitUser
(
path
,
username
,
password
):
def
Zope2InitUser
(
path
,
username
,
password
):
# Set password only once
# Currently, rely on existence of a simple file:
# Create it the first time, then next time, detect this file and do no-op.
inituser_done_path
=
'%s_done'
%
path
if
os
.
path
.
exists
(
inituser_done_path
):
return
if
os
.
path
.
exists
(
path
):
return
open
(
path
,
'w'
).
write
(
''
)
open
(
path
,
'w'
).
write
(
''
)
os
.
chmod
(
path
,
0600
)
os
.
chmod
(
path
,
0600
)
open
(
path
,
"w"
).
write
(
'%s:{SHA}%s
\
n
'
%
(
open
(
path
,
'w'
).
write
(
'%s:{SHA}%s
\
n
'
%
(
username
,
binascii
.
b2a_base64
(
hashlib
.
sha1
(
password
).
digest
())[:
-
1
]))
username
,
binascii
.
b2a_base64
(
hashlib
.
sha1
(
password
).
digest
())[:
-
1
]))
open
(
inituser_done_path
,
'w'
).
write
(
'"inituser" file already created once.'
)
class
Recipe
(
GenericBaseRecipe
):
class
Recipe
(
GenericBaseRecipe
):
def
_options
(
self
,
options
):
def
_options
(
self
,
options
):
options
[
'password'
]
=
self
.
generatePassword
()
options
[
'password'
]
=
self
.
generatePassword
()
...
...
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