Loading src/clients/artefact_manager.py 0 → 100644 +34 −0 Original line number Diff line number Diff line # -------------------------------------------------------------------------- # # Copyright 2025-present, Federation Manager, by Software Networks, i2CAT # # # # Licensed under the Apache License, Version 2.0 (the "License"); you may # # not use this file except in compliance with the License. You may obtain # # a copy of the License at # # # # http://www.apache.org/licenses/LICENSE-2.0 # # # # Unless required by applicable law or agreed to in writing, software # # distributed under the License is distributed on an "AS IS" BASIS, # # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # # limitations under the License. # # -------------------------------------------------------------------------- # import requests from configparser import ConfigParser from requests import Response CONFIG = ConfigParser() CONFIG.read("conf/config.cfg") HOST = CONFIG.get("artefact_manager", "host") PORT = int(CONFIG.get("artefact_manager", "port")) TIMEOUT_REQUESTS = 20 def post_copy_artefact(params: dict) -> Response: url = f"http://{HOST}:{PORT}/copy-artefact" headers = { "accept": "application/json", "Content-Type": "application/json" } return requests.post(url, json=params, headers=headers, timeout=TIMEOUT_REQUESTS) src/conf/config.cfg.sample +9 −0 Original line number Diff line number Diff line Loading @@ -39,3 +39,12 @@ host = 192.168.123.237 port = 30769 client_name = i2edge flavour_id = 67f3a0b0e3184a85952e174d [artefact_manager] host = 192.168.123.237 port = 30769 enabled = true dst_registry = dst_username = dst_password = dst_token = Loading
src/clients/artefact_manager.py 0 → 100644 +34 −0 Original line number Diff line number Diff line # -------------------------------------------------------------------------- # # Copyright 2025-present, Federation Manager, by Software Networks, i2CAT # # # # Licensed under the Apache License, Version 2.0 (the "License"); you may # # not use this file except in compliance with the License. You may obtain # # a copy of the License at # # # # http://www.apache.org/licenses/LICENSE-2.0 # # # # Unless required by applicable law or agreed to in writing, software # # distributed under the License is distributed on an "AS IS" BASIS, # # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # # See the License for the specific language governing permissions and # # limitations under the License. # # -------------------------------------------------------------------------- # import requests from configparser import ConfigParser from requests import Response CONFIG = ConfigParser() CONFIG.read("conf/config.cfg") HOST = CONFIG.get("artefact_manager", "host") PORT = int(CONFIG.get("artefact_manager", "port")) TIMEOUT_REQUESTS = 20 def post_copy_artefact(params: dict) -> Response: url = f"http://{HOST}:{PORT}/copy-artefact" headers = { "accept": "application/json", "Content-Type": "application/json" } return requests.post(url, json=params, headers=headers, timeout=TIMEOUT_REQUESTS)
src/conf/config.cfg.sample +9 −0 Original line number Diff line number Diff line Loading @@ -39,3 +39,12 @@ host = 192.168.123.237 port = 30769 client_name = i2edge flavour_id = 67f3a0b0e3184a85952e174d [artefact_manager] host = 192.168.123.237 port = 30769 enabled = true dst_registry = dst_username = dst_password = dst_token =