Skip to content

Commit

Permalink
Bump dependencies to most recent versions
Browse files Browse the repository at this point in the history
As a consequence:
* Change human-readable noqa to codes, due to Ruff limitations: <astral-sh/ruff#5571>
* Fix E721: Do not compare types, use `isinstance()`
* Updated and ran pre-commit
* Ignore MD024 (we don't care)
  • Loading branch information
jeohist committed Nov 30, 2023
1 parent 36064b2 commit 55ce9e4
Show file tree
Hide file tree
Showing 32 changed files with 94 additions and 94 deletions.
1 change: 1 addition & 0 deletions .github/.mdl_style.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
all
exclude_rule 'MD007'
exclude_rule 'MD013'
exclude_rule 'MD024'
exclude_rule 'MD029'
exclude_rule 'MD034'
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
fail_fast: false
repos:
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.30.0
rev: v1.33.0
hooks:
- id: yamllint
args: ["--format", "parsable", "--strict"]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -20,6 +20,6 @@ repos:
hooks:
- id: markdownlint_docker
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: 'v0.0.261'
rev: 'v0.1.6'
hooks:
- id: ruff
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ TEST_FILES ?= tests/integration/test_*.py
VERSION ?= $(shell git tag --list --sort=-version:refname "v*" | head -n 1)
COMMIT ?= $(shell git rev-parse --short HEAD)

PIP_TOOLS_VERSION ?= 6.13.0
PIP_VERSION ?= 23.1
PIP_TOOLS_VERSION ?= 7.3.0
PIP_VERSION ?= 23.3.1
PYTHON_PLATFORM ?= manylinux2014_x86_64
PYTHON_VERSION ?= 310

Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ For the third-party integrations explained above, in addition to the metrics col
This configuration also has a filtering mechanism that allows users to specify metrics they allow or deny for the vendor they are using.
To filter the ingestion of custom runtime metrics to third party APMs, users should provide a list of prefixes of the metrics they want to allow/deny using the environment variables listed below.

Note: Custom database metrics cannot be filtered by name, to turn them off, the `APPMETRICS_INCLUDE_DB` environment variable should be set to false.
Note: Custom database metrics cannot be filtered by name, to turn them off, the `APPMETRICS_INCLUDE_DB` environment variable should be set to false.

#### APM_METRICS_FILTER_ALLOW

Expand All @@ -909,7 +909,7 @@ cf set-env <YOUR_APP> APM_METRICS_FILTER_ALLOW 'mx.runtime.stats.sessions'

#### APM_METRICS_FILTER_DENY

Comma-separated list of prefixes for the metrics to be denied.
Comma-separated list of prefixes for the metrics to be denied.

For example, to deny all metrics starting with jetty or mx.runtime, the environment variable should be set to `jetty,mx.runtime`:

Expand All @@ -925,7 +925,6 @@ If this environment variable is set to `true`, all metrics will be denied regard
cf set-env <YOUR_APP> APM_METRICS_FILTER_DENY_ALL true
```


## Using the Buildpack without an Internet Connection

If you are running Cloud Foundry without a connection to the Internet, you should specify an on-premises web server that hosts Mendix Runtime files and other buildpack dependencies. You can set the endpoint with the following environment variable:
Expand Down
2 changes: 1 addition & 1 deletion bin/install-python
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,4 @@ function get_python_from_manifest() {
echo "$python_dep_info"
}

main "${@:-}"
main "${@:-}"
2 changes: 1 addition & 1 deletion buildpack/core/java.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ def stage(buildpack_path, cache_path, local_path, java_major_version):


def _compose_jvm_target_dir(dependency):
return f"usr/lib/jvm/{dependency['vendor']}-{dependency['type']}-{dependency['version']}-{dependency['vendor']}-x64" # noqa: line-too-long
return f"usr/lib/jvm/{dependency['vendor']}-{dependency['type']}-{dependency['version']}-{dependency['vendor']}-x64" # noqa: C0301


def _get_java_dependency(
Expand Down
12 changes: 6 additions & 6 deletions buildpack/core/nginx.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
from lib.m2ee.util import strtobool

ALLOWED_HEADERS = {
"X-Frame-Options": r"(?i)(^allow-from https?://([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*(:\d+)?$|^deny$|^sameorigin$)", # noqa: line-too-long
"Referrer-Policy": r"(?i)(^no-referrer$|^no-referrer-when-downgrade$|^origin|origin-when-cross-origin$|^same-origin|strict-origin$|^strict-origin-when-cross-origin$|^unsafe-url$)", # noqa: line-too-long
"Access-Control-Allow-Origin": r"(?i)(^\*$|^null$|^https?://([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*(:\d+)?$)", # noqa: line-too-long
"X-Frame-Options": r"(?i)(^allow-from https?://([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*(:\d+)?$|^deny$|^sameorigin$)", # noqa: C0301
"Referrer-Policy": r"(?i)(^no-referrer$|^no-referrer-when-downgrade$|^origin|origin-when-cross-origin$|^same-origin|strict-origin$|^strict-origin-when-cross-origin$|^unsafe-url$)", # noqa: C0301
"Access-Control-Allow-Origin": r"(?i)(^\*$|^null$|^https?://([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*(:\d+)?$)", # noqa: C0301
"X-Content-Type-Options": r"(?i)(^nosniff$)",
"Content-Security-Policy": r"[a-zA-Z0-9:;/''\"\*_\- \.\n?=%&+]+",
"Strict-Transport-Security": r"(?i)(^max-age=[0-9]*$|^max-age=[0-9]*; includeSubDomains$|^max-age=[0-9]*; preload$)", # noqa: line-too-long
"X-Permitted-Cross-Domain-Policies": r"(?i)(^all$|^none$|^master-only$|^by-content-type$|^by-ftp-filename$)", # noqa: line-too-long
"Strict-Transport-Security": r"(?i)(^max-age=[0-9]*$|^max-age=[0-9]*; includeSubDomains$|^max-age=[0-9]*; preload$)", # noqa: C0301
"X-Permitted-Cross-Domain-Policies": r"(?i)(^all$|^none$|^master-only$|^by-content-type$|^by-ftp-filename$)", # noqa: C0301
"Origin-Trial": r"[a-zA-Z0-9:;/''\"\*_\- \.\n?=%&+]+",
"X-XSS-Protection": r"(?i)(^0$|^1$|^1; mode=block$|^1; report=https?://([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*(:\d+)?$)", # noqa: line-too-long
"X-XSS-Protection": r"(?i)(^0$|^1$|^1; mode=block$|^1; report=https?://([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9])(\.([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]{0,61}[a-zA-Z0-9]))*(:\d+)?$)", # noqa: C0301
}

CONFIG_FILE = "nginx/conf/nginx.conf"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from buildpack.databroker.config_generator.scripts.generators.debezium_configs.debezium_interface import ( # noqa: line-too-long
from buildpack.databroker.config_generator.scripts.generators.debezium_configs.debezium_interface import ( # noqa: C0301
DebeziumInterface,
)
from buildpack.databroker.config_generator.scripts.generators.debezium_configs.debezium_default import ( # noqa: line-too-long
from buildpack.databroker.config_generator.scripts.generators.debezium_configs.debezium_default import ( # noqa: C0301
DebeziumDefault,
)

# Do not remove this import, it allows automatic class load
from buildpack.databroker.config_generator.scripts.generators.debezium_configs import * # noqa: line-too-long,F403
from buildpack.databroker.config_generator.scripts.generators.debezium_configs import * # noqa: C0301, F403


def generate_config(config):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from buildpack.databroker.config_generator.scripts.generators.debezium_configs.debezium_interface import ( # noqa: line-too-long
from buildpack.databroker.config_generator.scripts.generators.debezium_configs.debezium_interface import ( # noqa: C0301
DebeziumInterface,
)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from buildpack.databroker.config_generator.scripts.generators.debezium_configs.debezium_interface import ( # noqa: line-too-long
from buildpack.databroker.config_generator.scripts.generators.debezium_configs.debezium_interface import ( # noqa: C0301
DebeziumInterface,
)
from buildpack.databroker.config_generator.scripts.constants import (
Expand Down
12 changes: 6 additions & 6 deletions buildpack/databroker/config_generator/templates/jmx/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
},
{
"include": {
"bean_regex": "kafka\.consumer:type=consumer-coordinator-metrics,client-id=.*", # noqa: line-too-long
"bean_regex": "kafka\.consumer:type=consumer-coordinator-metrics,client-id=.*", # noqa: C0301
"attribute": {
"commit-latency-avg": {
"alias": "kafka.consumer.coordinator.commit-latency-avg"
Expand Down Expand Up @@ -82,10 +82,10 @@
"alias": "kafka.consumer.coordinator.partitions-revoked-latency-max"
},
"partitions-assigned-latency-avg": {
"alias": "kafka.consumer.coordinator.partitions-assigned-latency-avg" # noqa: line-too-long
"alias": "kafka.consumer.coordinator.partitions-assigned-latency-avg" # noqa: C0301
},
"partitions-assigned-latency-max": {
"alias": "kafka.consumer.coordinator.partitions-assigned-latency-max" # noqa: line-too-long
"alias": "kafka.consumer.coordinator.partitions-assigned-latency-max" # noqa: C0301
},
"partitions-lost-latency-avg": {
"alias": "kafka.consumer.coordinator.partitions-lost-latency-avg"
Expand All @@ -98,7 +98,7 @@
},
{
"include": {
"bean_regex": "kafka\.consumer:type=consumer-fetch-manager-metrics,client-id=.*", # noqa: line-too-long
"bean_regex": "kafka\.consumer:type=consumer-fetch-manager-metrics,client-id=.*", # noqa: C0301
"attribute": {
"bytes-consumed-rate": {
"alias": "kafka.consumer.fetch.manager.bytes-consumed-rate"
Expand Down Expand Up @@ -146,7 +146,7 @@
},
{
"include": {
"bean_regex": "kafka\.consumer:type=consumer-fetch-manager-metrics,client-id=.*,topic=.*", # noqa: line-too-long
"bean_regex": "kafka\.consumer:type=consumer-fetch-manager-metrics,client-id=.*,topic=.*", # noqa: C0301
"attribute": {
"bytes-consumed-rate": {
"alias": "kafka.consumer.fetch.manager.bytes-consumed-rate"
Expand Down Expand Up @@ -174,7 +174,7 @@
},
{
"include": {
"bean_regex": "kafka\.consumer:type=consumer-fetch-manager-metrics,partition=.*,topic=.*,client-id=.*", # noqa: line-too-long
"bean_regex": "kafka\.consumer:type=consumer-fetch-manager-metrics,partition=.*,topic=.*,client-id=.*", # noqa: C0301
"attribute": {
"preferred-read-replica": {
"alias": "kafka.consumer.fetch.manager.preferred-read-replica"
Expand Down
6 changes: 3 additions & 3 deletions buildpack/infrastructure/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,8 +252,8 @@ def __init__(self, url, env_vars=None):

def init(self):
patterns = [
r"(?P<type>[a-zA-Z0-9]+)://(?P<user>[^:]+):(?P<password>[^@]+)@(?P<host>[^/]+)/(?P<dbname>[^?]*)(?P<extra>\?.*)?", # noqa: line-too-long
r"jdbc:(?P<type>[a-zA-Z0-9]+)://(?P<host>[^;]+);database=(?P<dbname>[^;]*);user=(?P<user>[^;]+);password=(?P<password>.*)$", # noqa: line-too-long
r"(?P<type>[a-zA-Z0-9]+)://(?P<user>[^:]+):(?P<password>[^@]+)@(?P<host>[^/]+)/(?P<dbname>[^?]*)(?P<extra>\?.*)?", # noqa: C0301
r"jdbc:(?P<type>[a-zA-Z0-9]+)://(?P<host>[^;]+);database=(?P<dbname>[^;]*);user=(?P<user>[^;]+);password=(?P<password>.*)$", # noqa: C0301
]

supported_databases = {
Expand Down Expand Up @@ -465,7 +465,7 @@ def get_database_password(self):
def get_database_jdbc_url(self):
"""Return the database jdbc url for the M2EE configuration"""
url = self.credentials.get("url", "")
pattern = r"jdbc:sap://(?P<host>[^:]+):(?P<port>[0-9]+)/?(?P<q>\?(?P<params>.*))?$" # noqa:line-too-long
pattern = r"jdbc:sap://(?P<host>[^:]+):(?P<port>[0-9]+)/?(?P<q>\?(?P<params>.*))?$" # noqa:C0301
match = re.search(pattern, url)
if match is None:
logging.error("Unable to parse Hana JDBC url string for parameters")
Expand Down
4 changes: 2 additions & 2 deletions buildpack/telemetry/appdynamics.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"APPDYNAMICS_AGENT_APPLICATION_NAME",
default=util.get_app_from_domain(),
),
"APPDYNAMICS_AGENT_NODE_NAME": f"{os.getenv('APPDYNAMICS_AGENT_NODE_NAME', default='node')}-{CF_APPLICATION_INDEX}", # noqa: line-too-long
"APPDYNAMICS_AGENT_NODE_NAME": f"{os.getenv('APPDYNAMICS_AGENT_NODE_NAME', default='node')}-{CF_APPLICATION_INDEX}", # noqa: C0301
"APPDYNAMICS_AGENT_TIER_NAME": os.getenv(
"APPDYNAMICS_AGENT_TIER_NAME", default=CF_APPLICATION_NAME
),
Expand All @@ -33,7 +33,7 @@
"APPDYNAMICS_CONTROLLER_SSL_ENABLED": os.getenv(
"APPDYNAMICS_CONTROLLER_SSL_ENABLED", default="true"
),
"APPDYNAMICS_AGENT_UNIQUE_HOST_ID": f"{os.getenv('APPDYNAMICS_AGENT_UNIQUE_HOST_ID', default=CF_APPLICATION_NAME),}-{CF_APPLICATION_INDEX}", # noqa: line-too-long
"APPDYNAMICS_AGENT_UNIQUE_HOST_ID": f"{os.getenv('APPDYNAMICS_AGENT_UNIQUE_HOST_ID', default=CF_APPLICATION_NAME),}-{CF_APPLICATION_INDEX}", # noqa: C0301
}


Expand Down
2 changes: 1 addition & 1 deletion buildpack/telemetry/appdynamics_telegraf_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ def convert_and_push_payload():
AppDynamics Machine Agent HTTP listener.
"""
# AppDynamics Docs: https://docs.appdynamics.com/22.2/en/infrastructure-visibility/machine-agent/extensions-and-custom-metrics/machine-agent-http-listener # noqa: line-too-long
# AppDynamics Docs: https://docs.appdynamics.com/22.2/en/infrastructure-visibility/machine-agent/extensions-and-custom-metrics/machine-agent-http-listener # noqa: C0301

metrics_str = input()
metrics_dict = json.loads(metrics_str)
Expand Down
4 changes: 2 additions & 2 deletions buildpack/telemetry/datadog.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ def get_service_tag():


def _get_service_from_tags():
dict_filter = lambda x, y: dict( # noqa: unnecessary-lambda-assignment
dict_filter = lambda x, y: dict( # noqa: E731
[(i, x[i]) for i in x if i in set(y)]
)

Expand Down Expand Up @@ -432,7 +432,7 @@ def _get_logging_config():
{
"type": "mask_sequences",
"name": "RFC_5322_email",
"pattern": r"""(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])""", # noqa: line-too-long
"pattern": r"""(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])""", # noqa: C0301
"replace_placeholder": "[EMAIL REDACTED]",
}
)
Expand Down
2 changes: 1 addition & 1 deletion buildpack/telemetry/metering.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def write_file(output_file_path, content):
json.dump(content, f)
except Exception as exception:
raise Exception(
f"Error while trying to write the configuration to a file. Reason: '{exception}'" # noqa: line-too-long
f"Error while trying to write the configuration to a file. Reason: '{exception}'" # noqa: C0301
) from exception


Expand Down
4 changes: 2 additions & 2 deletions buildpack/telemetry/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -686,7 +686,7 @@ def _get_number_of_files(self):

with conn.cursor() as cursor:
cursor.execute(
"SELECT COUNT(id) from system$filedocument WHERE hascontents=true;" # noqa:line-too-long
"SELECT COUNT(id) from system$filedocument WHERE hascontents=true;" # noqa:C0301
)
rows = cursor.fetchall()
if len(rows) == 0:
Expand All @@ -697,7 +697,7 @@ def _get_size_of_files(self):
conn = self._get_db_conn()
with conn.cursor() as cursor:
cursor.execute(
"SELECT SUM(size) from system$filedocument WHERE hascontents=true;" # noqa:line-too-long
"SELECT SUM(size) from system$filedocument WHERE hascontents=true;" # noqa:C0301
)
rows = cursor.fetchall()
if len(rows) == 0:
Expand Down
2 changes: 1 addition & 1 deletion buildpack/telemetry/newrelic.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ def update_config(m2ee, app_name):
util.upsert_javaopts(
m2ee,
[
f"-javaagent:{os.path.join(_get_destination_dir(), 'newrelic', 'newrelic.jar')}", # noqa: line-too-long
f"-javaagent:{os.path.join(_get_destination_dir(), 'newrelic', 'newrelic.jar')}", # noqa: C0301
f"-Dnewrelic.config.labels=\"{_get_labels(app_name)}\"",
]
)
Expand Down
4 changes: 2 additions & 2 deletions buildpack/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def __get_dependencies(obj):
if (
all(
True if k in DO_NOT_RECURSE_FIELDS else _is_dependency_literal(v)
for (k, v) in obj.items() # noqa: line-too-long
for (k, v) in obj.items() # noqa: C0301
)
and DEPENDENCY_ARTIFACT_KEY in obj
):
Expand Down Expand Up @@ -427,7 +427,7 @@ def set_up_launch_environment(deps_dir, profile_dir):
files = [
f
for f in os.listdir(directory)
if os.path.isfile(os.path.join(directory, f)) # noqa: line-too-long
if os.path.isfile(os.path.join(directory, f)) # noqa: C0301
]

for f in files:
Expand Down
2 changes: 1 addition & 1 deletion dependencies-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
sha256: 62e69f0664e0bbb05a6351d4d96dc9ea6b959c4c2e4ccdb124f932d0bdac0e41
cf_stacks:
- cflinuxfs4
source_sha256: 848cb06a5caa85da5c45bd7a9221bb821e33fc2bdcba088c127c58fad44e6343
source_sha256: 848cb06a5caa85da5c45bd7a9221bb821e33fc2bdcba088c127c58fad44e6343
2 changes: 1 addition & 1 deletion lib/m2ee/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def get_critical_log_messages(self):
errors = echo_feedback["errors"]
# default to 3.0 format [{"message":"Hello,
# world!","timestamp":1315316488958,"cause":""}, ...]
if type(errors[0]) != dict:
if not isinstance(errors[0], dict):
return errors
from datetime import datetime

Expand Down
6 changes: 3 additions & 3 deletions lib/m2ee/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ def _check_runtime_config(self):
# searching
if not self._conf.get("mxnode", {}).get("mxjar_repo", None):
self._conf["mxnode"]["mxjar_repo"] = []
elif not type(self._conf.get("mxnode", {})["mxjar_repo"]) == list:
elif not isinstance((self._conf.get("mxnode", {})["mxjar_repo"]), list):
self._conf["mxnode"]["mxjar_repo"] = [
self._conf["mxnode"]["mxjar_repo"]
]
Expand Down Expand Up @@ -512,7 +512,7 @@ def get_java_env(self):
env = os.environ.copy()
elif preserve_environment is False:
pass
elif type(preserve_environment) == list:
elif isinstance(preserve_environment, list):
for varname in preserve_environment:
if varname in os.environ:
env[varname] = os.environ[varname]
Expand All @@ -526,7 +526,7 @@ def get_java_env(self):

custom_environment = self._conf["m2ee"].get("custom_environment", {})
if custom_environment is not None:
if type(custom_environment) == dict:
if isinstance(custom_environment, dict):
env.update(custom_environment)
else:
logger.warn(
Expand Down
4 changes: 2 additions & 2 deletions lib/m2ee/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def start_appcontainer(self):
),
"port": self.config.get_runtime_port(),
"application_base_path": self.config.get_app_base(),
"use_blocking_connector": self.config.get_runtime_blocking_connector(), # noqa: line-too-long
"use_blocking_connector": self.config.get_runtime_blocking_connector(), # noqa: C0301
}
)
response.display_error()
Expand All @@ -134,7 +134,7 @@ def start_appcontainer(self):
response = self.client.update_appcontainer_configuration(
{
"runtime_port": self.config.get_runtime_port(),
"runtime_listen_addresses": self.config.get_runtime_listen_addresses(), # noqa: line-too-long
"runtime_listen_addresses": self.config.get_runtime_listen_addresses(), # noqa: C0301
"runtime_jetty_options": self.config.get_jetty_options(),
}
)
Expand Down

0 comments on commit 55ce9e4

Please sign in to comment.