Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
smartpublicbuilding
openhab-pb-stack
Commits
3bef843d
Commit
3bef843d
authored
Apr 15, 2019
by
dobli
Browse files
use fixed template folder
parent
3c47f5b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
building_manager.py
View file @
3bef843d
...
...
@@ -35,6 +35,7 @@ st = Style([
(
'instruction'
,
''
)
# user instructions for selections
])
# ******************************
# Constants <<<
# ******************************
...
...
@@ -109,6 +110,14 @@ class Service(ServiceBody, Enum):
# >>>
# ******************************
# State Variables <<<
# ******************************
base_dir
=
sys
.
path
[
0
]
template_path
=
f
'
{
base_dir
}
/
{
TEMPLATE_DIR
}
'
# >>>
# ******************************
# Compose file functions <<<
# ******************************
...
...
@@ -119,10 +128,9 @@ def generate_initial_compose(base_dir):
:base_dir: Folder to place configuration files into
"""
base_path
=
base_dir
+
'/'
+
CUSTOM_DIR
template_path
=
base_dir
+
'/'
+
TEMPLATE_DIR
custom_path
=
base_dir
+
'/'
+
CUSTOM_DIR
# compose file
compose
=
base
_path
+
'/'
+
COMPOSE_NAME
compose
=
custom
_path
+
'/'
+
COMPOSE_NAME
# skeleton file
skeleton
=
template_path
+
'/'
+
SKELETON_NAME
...
...
@@ -515,7 +523,6 @@ def get_service_template(base_dir, service_name):
:return: yaml entry of a service
"""
template_path
=
base_dir
+
'/'
+
TEMPLATE_DIR
templates
=
template_path
+
'/'
+
TEMPLATES_NAME
with
open
(
templates
,
'r'
)
as
templates_file
:
...
...
@@ -682,10 +689,10 @@ def copy_template_config(base_dir, config_path):
:config_path: relative path of config to copy from template
"""
custom_path
=
base_dir
+
'/'
+
CUSTOM_DIR
+
"/"
+
config_path
template_
path
=
base_dir
+
'/'
+
TEMPLATE_DIR
+
"/"
+
config_path
template_
config
=
f
"
{
template_path
}
/
{
config_path
}
"
logging
.
info
(
f
'Copy
{
config_path
}
from
{
custom_path
}
to
{
template
_path
}
'
)
copy2
(
template_
path
,
custom_path
)
logging
.
info
(
f
'Copy
{
config_path
}
from
{
template_config
}
to
{
custom
_path
}
'
)
copy2
(
template_
config
,
custom_path
)
def
generate_mosquitto_user_line
(
username
,
password
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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