Skip to content

Commit

Permalink
Fix DeprecationWarning: The 'warn' method is deprecated, use 'warning…
Browse files Browse the repository at this point in the history
…' instead
  • Loading branch information
nzlosh committed Mar 12, 2024
1 parent a1d35a7 commit ca7db1d
Show file tree
Hide file tree
Showing 9 changed files with 16 additions and 16 deletions.
2 changes: 1 addition & 1 deletion st2actions/st2actions/policies/concurrency_by_attr.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def apply_before(self, target):

# Warn users that the coordination service is not configured.
if not coordination.configured():
LOG.warn(
LOG.warning(
"Coordination service is not configured. Policy enforcement is best effort."
)

Expand Down
2 changes: 1 addition & 1 deletion st2actions/st2actions/scheduler/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def _handle_execution(self, execution_queue_item_db):
if action_has_policies_require_lock:
# Warn users that the coordination service is not configured.
if not coordination_service.configured():
LOG.warn(
LOG.warning(
"[%s] Coordination backend is not configured. "
"Policy enforcement is best effort.",
action_execution_id,
Expand Down
4 changes: 2 additions & 2 deletions st2api/st2api/controllers/v1/triggers.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def _create_shadow_trigger(triggertype_db):
# Not aborting as this is convenience.
return
except StackStormDBObjectConflictError as e:
LOG.warn(
LOG.warning(
'Trigger creation of "%s" failed with uniqueness conflict. Exception: %s',
trigger,
six.text_type(e),
Expand All @@ -221,7 +221,7 @@ def _delete_shadow_trigger(triggertype_db):
)
trigger_db = TriggerService.get_trigger_db_by_ref(triggertype_ref.ref)
if not trigger_db:
LOG.warn(
LOG.warning(
"No shadow trigger found for %s. Will skip delete.", triggertype_db
)
return
Expand Down
12 changes: 6 additions & 6 deletions st2client/st2client/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ def get_client(self, args, debug=False):
cache_token=cache_token,
)
except requests.exceptions.ConnectionError as e:
self.LOG.warn(
self.LOG.warning(
"Auth API server is not available, skipping authentication."
)
self.LOG.exception(e)
Expand Down Expand Up @@ -280,7 +280,7 @@ def _get_cached_auth_token(self, client, username, password):
"cached token meaning they may be slower."
% (cached_token_path, os.getlogin())
)
self.LOG.warn(message)
self.LOG.warning(message)
return None

if not os.path.isfile(cached_token_path):
Expand All @@ -293,7 +293,7 @@ def _get_cached_auth_token(self, client, username, password):
"access to this file). Subsequent requests won't use a cached token "
"meaning they may be slower." % (cached_token_path, os.getlogin())
)
self.LOG.warn(message)
self.LOG.warning(message)
return None

# Safety check for too permissive permissions
Expand All @@ -307,7 +307,7 @@ def _get_cached_auth_token(self, client, username, password):
"restrict the permissions and make sure only your own user can read "
"from or write to the file." % (file_st_mode, cached_token_path)
)
self.LOG.warn(message)
self.LOG.warning(message)

with open(cached_token_path) as fp:
data = fp.read()
Expand Down Expand Up @@ -359,7 +359,7 @@ def _cache_auth_token(self, token_obj):
"cached token meaning they may be slower."
% (cached_token_path, os.getlogin())
)
self.LOG.warn(message)
self.LOG.warning(message)
return None

if os.path.isfile(cached_token_path) and not os.access(
Expand All @@ -372,7 +372,7 @@ def _cache_auth_token(self, token_obj):
"cached token meaning they may be slower."
% (cached_token_path, os.getlogin())
)
self.LOG.warn(message)
self.LOG.warning(message)
return None

token = token_obj.token
Expand Down
4 changes: 2 additions & 2 deletions st2client/st2client/config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def parse(self):
if self.validate_config_permissions:
# Make sure the directory permissions == 0o770
if bool(os.stat(config_dir_path).st_mode & 0o7):
self.LOG.warn(
self.LOG.warning(
"The StackStorm configuration directory permissions are "
"insecure (too permissive): others have access."
)
Expand All @@ -130,7 +130,7 @@ def parse(self):

# Make sure the file permissions == 0o660
if bool(os.stat(self.config_file_path).st_mode & 0o7):
self.LOG.warn(
self.LOG.warning(
"The StackStorm configuration file permissions are "
"insecure: others have access."
)
Expand Down
2 changes: 1 addition & 1 deletion st2common/st2common/logging/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def reopen_log_files(handlers):
if "cannot release" in six.text_type(e):
# Release failed which most likely indicates that acquire failed
# and lock was never acquired
LOG.warn("Failed to release lock", exc_info=True)
LOG.warning("Failed to release lock", exc_info=True)
else:
raise e

Expand Down
2 changes: 1 addition & 1 deletion st2common/st2common/persistence/db_init.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def _retry_if_connection_error(error):
# start of error msg.
is_connection_error = isinstance(error, mongoengine.connection.ConnectionFailure)
if is_connection_error:
LOG.warn("Retry on ConnectionError - %s", error)
LOG.warning("Retry on ConnectionError - %s", error)
return is_connection_error


Expand Down
2 changes: 1 addition & 1 deletion st2common/st2common/services/coordination.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ def get_coordinator(start_heart=True, use_cache=True):
global COORDINATOR

if not configured():
LOG.warn(
LOG.warning(
"Coordination backend is not configured. Code paths which use coordination "
"service will use best effort approach and race conditions are possible."
)
Expand Down
2 changes: 1 addition & 1 deletion st2common/st2common/util/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def get_base_public_api_url():
if cfg.CONF.auth.api_url:
api_url = get_url_without_trailing_slash(cfg.CONF.auth.api_url)
else:
LOG.warn('"auth.api_url" configuration option is not configured')
LOG.warning('"auth.api_url" configuration option is not configured')
api_url = "http://%s:%s" % (cfg.CONF.api.host, cfg.CONF.api.port)

return api_url
Expand Down

0 comments on commit ca7db1d

Please sign in to comment.