Add logging statements for import functions (#83423)
gitea/publik-imio-industrialisation/pipeline/head This commit looks good
Details
gitea/publik-imio-industrialisation/pipeline/head This commit looks good
Details
TELE-1842
This commit is contained in:
parent
a054970ec3
commit
580f46dd32
|
@ -1,3 +1,4 @@
|
|||
import logging
|
||||
import os
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
|
@ -19,6 +20,7 @@ from wcs.wscalls import NamedWsCall
|
|||
|
||||
from ..qommon.ctl import Command, make_option
|
||||
|
||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
||||
|
||||
class Cmd(Command):
|
||||
name = 'imio_import_directory'
|
||||
|
@ -60,6 +62,7 @@ class Cmd(Command):
|
|||
if not os.path.exists(os.path.join(self.directory, dirname)):
|
||||
continue
|
||||
for filename in os.listdir(os.path.join(self.directory, dirname)):
|
||||
logging.info ('Importing %s %s', dirname, filename)
|
||||
category = category_klass.import_from_xml(
|
||||
open(os.path.join(self.directory, dirname, filename))
|
||||
)
|
||||
|
@ -78,6 +81,7 @@ class Cmd(Command):
|
|||
if not os.path.exists(os.path.join(self.directory, 'datasources')):
|
||||
return
|
||||
for filename in os.listdir(os.path.join(self.directory, 'datasources')):
|
||||
logging.info('Importing datasource %s', filename)
|
||||
datasource = NamedDataSource.import_from_xml(
|
||||
open(os.path.join(self.directory, 'datasources', filename))
|
||||
)
|
||||
|
@ -96,6 +100,7 @@ class Cmd(Command):
|
|||
if not os.path.exists(os.path.join(self.directory, 'mail-templates')):
|
||||
return
|
||||
for filename in os.listdir(os.path.join(self.directory, 'mail-templates')):
|
||||
logging.info('Importing mail template %s', filename)
|
||||
mail_template = MailTemplate.import_from_xml(
|
||||
open(os.path.join(self.directory, 'mail-templates', filename))
|
||||
)
|
||||
|
@ -114,6 +119,7 @@ class Cmd(Command):
|
|||
if not os.path.exists(os.path.join(self.directory, 'workflows')):
|
||||
return
|
||||
for filename in os.listdir(os.path.join(self.directory, 'workflows')):
|
||||
logging.info('Importing workflow %s', filename)
|
||||
workflow = Workflow.import_from_xml(
|
||||
open(os.path.join(self.directory, 'workflows', filename)),
|
||||
include_id=False,
|
||||
|
@ -136,6 +142,7 @@ class Cmd(Command):
|
|||
if not os.path.exists(os.path.join(self.directory, 'wscalls')):
|
||||
return
|
||||
for filename in os.listdir(os.path.join(self.directory, 'wscalls')):
|
||||
logging.info('Importing wscall %s', filename)
|
||||
wscall = NamedWsCall.import_from_xml(open(os.path.join(self.directory, 'wscalls', filename)))
|
||||
try:
|
||||
existing_wscall = NamedWsCall.get(filename, ignore_errors=False)
|
||||
|
@ -152,6 +159,7 @@ class Cmd(Command):
|
|||
if not os.path.exists(os.path.join(self.directory, 'blocks')):
|
||||
return
|
||||
for filename in os.listdir(os.path.join(self.directory, 'blocks')):
|
||||
logging.info('Importing block %s', filename)
|
||||
fd = open(os.path.join(self.directory, 'blocks', filename))
|
||||
tree = ET.parse(fd)
|
||||
# do not use import_from_xml to avoid autofixing url_name.
|
||||
|
@ -171,6 +179,7 @@ class Cmd(Command):
|
|||
if not os.path.exists(os.path.join(self.directory, 'carddefs')):
|
||||
return
|
||||
for filename in os.listdir(os.path.join(self.directory, 'carddefs')):
|
||||
logging.info('Importing carddef %s', filename)
|
||||
fd = open(os.path.join(self.directory, 'carddefs', filename))
|
||||
tree = ET.parse(fd)
|
||||
# do not use import_from_xml to avoid autofixing url_name.
|
||||
|
@ -199,6 +208,7 @@ class Cmd(Command):
|
|||
if not os.path.exists(os.path.join(self.directory, 'forms')):
|
||||
return
|
||||
for filename in os.listdir(os.path.join(self.directory, 'forms')):
|
||||
logging.info('Importing formdef %s', filename)
|
||||
fd = open(os.path.join(self.directory, 'forms', filename))
|
||||
tree = ET.parse(fd)
|
||||
# do not use import_from_xml to avoid autofixing url_name.
|
||||
|
|
Loading…
Reference in New Issue