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
Labels
Merge Requests
105
Merge Requests
105
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
nexedi
slapos
Commits
65cbf6ea
Commit
65cbf6ea
authored
Jun 15, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
Update Release Candidate
parents
30f3f66d
4dcb7327
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
4 deletions
+48
-4
component/git/buildout.cfg
component/git/buildout.cfg
+1
-1
component/re6stnet/buildout.cfg
component/re6stnet/buildout.cfg
+1
-0
setup.py
setup.py
+1
-1
slapos/recipe/neoppod.py
slapos/recipe/neoppod.py
+2
-1
slapos/recipe/postgres.py
slapos/recipe/postgres.py
+23
-1
slapos/test/recipe/test_postgres.py
slapos/test/recipe/test_postgres.py
+20
-0
No files found.
component/git/buildout.cfg
View file @
65cbf6ea
...
@@ -32,7 +32,7 @@ environment =
...
@@ -32,7 +32,7 @@ environment =
NO_TCLTK=y
NO_TCLTK=y
PATH=${curl:location}/bin:${gettext:location}/bin:${tar:location}/bin:${xz-utils:location}/bin:%(PATH)s
PATH=${curl:location}/bin:${gettext:location}/bin:${tar:location}/bin:${xz-utils:location}/bin:%(PATH)s
CPPFLAGS=-I${zlib:location}/include
CPPFLAGS=-I${zlib:location}/include
LDFLAGS=-L${zlib:location}/lib -L${openssl:location}/lib -Wl,-rpath=${openssl:location}/lib -Wl,-rpath=${zlib:location}/lib
LDFLAGS=-L${zlib:location}/lib -L${openssl:location}/lib -Wl,-rpath=${openssl:location}/lib -Wl,-rpath=${zlib:location}/lib
-Wl,-rpath=${curl:location}/lib
[gitweb]
[gitweb]
<= git
<= git
...
...
component/re6stnet/buildout.cfg
View file @
65cbf6ea
[buildout]
[buildout]
extends =
extends =
../../stack/slapos.cfg
../defaults.cfg
../defaults.cfg
../babeld/buildout.cfg
../babeld/buildout.cfg
../geoip2/buildout.cfg
../geoip2/buildout.cfg
...
...
setup.py
View file @
65cbf6ea
...
@@ -28,7 +28,7 @@ from setuptools import setup, find_packages
...
@@ -28,7 +28,7 @@ from setuptools import setup, find_packages
import
glob
import
glob
import
os
import
os
version
=
'1.0.3
05
'
version
=
'1.0.3
26
'
name
=
'slapos.cookbook'
name
=
'slapos.cookbook'
long_description
=
open
(
"README.rst"
).
read
()
long_description
=
open
(
"README.rst"
).
read
()
...
...
slapos/recipe/neoppod.py
View file @
65cbf6ea
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
#
##############################################################################
##############################################################################
import
six
import
os
import
os
import
shlex
import
shlex
from
zc.buildout
import
UserError
from
zc.buildout
import
UserError
...
@@ -41,7 +42,7 @@ class Cluster(object):
...
@@ -41,7 +42,7 @@ class Cluster(object):
for
node
in
sorted
(
options
[
'nodes'
].
split
()):
for
node
in
sorted
(
options
[
'nodes'
].
split
()):
node
=
buildout
[
node
]
node
=
buildout
[
node
]
node_list
.
append
(
node
)
node_list
.
append
(
node
)
for
k
,
v
in
result_dict
.
iteritems
(
):
for
k
,
v
in
six
.
iteritems
(
result_dict
):
x
=
node
[
k
]
x
=
node
[
k
]
if
x
:
if
x
:
v
.
append
(
x
)
v
.
append
(
x
)
...
...
slapos/recipe/postgres.py
View file @
65cbf6ea
...
@@ -194,6 +194,28 @@ class Recipe(GenericBaseRecipe):
...
@@ -194,6 +194,28 @@ class Recipe(GenericBaseRecipe):
def
createDatabase
(
self
):
def
createDatabase
(
self
):
self
.
runPostgresCommand
(
cmd
=
'CREATE DATABASE "%s"'
%
self
.
options
[
'dbname'
])
self
.
runPostgresCommand
(
cmd
=
'CREATE DATABASE "%s"'
%
self
.
options
[
'dbname'
])
def
isPosgresServerRunning
(
self
):
pgdata
=
self
.
options
[
'pgdata-directory'
]
postmaster_pid_file
=
os
.
path
.
join
(
pgdata
,
'postmaster.pid'
)
if
os
.
path
.
exists
(
postmaster_pid_file
):
pg_ctl_binary
=
os
.
path
.
join
(
self
.
options
[
'bin'
],
'pg_ctl'
)
self
.
check_exists
(
pg_ctl_binary
)
# Check the postgres is running or not
# if not, delete the ppostmaster.pid and run it again
try
:
output1
=
subprocess
.
check_output
([
pg_ctl_binary
,
'status'
,
'-D'
,
pgdata
],
stderr
=
subprocess
.
STDOUT
)
except
subprocess
.
CalledProcessError
as
e
:
if
e
.
returncode
==
3
:
# If the server is not running, pg_ctl returns an exit status of 3
# see https://www.postgresql.org/docs/current/app-pg-ctl.html
os
.
remove
(
postmaster_pid_file
)
return
False
else
:
raise
return
True
else
:
return
False
def
updateSuperuser
(
self
):
def
updateSuperuser
(
self
):
"""
\
"""
\
...
@@ -211,7 +233,7 @@ class Recipe(GenericBaseRecipe):
...
@@ -211,7 +233,7 @@ class Recipe(GenericBaseRecipe):
change_password_query
=
"""ALTER USER "%s" ENCRYPTED PASSWORD '%s'"""
%
(
user
,
enc_password
)
change_password_query
=
"""ALTER USER "%s" ENCRYPTED PASSWORD '%s'"""
%
(
user
,
enc_password
)
pgdata
=
self
.
options
[
'pgdata-directory'
]
pgdata
=
self
.
options
[
'pgdata-directory'
]
if
os
.
path
.
exists
(
os
.
path
.
join
(
pgdata
,
'postmaster.pid'
)
):
if
self
.
isPosgresServerRunning
(
):
psql_binary
=
os
.
path
.
join
(
self
.
options
[
'bin'
],
'psql'
)
psql_binary
=
os
.
path
.
join
(
self
.
options
[
'bin'
],
'psql'
)
# connect to a running postgres deamon
# connect to a running postgres deamon
p
=
subprocess
.
Popen
([
p
=
subprocess
.
Popen
([
...
...
slapos/test/recipe/test_postgres.py
View file @
65cbf6ea
...
@@ -90,6 +90,26 @@ class PostgresTest(unittest.TestCase):
...
@@ -90,6 +90,26 @@ class PostgresTest(unittest.TestCase):
self
.
assertEqual
(
cursor
.
fetchone
(),
(
2
,))
self
.
assertEqual
(
cursor
.
fetchone
(),
(
2
,))
cnx
.
close
()
cnx
.
close
()
def
test_stale_pid_file_does_not_prevent_install
(
self
):
self
.
recipe
.
install
()
# Malformed postmaster.pid file should not prevent the service running
pgdata_directory
=
os
.
path
.
join
(
self
.
pgdata_directory
,
'pgdata'
)
postmaster_pid_file
=
os
.
path
.
join
(
pgdata_directory
,
'postmaster.pid'
)
content
=
'''
\
1074626
/srv/slapgrid/slappart33/srv/runner/instance/slappart0/srv/postgresql
1686241354
5432
/srv/slapgrid/slappart33/srv/runner/instance/slappart0/srv/postgresql
10.0.156.45
5432001 1179658
ready'''
with
open
(
postmaster_pid_file
,
'w'
)
as
file
:
file
.
write
(
content
)
self
.
recipe
.
install
()
def
test_update_password
(
self
):
def
test_update_password
(
self
):
self
.
recipe
.
install
()
self
.
recipe
.
install
()
self
.
start_postgres_server
()
self
.
start_postgres_server
()
...
...
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