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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
slapos
Commits
1fd1b5e1
Commit
1fd1b5e1
authored
Aug 06, 2022
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'upstream/master' into zope4py2
parents
99cc2432
886d9134
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
43 additions
and
63 deletions
+43
-63
software/hellorina/software.cfg
software/hellorina/software.cfg
+1
-1
software/ors-amarisoft/buildout.hash.cfg
software/ors-amarisoft/buildout.hash.cfg
+5
-5
software/ors-amarisoft/config/enb.jinja2.cfg
software/ors-amarisoft/config/enb.jinja2.cfg
+1
-1
software/ors-amarisoft/config/gnb.jinja2.cfg
software/ors-amarisoft/config/gnb.jinja2.cfg
+1
-1
software/ors-amarisoft/config/mme.jinja2.cfg
software/ors-amarisoft/config/mme.jinja2.cfg
+1
-1
software/ors-amarisoft/instance-enb.jinja2.cfg
software/ors-amarisoft/instance-enb.jinja2.cfg
+0
-6
software/ors-amarisoft/instance-gnb.jinja2.cfg
software/ors-amarisoft/instance-gnb.jinja2.cfg
+0
-6
software/repman/buildout.hash.cfg
software/repman/buildout.hash.cfg
+2
-2
software/repman/instance-repman.cfg.jinja2.in
software/repman/instance-repman.cfg.jinja2.in
+3
-0
software/repman/templates/slave-db-manage.in
software/repman/templates/slave-db-manage.in
+29
-40
No files found.
software/hellorina/software.cfg
View file @
1fd1b5e1
...
...
@@ -17,7 +17,7 @@ environment +=
[template]
recipe = slapos.recipe.template:jinja2
url = ${:_profile_base_location_}/instance.cfg.in
md5sum =
d7506e861ef87977eaa554b8928d2c99
md5sum =
2e90443314d2036f7077898ab49bfec1
# XXX: "template.cfg" is hardcoded in instanciation recipe
output = ${buildout:directory}/template.cfg
context =
...
...
software/ors-amarisoft/buildout.hash.cfg
View file @
1fd1b5e1
...
...
@@ -24,7 +24,7 @@ md5sum = b10c10a9408a934052fd0960f31a75fc
[template-lte-enb]
_update_hash_filename_ = instance-enb.jinja2.cfg
md5sum =
b5a0f5e258fd91573425b00027ca11b4
md5sum =
c5a82279b6ada358c74a90c3b660bf55
[template-lte-gnb-epc]
_update_hash_filename_ = instance-gnb-epc.jinja2.cfg
...
...
@@ -36,7 +36,7 @@ md5sum = 2cfe5679374559ab94478b987d646d83
[template-lte-gnb]
_update_hash_filename_ = instance-gnb.jinja2.cfg
md5sum =
771c6b550ea558c708f207c75ff00f49
md5sum =
eabbdb8ced563180f0bba8ca06e4bac4
[template-lte-mme]
_update_hash_filename_ = instance-mme.jinja2.cfg
...
...
@@ -48,7 +48,7 @@ md5sum = dcaac06553a3222b14c0013a13f4a149
[enb.jinja2.cfg]
filename = config/enb.jinja2.cfg
md5sum =
cd93c9c7bff2bcdd1cc01ad1cdf0c88c
md5sum =
f5848c48f573c79615f595b07c358ce8
[sib23.asn]
filename = config/sib23.asn
...
...
@@ -56,7 +56,7 @@ md5sum = b377dac7f1fcf94fb9ce9ebed617f36a
[gnb.jinja2.cfg]
filename = config/gnb.jinja2.cfg
md5sum =
91005da479a848798d128dbfd407d2c7
md5sum =
b3fb1b32aa1b151892eeb87a03e1d152
[ltelogs.jinja2.sh]
filename = ltelogs.jinja2.sh
...
...
@@ -64,7 +64,7 @@ md5sum = 1ba2e065bdf14a6411e95e80db17dcfd
[mme.jinja2.cfg]
filename = config/mme.jinja2.cfg
md5sum =
da10ef4c61532364c758c7845614c4d6
md5sum =
a96c33a0a2a301f204cac8642267ad97
[ims.jinja2.cfg]
filename = config/ims.jinja2.cfg
...
...
software/ors-amarisoft/config/enb.jinja2.cfg
View file @
1fd1b5e1
...
...
@@ -4,7 +4,7 @@
#define N_ANTENNA_UL 2
{
log_options: "all.level=debug,all.max_size=32,file.rotate=1G,file.path=
{{ directory['tmp'] }}
",
log_options: "all.level=debug,all.max_size=32,file.rotate=1G,file.path=
/dev/null
",
log_filename: "{{ directory['log'] }}/enb.log",
rf_driver: {
...
...
software/ors-amarisoft/config/gnb.jinja2.cfg
View file @
1fd1b5e1
...
...
@@ -6,7 +6,7 @@
#define NR_LONG_PUCCH_FORMAT 2 // Values: 2, 3, 4
{
log_options: "all.level=debug,all.max_size=32,file.rotate=1G,file.path=
{{ directory['tmp'] }}
",
log_options: "all.level=debug,all.max_size=32,file.rotate=1G,file.path=
/dev/null
",
log_filename: "{{ directory['log'] }}/gnb.log",
rf_driver: {
...
...
software/ors-amarisoft/config/mme.jinja2.cfg
View file @
1fd1b5e1
{
log_options: "all.level=debug,all.max_size=32,file.rotate=1G,file.path=
{{ directory['tmp'] }}
",
log_options: "all.level=debug,all.max_size=32,file.rotate=1G,file.path=
/dev/null
",
log_filename: "{{ directory['log'] }}/mme.log",
{% if slapparameter_dict.get('external_enb_gnb', '') %}
...
...
software/ors-amarisoft/instance-enb.jinja2.cfg
View file @
1fd1b5e1
...
...
@@ -5,7 +5,6 @@ parts =
lte-enb-config
lte-enb-service
sdr-busy-promise
remove-tmp
monitor-base
publish-connection-information
...
...
@@ -15,11 +14,6 @@ eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
[remove-tmp]
# Remove old logs stored in tmp directory to prevent disk from becoming full
recipe = plone.recipe.command
command = rm -rf ${directory:tmp}/*
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = {{ slap_connection['computer-id'] }}
...
...
software/ors-amarisoft/instance-gnb.jinja2.cfg
View file @
1fd1b5e1
...
...
@@ -5,7 +5,6 @@ parts =
lte-gnb-config
lte-enb-service
sdr-busy-promise
remove-tmp
monitor-base
publish-connection-information
...
...
@@ -15,11 +14,6 @@ eggs-directory = {{ eggs_directory }}
develop-eggs-directory = {{ develop_eggs_directory }}
offline = true
[remove-tmp]
# Remove old logs stored in tmp directory to prevent disk from becoming full
recipe = plone.recipe.command
command = rm -rf ${directory:tmp}/*
[slap-configuration]
recipe = slapos.cookbook:slapconfiguration.serialised
computer = {{ slap_connection['computer-id'] }}
...
...
software/repman/buildout.hash.cfg
View file @
1fd1b5e1
...
...
@@ -18,7 +18,7 @@ md5sum = 55c7fd4dd6a39b31878889fbfb00f995
[instance-repman.cfg]
_update_hash_filename_ = instance-repman.cfg.jinja2.in
md5sum =
6fc82c4b645bceb97ba7b6f5b56d161b
md5sum =
dc01433ffed82386a3feee0b34767bed
[config-toml.in]
_update_hash_filename_ = templates/config.toml.in
...
...
@@ -74,4 +74,4 @@ md5sum = 455aaf369bf5141758dc57f2c0e67b08
[slave-db-manage.in]
_update_hash_filename_ = templates/slave-db-manage.in
md5sum =
cefcb8c7d17367b14414314ffd325c2
6
md5sum =
a995bcd2751739710ba01a269d3d5b4
6
software/repman/instance-repman.cfg.jinja2.in
View file @
1fd1b5e1
...
...
@@ -110,6 +110,9 @@ output = ${directory:bin}/update-proxysql-config
'cluster_id': instance_dict.get('cluster_id', default_slave_cluster_id),
'require_ssl': True
} -%}
{% if not slave_dict['cluster_id'] in cluster_name_list -%}
{% do slave_dict.__setitem__('cluster_id', default_slave_cluster_id) -%}
{% endif -%}
{% do slave_information_list.append(slave_dict) -%}
{% do database_slave_dict[slave_dict['cluster_id']].append(slave_dict) -%}
{% do db_name_dict[slave_dict['cluster_id']].append([slave_dict['name'], slave_dict['user']]) -%}
...
...
software/repman/templates/slave-db-manage.in
View file @
1fd1b5e1
...
...
@@ -2,27 +2,17 @@
set
-e
curl
()
{
{{
curl_bin
}}
-k
--silent
-H
"Accept: application/json"
"
$@
"
}
get_token
()
{
curl
-s
-X
POST
--data
'{"username":"{{ username }}","password":"{{ password}}"}'
{{
secure_url
}}
/api/login
}
run_mysql
()
{
{{
mysql_bin
}}
--defaults-file
=
"{{ mysql_conf }}"
--protocol
=
socket
"
$@
"
}
TOKEN
=
$(
get_token |
{{
jq_bin
}}
-r
'.token'
)
DATADIR
=
$(
curl
-H
"Authorization: Bearer
${
TOKEN
}
"
\
{{
secure_url
}}
/api/clusters/
{{
cluster_name
}}
/topology/master |
{{
jq_bin
}}
-r
'.slaposDatadir'
)
revoke_user
()
{
DB
=
$1
UNAME
=
$2
if
[
!
-z
"
$UNAME
"
]
;
then
echo
"Revoking all grants for user '
$USER
'"
;
run_mysql
-Be
"
set sql_log_bin=0;
REVOKE ALL PRIVILEGES, GRANT OPTION FROM '
$UNAME
';
DROP USER IF EXISTS '
$UNAME
'@'%';
DROP USER IF EXISTS '
$UNAME
'@'localhost';
...
...
@@ -32,10 +22,10 @@ revoke_user () {
fi
}
# Only write or delete on master database else, we break replication.
if
[
"
$DATADIR
"
=
"{{ partition_dir }}"
]
;
then
# Disable SQL_LOG_BIN, repman_slave_definition database doesn't need to be replicated
cat
<<
EOF
> {{ tmp_dir }}/.script.sql
cat
<<
EOF
> {{ tmp_dir }}/.script.sql
SET @@SESSION.SQL_LOG_BIN=0;
use repman_slave_definition;
CREATE TABLE IF NOT EXISTS
\`
slave
\`
(
...
...
@@ -54,34 +44,33 @@ REPLACE INTO \`slave\` VALUES ('{{ name }}', true, '{{ user }}');
EOF
# Update requested slaves database
OUTPUT
=
"{{ tmp_dir }}/removed_db.txt"
run_mysql <
{{
tmp_dir
}}
/.script.sql
rm
-f
{{
tmp_dir
}}
/.script.sql
run_mysql
-NBe
"
SELECT name, user FROM repman_slave_definition.slave WHERE state=false"
>
$OUTPUT
# Update requested slaves database
OUTPUT
=
"{{ tmp_dir }}/removed_db.txt"
run_mysql <
{{
tmp_dir
}}
/.script.sql
rm
-f
{{
tmp_dir
}}
/.script.sql
run_mysql
-NBe
"set sql_log_bin=0;
SELECT name, user FROM repman_slave_definition.slave WHERE state=false"
>
$OUTPUT
DBNAME
=
$(
run_mysql
--skip-column-names
-Be
"
SELECT name FROM repman_slave_definition.slave WHERE state=false"
)
;
RET
=
$?
DBNAME
=
$(
run_mysql
--skip-column-names
-Be
"set sql_log_bin=0;
SELECT name FROM repman_slave_definition.slave WHERE state=false"
)
;
RET
=
$?
if
[
!
"
$RET
"
=
"0"
]
;
then
echo
"Mysql command failed:
$DBNAME
"
exit
$RET
fi
if
[
!
"
$RET
"
=
"0"
]
;
then
echo
"Mysql command failed:
$DBNAME
"
exit
$RET
fi
if
[
-z
"
$DBNAME
"
]
;
then
echo
"No database for slave to remove."
;
fi
if
[
-z
"
$DBNAME
"
]
;
then
echo
"No database for slave to remove."
;
fi
for
NAME
in
$DBNAME
;
do
if
[
!
-z
"
$NAME
"
]
;
then
USER
=
$(
grep
-oP
"
$NAME
\s
*
\K\w
+"
$OUTPUT
)
;
if
[
!
-z
"
$USER
"
]
;
then
revoke_user
$NAME
$USER
;
fi
echo
"Deleting database
$NAME
..."
run_mysql
-e
"DROP DATABASE IF EXISTS
$NAME
"
;
run_mysql
-e
"DELETE FROM repman_slave_definition.slave WHERE name='
$NAME
'"
;
echo
"Done."
for
NAME
in
$DBNAME
;
do
if
[
!
-z
"
$NAME
"
]
;
then
USER
=
$(
grep
-oP
"
$NAME
\s
*
\K\w
+"
$OUTPUT
)
;
if
[
!
-z
"
$USER
"
]
;
then
revoke_user
$NAME
$USER
;
fi
done
fi
echo
"Deleting database
$NAME
..."
run_mysql
-e
"set sql_log_bin=0;DROP DATABASE IF EXISTS
$NAME
"
;
run_mysql
-e
"set sql_log_bin=0;DELETE FROM repman_slave_definition.slave WHERE name='
$NAME
'"
;
echo
"Done."
fi
done
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