feat!(mgrctl) new release 0.1.1

Updated:
      - dependencies
      - docker hub latest image

    Fixed:
      - dci input container name

    Changed:
      - remove peewee deps
      - remove data base management
      - remove mysql container for dev env
      - remove \__version__ from sub app
This commit is contained in:
2025-05-07 16:17:20 +09:00
parent 99dd122262
commit 6bbebd5a7a
28 changed files with 1236 additions and 5698 deletions

View File

@@ -5,9 +5,7 @@ import urllib
import requests
from time import sleep
from mgrctl.settings.api import (
API_INPUT_PORT,
API_URL,
API_HEADERS,
API_EMAIL,
@@ -15,7 +13,6 @@ from mgrctl.settings.api import (
API_VERIFY_SSL,
API_COUNT_TRY_CONNECTIONS
)
from mgrctl.settings.platform import PLATFORM_TYPE
class BaseAPI(object):
@@ -33,13 +30,15 @@ class BaseAPI(object):
return f'{self.API_URL}/{self.API_DEFINITION}/{self.API_VERSION}{url}'
def call_api(self, url, method='GET', headers={}, data={}):
# set conn params
attempt = API_COUNT_TRY_CONNECTIONS
uri = self._gen_request_url(url)
headers = self.API_HEADERS if not headers else headers
params_str = urllib.parse.urlencode(data, safe="+'()")
# connect
while attempt:
attempt -= 1
try:
uri = self._gen_request_url(url)
headers = self.API_HEADERS if not headers else headers
params_str = urllib.parse.urlencode(data, safe="+'()")
if method == 'POST':
api_request = requests.post(
url=uri,
@@ -56,12 +55,10 @@ class BaseAPI(object):
)
except Exception as error:
ConnectionError = requests.exceptions.ConnectionError
if type(error) is ConnectionError and PLATFORM_TYPE == 'dci':
# ? workaround if new docker version use dashes
# TODO: ISPsystem developers must set container_name !!!
self.API_URL = f'http://dci-input-1:{API_INPUT_PORT}'
if type(error) is ConnectionError:
if attempt == 0:
click.echo(f'Error: {type(error).__name__}')
click.echo(f'mgrctl cannot connect to {self.API_URL}')
sys.exit()
else:
continue