Skip to content

Commit 09191a2

Browse files
authored
Refactor DEFAULT_LOGGING_CONF_PATH calculation to allow fine-grained pants dep inference (#5858)
* pants: Inform pants more precisely about dependence on st2common.conf:base.logging.conf * update changelog entry * update copyright to 2023 in st2common/st2common/conf/__init__.py
1 parent cd4ab0b commit 09191a2

5 files changed

Lines changed: 25 additions & 12 deletions

File tree

CHANGELOG.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ Added
1414
working on StackStorm, improve our security posture, and improve CI reliability thanks in part
1515
to pants' use of PEX lockfiles. This is not a user-facing addition.
1616
#5778 #5789 #5817 #5795 #5830 #5833 #5834 #5841 #5840 #5838 #5842 #5837 #5849 #5850
17-
#5846 #5853 #5848 #5847
17+
#5846 #5853 #5848 #5847 #5858
1818
Contributed by @cognifloyd
1919

2020
* Added a joint index to solve the problem of slow mongo queries for scheduled executions. #5805

st2common/st2common/conf/BUILD

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,7 @@ resource(
33
name="base.logging.conf",
44
source="base.logging.conf",
55
)
6+
7+
python_sources(
8+
dependencies=[":base.logging.conf"],
9+
)
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Copyright 2023 The StackStorm Authors.
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import os
16+
17+
CONF_DIR = os.path.abspath(os.path.dirname(os.path.abspath(__file__)))
18+
BASE_LOGGING_CONF_PATH = os.path.join(CONF_DIR, "base.logging.conf")
Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
1-
python_sources(
2-
dependencies=[
3-
"st2common/st2common/conf:base.logging.conf",
4-
]
5-
)
1+
python_sources()

st2common/st2common/constants/logging.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@
1414
# limitations under the License.
1515

1616
from __future__ import absolute_import
17-
import os
17+
from st2common.conf import BASE_LOGGING_CONF_PATH as DEFAULT_LOGGING_CONF_PATH
1818

1919
__all__ = ["DEFAULT_LOGGING_CONF_PATH"]
20-
21-
BASE_PATH = os.path.dirname(os.path.abspath(__file__))
22-
23-
DEFAULT_LOGGING_CONF_PATH = os.path.join(BASE_PATH, "../conf/base.logging.conf")
24-
DEFAULT_LOGGING_CONF_PATH = os.path.abspath(DEFAULT_LOGGING_CONF_PATH)

0 commit comments

Comments
 (0)