renamed config service get_text to get_text_template to be more obvious to the purpose
This commit is contained in:
parent
422bf9ac15
commit
852eb60ab9
2 changed files with 4 additions and 4 deletions
|
@ -142,7 +142,7 @@ class ConfigService(abc.ABC):
|
|||
def set_template(self, name: str, template: str) -> None:
|
||||
self.custom_templates[name] = template
|
||||
|
||||
def get_text(self, name: str) -> str:
|
||||
def get_text_template(self, name: str) -> str:
|
||||
raise CoreError(f"service({self.name}) unknown template({name})")
|
||||
|
||||
def get_templates(self) -> Dict[str, str]:
|
||||
|
@ -155,7 +155,7 @@ class ConfigService(abc.ABC):
|
|||
elif self.templates.has_template(basename):
|
||||
template = self.templates.get_template(basename).source
|
||||
else:
|
||||
template = self.get_text(name)
|
||||
template = self.get_text_template(name)
|
||||
template = self.clean_text(template)
|
||||
templates[name] = template
|
||||
return templates
|
||||
|
@ -171,7 +171,7 @@ class ConfigService(abc.ABC):
|
|||
elif self.templates.has_template(basename):
|
||||
rendered = self.render_template(basename, data)
|
||||
else:
|
||||
text = self.get_text(name)
|
||||
text = self.get_text_template(name)
|
||||
text = self.clean_text(text)
|
||||
rendered = self.render_text(text, data)
|
||||
logging.info(
|
||||
|
|
|
@ -25,7 +25,7 @@ class SimpleService(ConfigService):
|
|||
"mode3": {"value1": "m3", "value2": "m3", "value3": "m3"},
|
||||
}
|
||||
|
||||
def get_text(self, name: str) -> str:
|
||||
def get_text_template(self, name: str) -> str:
|
||||
if name == "test1.sh":
|
||||
return """
|
||||
# sample script 1
|
||||
|
|
Loading…
Reference in a new issue