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
Paul Graydon
slapos
Commits
ace7f39b
Commit
ace7f39b
authored
Sep 18, 2024
by
Paul Graydon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
software/wendelin-telecom: Rework slave instances for use by ORS
parent
d79bc190
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
45 additions
and
107 deletions
+45
-107
software/wendelin-telecom/buildout.hash.cfg
software/wendelin-telecom/buildout.hash.cfg
+1
-1
software/wendelin-telecom/instance-shared-input-schema.json
software/wendelin-telecom/instance-shared-input-schema.json
+1
-16
software/wendelin-telecom/instance-shared-output-schema.json
software/wendelin-telecom/instance-shared-output-schema.json
+1
-14
software/wendelin-telecom/instance-wendelin-telecom-input-schema.json
...delin-telecom/instance-wendelin-telecom-input-schema.json
+1
-6
software/wendelin-telecom/instance-wendelin-telecom.cfg.in
software/wendelin-telecom/instance-wendelin-telecom.cfg.in
+34
-68
software/wendelin-telecom/software.cfg
software/wendelin-telecom/software.cfg
+6
-1
software/wendelin-telecom/software.cfg.json
software/wendelin-telecom/software.cfg.json
+1
-1
No files found.
software/wendelin-telecom/buildout.hash.cfg
View file @
ace7f39b
...
...
@@ -4,4 +4,4 @@ md5sum = 79e4a9d4c632eaf0472929464a12e768
[template-wendelin-telecom]
filename = instance-wendelin-telecom.cfg.in
md5sum =
eb17784ee1a9d1f5bf8f5741cd733446
md5sum =
5ed2d5da369b5b73eabf8045666ebebc
software/wendelin-telecom/instance-shared-input-schema.json
View file @
ace7f39b
...
...
@@ -2,25 +2,10 @@
"$schema"
:
"http://json-schema.org/draft-07/schema#"
,
"type"
:
"object"
,
"properties"
:
{
"project-title"
:
{
"description"
:
"Title of the ORS client project to register"
,
"title"
:
"Client Project Title"
,
"type"
:
"string"
},
"client-username"
:
{
"description"
:
"Username for the client project's user account"
,
"title"
:
"Client Project Account Username"
,
"type"
:
"string"
},
"ors-tag"
:
{
"description"
:
"Fluentbit tag of the ORS to register
to the client project
"
,
"description"
:
"Fluentbit tag of the ORS to register"
,
"title"
:
"ORS Tag"
,
"type"
:
"string"
},
"ors-title"
:
{
"description"
:
"Title of the ORS to register to the client project"
,
"title"
:
"ORS Title"
,
"type"
:
"string"
}
}
}
software/wendelin-telecom/instance-shared-output-schema.json
View file @
ace7f39b
...
...
@@ -2,18 +2,5 @@
"$schema"
:
"http://json-schema.org/draft-07/schema#"
,
"description"
:
"Values returned by Wendelin Telecom"
,
"type"
:
"object"
,
"properties"
:
{
"ors-wendelin-homepage"
:
{
"description"
:
"URL to the homepage of the Wendelin Telecom platform"
,
"type"
:
"string"
},
"username"
:
{
"description"
:
"Username for the project's user account"
,
"type"
:
"string"
},
"init-password"
:
{
"description"
:
"Initial password for the project's user account"
,
"type"
:
"string"
}
}
"properties"
:
{}
}
software/wendelin-telecom/instance-wendelin-telecom-input-schema.json
View file @
ace7f39b
{
"$schema"
:
"http://json-schema.org/draft-07/schema#"
,
"type"
:
"object"
,
"properties"
:
{
"client-frontend-url"
:
{
"description"
:
"Base URL of the Wendelin Telecom frontend instance intended for use by the clients."
,
"type"
:
"string"
}
}
"properties"
:
{}
}
software/wendelin-telecom/instance-wendelin-telecom.cfg.in
View file @
ace7f39b
...
...
@@ -3,23 +3,17 @@ extends =
{{ instance_erp5 }}
parts +=
ors-
client-project-
register
ors-register
[directory]
ors-client-project-register = ${:etc}/ors-client-project-register
[ors-client-project-register]
[ors-register]
recipe = slapos.recipe.build
slave-instance-list = {{ dumps(slave_instance_list) }}
ors-client-project-register-path = ${directory:ors-client-project-register}
backend-url = ${publish:family-default-v6}
client-frontend-url = {{ slapparameter_dict.get('client-frontend-url', '')}}
site-id = ${publish:site-id}
inituser-login = ${publish:inituser-login}
inituser-password = ${publish-early:inituser-password}
update =
import json
import logging
import os
import requests
import slapos
...
...
@@ -31,7 +25,6 @@ update =
self.computer_id = slap_connection['computer-id']
self.computer_partition_id = slap_connection['partition-id']
self.server_url = slap_connection['server-url']
self.software_release_url = slap_connection['software-release-url']
self.key_file = slap_connection.get('key-file')
self.cert_file = slap_connection.get('cert-file')
self.slave_instance_list = list(options['slave-instance-list'])
...
...
@@ -40,9 +33,18 @@ update =
slap.initializeConnection(self.server_url, self.key_file, self.cert_file)
computer_partition = slap.registerComputerPartition(self.computer_id, self.computer_partition_id)
ors_client_project_register_path = options['ors-client-project-register-path']
wendelin_telecom_backend_url = options['backend-url']
wendelin_telecom_client_frontend_url = options['client-frontend-url']
request_balancer = self.buildout['request-balancer']
zope_family_name_list = ['ingestion', 'web', 'default']
wendelin_telecom_backend_url = None
for family_name in zope_family_name_list:
connection_name = 'connection-%s-v6' % family_name
if connection_name in request_balancer:
wendelin_telecom_backend_url = request_balancer[connection_name]
break
if not wendelin_telecom_backend_url:
log.fatal("Wendelin Telecom backend URL not found, cannot register")
else:
wendelin_telecom_site_id = options['site-id']
inituser_login = options['inituser-login']
inituser_password = options['inituser-password']
...
...
@@ -50,27 +52,12 @@ update =
slave_reference = slave['slave_reference']
try:
project_title = slave['project-title']
project_reference = project_title.replace(" ", "_").lower()
client_username = slave['client-username']
ors_tag = slave['ors-tag']
ors_title = slave['ors-title']
except KeyError as e:
log.fatal("%s: Parameter %s not found, skipping registration" % (slave_reference, e))
except KeyError as err:
log.fatal("%s: Parameter %s not found, skipping registration" % (slave_reference, err))
continue
register_file = os.path.join(ors_client_project_register_path, '%s.json' % slave_reference)
connection_dict = {}
if not os.path.exists(register_file):
with open(register_file, 'w') as file:
json.dump(connection_dict, file)
else:
with open(register_file, 'r') as file:
connection_dict = json.load(file)
request_url = "%s/erp5/Base_registerOrsClientProject?project_reference=%s&project_title=%s&client_username=%s&ors_tag=%s&ors_title=%s" \
% (wendelin_telecom_backend_url, project_reference, project_title, client_username, ors_tag, ors_title)
request_url = "%s/%s/ERP5Site_registerOrs?ors_tag=%s" % (wendelin_telecom_backend_url, wendelin_telecom_site_id, ors_tag)
response = requests.get(request_url, verify=False, auth=(inituser_login, inituser_password))
response = response.json()
...
...
@@ -80,28 +67,7 @@ update =
error_msg = response[error_msg_key]
log.info(error_msg)
else:
if "username" in response and "init_password" in response:
connection_dict = {
"username": response['username'],
"init-password": response['init_password']
}
with open(register_file, 'w') as file:
json.dump(connection_dict, file)
log.info("ORS client project successfully registered: %s" % slave_reference)
else:
log.fatal("Error while fetching client user account credentials")
continue
no_client_frontend_url_msg = "Wendelin Telecom website has not been configured."
connection_dict['wendelin-telecom-homepage'] = wendelin_telecom_client_frontend_url or no_client_frontend_url_msg
try:
log.info("Update parameters for client project %s" % slave_reference)
computer_partition.setConnectionDict(connection_dict, slave_reference)
except Exception:
log.fatal("Error while sending slave %s information: %s",
slave_reference, traceback.format_exc())
log.info("ORS successfully registered: %s" % slave_reference)
[publish]
slave-amount = {{ len(slave_instance_list) }}
software/wendelin-telecom/software.cfg
View file @
ace7f39b
...
...
@@ -34,7 +34,7 @@ depends =
<= erp5
repository = https://lab.nexedi.com/paul.graydon/wendelin-telecom.git
branch = master
revision =
71d02c8d6cce7e9970b1371d149622f201440fda
revision =
d29e4e3ede129af6b2ba2726e0b4b4e1f324ea0d
[local-bt5-repository]
list += ${wendelin-telecom:location}/bt5
...
...
@@ -42,6 +42,11 @@ list += ${wendelin-telecom:location}/bt5
[erp5_repository_list]
repository_id_list += wendelin-telecom
[default-bt5]
list =
erp5_full_text_mroonga_catalog
wendelin_telecom_configurator
[template]
output = ${buildout:directory}/template-base.cfg
...
...
software/wendelin-telecom/software.cfg.json
View file @
ace7f39b
...
...
@@ -12,7 +12,7 @@
},
"default-slave"
:
{
"title"
:
"Default (Shared)"
,
"description"
:
"ORS
Client Project
Registration"
,
"description"
:
"ORS Registration"
,
"software-type"
:
"default"
,
"request"
:
"instance-shared-input-schema.json"
,
"response"
:
"instance-shared-output-schema.json"
,
...
...
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