Merge branch 'deprecations' into 'develop'

Deprecations

See merge request pleroma/pleroma!4011
This commit is contained in:
feld 2023-12-20 21:13:35 +00:00
commit cbdd134174
33 changed files with 74 additions and 56 deletions

View file

@ -0,0 +1 @@

View file

@ -138,7 +138,7 @@ defmodule Pleroma.Application do
num num
else else
e -> e ->
Logger.warn( Logger.warning(
"Could not get the postgres version: #{inspect(e)}.\nSetting the default value of 9.6" "Could not get the postgres version: #{inspect(e)}.\nSetting the default value of 9.6"
) )

View file

@ -34,7 +34,7 @@ defmodule Pleroma.ApplicationRequirements do
defp check_welcome_message_config!(:ok) do defp check_welcome_message_config!(:ok) do
if Pleroma.Config.get([:welcome, :email, :enabled], false) and if Pleroma.Config.get([:welcome, :email, :enabled], false) and
not Pleroma.Emails.Mailer.enabled?() do not Pleroma.Emails.Mailer.enabled?() do
Logger.warn(""" Logger.warning("""
To send welcome emails, you need to enable the mailer. To send welcome emails, you need to enable the mailer.
Welcome emails will NOT be sent with the current config. Welcome emails will NOT be sent with the current config.
@ -53,7 +53,7 @@ defmodule Pleroma.ApplicationRequirements do
def check_confirmation_accounts!(:ok) do def check_confirmation_accounts!(:ok) do
if Pleroma.Config.get([:instance, :account_activation_required]) && if Pleroma.Config.get([:instance, :account_activation_required]) &&
not Pleroma.Emails.Mailer.enabled?() do not Pleroma.Emails.Mailer.enabled?() do
Logger.warn(""" Logger.warning("""
Account activation is required, but the mailer is disabled. Account activation is required, but the mailer is disabled.
Users will NOT be able to confirm their accounts with this config. Users will NOT be able to confirm their accounts with this config.
Either disable account activation or enable the mailer. Either disable account activation or enable the mailer.

View file

@ -24,7 +24,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
filters = Config.get([Pleroma.Upload]) |> Keyword.get(:filters, []) filters = Config.get([Pleroma.Upload]) |> Keyword.get(:filters, [])
if Pleroma.Upload.Filter.Exiftool in filters do if Pleroma.Upload.Filter.Exiftool in filters do
Logger.warn(""" Logger.warning("""
!!!DEPRECATION WARNING!!! !!!DEPRECATION WARNING!!!
Your config is using Exiftool as a filter instead of Exiftool.StripLocation. This should work for now, but you are advised to change to the new configuration to prevent possible issues later: Your config is using Exiftool as a filter instead of Exiftool.StripLocation. This should work for now, but you are advised to change to the new configuration to prevent possible issues later:
@ -63,7 +63,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
|> Enum.any?(fn {_, v} -> Enum.any?(v, &is_binary/1) end) |> Enum.any?(fn {_, v} -> Enum.any?(v, &is_binary/1) end)
if has_strings do if has_strings do
Logger.warn(""" Logger.warning("""
!!!DEPRECATION WARNING!!! !!!DEPRECATION WARNING!!!
Your config is using strings in the SimplePolicy configuration instead of tuples. They should work for now, but you are advised to change to the new configuration to prevent possible issues later: Your config is using strings in the SimplePolicy configuration instead of tuples. They should work for now, but you are advised to change to the new configuration to prevent possible issues later:
@ -121,7 +121,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
has_strings = Config.get([:instance, :quarantined_instances]) |> Enum.any?(&is_binary/1) has_strings = Config.get([:instance, :quarantined_instances]) |> Enum.any?(&is_binary/1)
if has_strings do if has_strings do
Logger.warn(""" Logger.warning("""
!!!DEPRECATION WARNING!!! !!!DEPRECATION WARNING!!!
Your config is using strings in the quarantined_instances configuration instead of tuples. They should work for now, but you are advised to change to the new configuration to prevent possible issues later: Your config is using strings in the quarantined_instances configuration instead of tuples. They should work for now, but you are advised to change to the new configuration to prevent possible issues later:
@ -158,7 +158,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
has_strings = Config.get([:mrf, :transparency_exclusions]) |> Enum.any?(&is_binary/1) has_strings = Config.get([:mrf, :transparency_exclusions]) |> Enum.any?(&is_binary/1)
if has_strings do if has_strings do
Logger.warn(""" Logger.warning("""
!!!DEPRECATION WARNING!!! !!!DEPRECATION WARNING!!!
Your config is using strings in the transparency_exclusions configuration instead of tuples. They should work for now, but you are advised to change to the new configuration to prevent possible issues later: Your config is using strings in the transparency_exclusions configuration instead of tuples. They should work for now, but you are advised to change to the new configuration to prevent possible issues later:
@ -193,7 +193,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
def check_hellthread_threshold do def check_hellthread_threshold do
if Config.get([:mrf_hellthread, :threshold]) do if Config.get([:mrf_hellthread, :threshold]) do
Logger.warn(""" Logger.warning("""
!!!DEPRECATION WARNING!!! !!!DEPRECATION WARNING!!!
You are using the old configuration mechanism for the hellthread filter. Please check config.md. You are using the old configuration mechanism for the hellthread filter. Please check config.md.
""") """)
@ -274,7 +274,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
if warning == "" do if warning == "" do
:ok :ok
else else
Logger.warn(warning_preface <> warning) Logger.warning(warning_preface <> warning)
:error :error
end end
end end
@ -284,7 +284,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
whitelist = Config.get([:media_proxy, :whitelist]) whitelist = Config.get([:media_proxy, :whitelist])
if Enum.any?(whitelist, &(not String.starts_with?(&1, "http"))) do if Enum.any?(whitelist, &(not String.starts_with?(&1, "http"))) do
Logger.warn(""" Logger.warning("""
!!!DEPRECATION WARNING!!! !!!DEPRECATION WARNING!!!
Your config is using old format (only domain) for MediaProxy whitelist option. Setting should work for now, but you are advised to change format to scheme with port to prevent possible issues later. Your config is using old format (only domain) for MediaProxy whitelist option. Setting should work for now, but you are advised to change format to scheme with port to prevent possible issues later.
""") """)
@ -299,7 +299,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
pool_config = Config.get(:connections_pool) pool_config = Config.get(:connections_pool)
if timeout = pool_config[:await_up_timeout] do if timeout = pool_config[:await_up_timeout] do
Logger.warn(""" Logger.warning("""
!!!DEPRECATION WARNING!!! !!!DEPRECATION WARNING!!!
Your config is using old setting `config :pleroma, :connections_pool, await_up_timeout`. Please change to `config :pleroma, :connections_pool, connect_timeout` to ensure compatibility with future releases. Your config is using old setting `config :pleroma, :connections_pool, await_up_timeout`. Please change to `config :pleroma, :connections_pool, connect_timeout` to ensure compatibility with future releases.
""") """)
@ -331,7 +331,7 @@ defmodule Pleroma.Config.DeprecationWarnings do
"\n* `:timeout` options in #{pool_name} pool is now `:recv_timeout`" "\n* `:timeout` options in #{pool_name} pool is now `:recv_timeout`"
end) end)
Logger.warn(Enum.join([warning_preface | pool_warnings])) Logger.warning(Enum.join([warning_preface | pool_warnings]))
Config.put(:pools, updated_config) Config.put(:pools, updated_config)
:error :error

View file

@ -23,7 +23,7 @@ defmodule Pleroma.Config.Oban do
You are using old workers in Oban crontab settings, which were removed. You are using old workers in Oban crontab settings, which were removed.
Please, remove setting from crontab in your config file (prod.secret.exs): #{inspect(setting)} Please, remove setting from crontab in your config file (prod.secret.exs): #{inspect(setting)}
""" """
|> Logger.warn() |> Logger.warning()
List.delete(acc, setting) List.delete(acc, setting)
else else

View file

@ -144,7 +144,7 @@ defmodule Pleroma.Config.TransferTask do
error_msg = error_msg =
"updating env causes error, group: #{inspect(group)}, key: #{inspect(key)}, value: #{inspect(value)} error: #{inspect(error)}" "updating env causes error, group: #{inspect(group)}, key: #{inspect(key)}, value: #{inspect(value)} error: #{inspect(error)}"
Logger.warn(error_msg) Logger.warning(error_msg)
nil nil
end end
@ -178,12 +178,12 @@ defmodule Pleroma.Config.TransferTask do
:ok = Application.start(app) :ok = Application.start(app)
else else
nil -> nil ->
Logger.warn("#{app} is not started.") Logger.warning("#{app} is not started.")
error -> error ->
error error
|> inspect() |> inspect()
|> Logger.warn() |> Logger.warning()
end end
end end

View file

@ -59,7 +59,7 @@ defmodule Pleroma.Emoji.Loader do
Logger.info("Found emoji packs: #{Enum.join(packs, ", ")}") Logger.info("Found emoji packs: #{Enum.join(packs, ", ")}")
if not Enum.empty?(files) do if not Enum.empty?(files) do
Logger.warn( Logger.warning(
"Found files in the emoji folder. These will be ignored, please move them to a subdirectory\nFound files: #{Enum.join(files, ", ")}" "Found files in the emoji folder. These will be ignored, please move them to a subdirectory\nFound files: #{Enum.join(files, ", ")}"
) )
end end

View file

@ -56,7 +56,7 @@ defmodule Pleroma.Gun.Conn do
{:ok, conn, protocol} {:ok, conn, protocol}
else else
error -> error ->
Logger.warn( Logger.warning(
"Opening proxied connection to #{compose_uri_log(uri)} failed with error #{inspect(error)}" "Opening proxied connection to #{compose_uri_log(uri)} failed with error #{inspect(error)}"
) )
@ -90,7 +90,7 @@ defmodule Pleroma.Gun.Conn do
{:ok, conn, protocol} {:ok, conn, protocol}
else else
error -> error ->
Logger.warn( Logger.warning(
"Opening socks proxied connection to #{compose_uri_log(uri)} failed with error #{inspect(error)}" "Opening socks proxied connection to #{compose_uri_log(uri)} failed with error #{inspect(error)}"
) )
@ -106,7 +106,7 @@ defmodule Pleroma.Gun.Conn do
{:ok, conn, protocol} {:ok, conn, protocol}
else else
error -> error ->
Logger.warn( Logger.warning(
"Opening connection to #{compose_uri_log(uri)} failed with error #{inspect(error)}" "Opening connection to #{compose_uri_log(uri)} failed with error #{inspect(error)}"
) )

View file

@ -70,15 +70,15 @@ defmodule Pleroma.HTTP.AdapterHelper do
{:ok, parse_host(host), port} {:ok, parse_host(host), port}
else else
{_, _} -> {_, _} ->
Logger.warn("Parsing port failed #{inspect(proxy)}") Logger.warning("Parsing port failed #{inspect(proxy)}")
{:error, :invalid_proxy_port} {:error, :invalid_proxy_port}
:error -> :error ->
Logger.warn("Parsing port failed #{inspect(proxy)}") Logger.warning("Parsing port failed #{inspect(proxy)}")
{:error, :invalid_proxy_port} {:error, :invalid_proxy_port}
_ -> _ ->
Logger.warn("Parsing proxy failed #{inspect(proxy)}") Logger.warning("Parsing proxy failed #{inspect(proxy)}")
{:error, :invalid_proxy} {:error, :invalid_proxy}
end end
end end
@ -88,7 +88,7 @@ defmodule Pleroma.HTTP.AdapterHelper do
{:ok, type, parse_host(host), port} {:ok, type, parse_host(host), port}
else else
_ -> _ ->
Logger.warn("Parsing proxy failed #{inspect(proxy)}") Logger.warning("Parsing proxy failed #{inspect(proxy)}")
{:error, :invalid_proxy} {:error, :invalid_proxy}
end end
end end

View file

@ -173,7 +173,7 @@ defmodule Pleroma.Instances.Instance do
end end
rescue rescue
e -> e ->
Logger.warn("Instance.get_or_update_favicon(\"#{host}\") error: #{inspect(e)}") Logger.warning("Instance.get_or_update_favicon(\"#{host}\") error: #{inspect(e)}")
nil nil
end end
@ -201,7 +201,7 @@ defmodule Pleroma.Instances.Instance do
end end
rescue rescue
e -> e ->
Logger.warn( Logger.warning(
"Instance.scrape_favicon(\"#{to_string(instance_uri)}\") error: #{inspect(e)}" "Instance.scrape_favicon(\"#{to_string(instance_uri)}\") error: #{inspect(e)}"
) )
@ -284,7 +284,7 @@ defmodule Pleroma.Instances.Instance do
end end
rescue rescue
e -> e ->
Logger.warn( Logger.warning(
"Instance.scrape_metadata(\"#{to_string(instance_uri)}\") error: #{inspect(e)}" "Instance.scrape_metadata(\"#{to_string(instance_uri)}\") error: #{inspect(e)}"
) )

View file

@ -20,7 +20,7 @@ defmodule Pleroma.Maintenance do
"full" -> "full" ->
Logger.info("Running VACUUM FULL.") Logger.info("Running VACUUM FULL.")
Logger.warn( Logger.warning(
"Re-packing your entire database may take a while and will consume extra disk space during the process." "Re-packing your entire database may take a while and will consume extra disk space during the process."
) )

View file

@ -73,7 +73,7 @@ defmodule Pleroma.Migrators.Support.BaseMigrator do
data_migration.state == :manual or data_migration.name in manual_migrations -> data_migration.state == :manual or data_migration.name in manual_migrations ->
message = "Data migration is in manual execution or manual fix mode." message = "Data migration is in manual execution or manual fix mode."
update_status(:manual, message) update_status(:manual, message)
Logger.warn("#{__MODULE__}: #{message}") Logger.warning("#{__MODULE__}: #{message}")
data_migration.state == :complete -> data_migration.state == :complete ->
on_complete(data_migration) on_complete(data_migration)
@ -109,7 +109,7 @@ defmodule Pleroma.Migrators.Support.BaseMigrator do
Putting data migration to manual fix mode. Try running `#{__MODULE__}.retry_failed/0`. Putting data migration to manual fix mode. Try running `#{__MODULE__}.retry_failed/0`.
""" """
Logger.warn("#{__MODULE__}: #{message}") Logger.warning("#{__MODULE__}: #{message}")
update_status(:manual, message) update_status(:manual, message)
on_complete(data_migration()) on_complete(data_migration())
@ -125,7 +125,7 @@ defmodule Pleroma.Migrators.Support.BaseMigrator do
defp on_complete(data_migration) do defp on_complete(data_migration) do
if data_migration.feature_lock || feature_state() == :disabled do if data_migration.feature_lock || feature_state() == :disabled do
Logger.warn( Logger.warning(
"#{__MODULE__}: migration complete but feature is locked; consider enabling." "#{__MODULE__}: migration complete but feature is locked; consider enabling."
) )

View file

@ -192,7 +192,7 @@ defmodule Pleroma.ReverseProxy do
halt(conn) halt(conn)
{:error, error, conn} -> {:error, error, conn} ->
Logger.warn( Logger.warning(
"#{__MODULE__} request to #{url} failed while reading/chunking: #{inspect(error)}" "#{__MODULE__} request to #{url} failed while reading/chunking: #{inspect(error)}"
) )

View file

@ -70,7 +70,7 @@ defmodule Pleroma.Telemetry.Logger do
%{key: key}, %{key: key},
_ _
) do ) do
Logger.warn(fn -> Logger.warning(fn ->
"Pool worker for #{key}: Client #{inspect(client_pid)} died before releasing the connection with #{inspect(reason)}" "Pool worker for #{key}: Client #{inspect(client_pid)} died before releasing the connection with #{inspect(reason)}"
end) end)
end end

View file

@ -29,7 +29,7 @@ defmodule Pleroma.Upload.Filter.AnalyzeMetadata do
{:ok, :filtered, upload} {:ok, :filtered, upload}
rescue rescue
e in ErlangError -> e in ErlangError ->
Logger.warn("#{__MODULE__}: #{inspect(e)}") Logger.warning("#{__MODULE__}: #{inspect(e)}")
{:ok, :noop} {:ok, :noop}
end end
end end
@ -46,7 +46,7 @@ defmodule Pleroma.Upload.Filter.AnalyzeMetadata do
{:ok, :filtered, upload} {:ok, :filtered, upload}
rescue rescue
e in ErlangError -> e in ErlangError ->
Logger.warn("#{__MODULE__}: #{inspect(e)}") Logger.warning("#{__MODULE__}: #{inspect(e)}")
{:ok, :noop} {:ok, :noop}
end end
end end

View file

@ -1560,7 +1560,7 @@ defmodule Pleroma.User do
unmute(muter, mutee) unmute(muter, mutee)
else else
{who, result} = error -> {who, result} = error ->
Logger.warn( Logger.warning(
"User.unmute/2 failed. #{who}: #{result}, muter_id: #{muter_id}, mutee_id: #{mutee_id}" "User.unmute/2 failed. #{who}: #{result}, muter_id: #{muter_id}, mutee_id: #{mutee_id}"
) )

View file

@ -293,7 +293,7 @@ defmodule Pleroma.User.Backup do
acc + 1 acc + 1
else else
{:error, e} -> {:error, e} ->
Logger.warn( Logger.warning(
"Error processing backup item: #{inspect(e)}\n The item is: #{inspect(i)}" "Error processing backup item: #{inspect(e)}\n The item is: #{inspect(i)}"
) )

View file

@ -475,7 +475,7 @@ defmodule Pleroma.Web.ActivityPub.ActivityPubController do
|> json(message) |> json(message)
e -> e ->
Logger.warn(fn -> "AP C2S: #{inspect(e)}" end) Logger.warning(fn -> "AP C2S: #{inspect(e)}" end)
conn conn
|> put_status(:bad_request) |> put_status(:bad_request)

View file

@ -203,7 +203,7 @@ defmodule Pleroma.Web.ActivityPub.MRF do
if Enum.all?(@required_description_keys, &Map.has_key?(description, &1)) do if Enum.all?(@required_description_keys, &Map.has_key?(description, &1)) do
[description | acc] [description | acc]
else else
Logger.warn( Logger.warning(
"#{policy} config description doesn't have one or all required keys #{inspect(@required_description_keys)}" "#{policy} config description doesn't have one or all required keys #{inspect(@required_description_keys)}"
) )

View file

@ -19,7 +19,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.FollowBotPolicy do
try_follow(follower, message) try_follow(follower, message)
else else
nil -> nil ->
Logger.warn( Logger.warning(
"#{__MODULE__} skipped because of missing `:mrf_follow_bot, :follower_nickname` configuration, the :follower_nickname "#{__MODULE__} skipped because of missing `:mrf_follow_bot, :follower_nickname` configuration, the :follower_nickname
account does not exist, or the account is not correctly configured as a bot." account does not exist, or the account is not correctly configured as a bot."
) )

View file

@ -41,7 +41,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy do
shortcode shortcode
e -> e ->
Logger.warn("MRF.StealEmojiPolicy: Failed to write to #{file_path}: #{inspect(e)}") Logger.warning("MRF.StealEmojiPolicy: Failed to write to #{file_path}: #{inspect(e)}")
nil nil
end end
else else
@ -53,7 +53,7 @@ defmodule Pleroma.Web.ActivityPub.MRF.StealEmojiPolicy do
end end
else else
e -> e ->
Logger.warn("MRF.StealEmojiPolicy: Failed to fetch #{url}: #{inspect(e)}") Logger.warning("MRF.StealEmojiPolicy: Failed to fetch #{url}: #{inspect(e)}")
nil nil
end end
end end

View file

@ -156,7 +156,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
|> Map.drop(["conversation", "inReplyToAtomUri"]) |> Map.drop(["conversation", "inReplyToAtomUri"])
else else
e -> e ->
Logger.warn("Couldn't fetch #{inspect(in_reply_to_id)}, error: #{inspect(e)}") Logger.warning("Couldn't fetch #{inspect(in_reply_to_id)}, error: #{inspect(e)}")
object object
end end
else else
@ -182,7 +182,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier do
object object
e -> e ->
Logger.warn("Couldn't fetch #{inspect(quote_url)}, error: #{inspect(e)}") Logger.warning("Couldn't fetch #{inspect(quote_url)}, error: #{inspect(e)}")
object object
end end
end end

View file

@ -550,7 +550,7 @@ defmodule Pleroma.Web.CommonAPI do
remove_mute(user, activity) remove_mute(user, activity)
else else
{what, result} = error -> {what, result} = error ->
Logger.warn( Logger.warning(
"CommonAPI.remove_mute/2 failed. #{what}: #{result}, user_id: #{user_id}, activity_id: #{activity_id}" "CommonAPI.remove_mute/2 failed. #{what}: #{result}, user_id: #{user_id}, activity_id: #{activity_id}"
) )

View file

@ -321,13 +321,13 @@ defmodule Pleroma.Web.CommonAPI.Utils do
format_asctime(date) format_asctime(date)
else else
_e -> _e ->
Logger.warn("Date #{date} in wrong format, must be ISO 8601") Logger.warning("Date #{date} in wrong format, must be ISO 8601")
"" ""
end end
end end
def date_to_asctime(date) do def date_to_asctime(date) do
Logger.warn("Date #{date} in wrong format, must be ISO 8601") Logger.warning("Date #{date} in wrong format, must be ISO 8601")
"" ""
end end

View file

@ -201,7 +201,7 @@ defmodule Pleroma.Web.Plugs.HTTPSecurityPlug do
def warn_if_disabled do def warn_if_disabled do
unless Config.get([:http_security, :enabled]) do unless Config.get([:http_security, :enabled]) do
Logger.warn(" Logger.warning("
.i;;;;i. .i;;;;i.
iYcviii;vXY: iYcviii;vXY:
.YXi .i1c. .YXi .i1c.

View file

@ -89,7 +89,7 @@ defmodule Pleroma.Web.Plugs.RateLimiter do
end end
defp handle_disabled(conn) do defp handle_disabled(conn) do
Logger.warn( Logger.warning(
"Rate limiter disabled due to forwarded IP not being found. Please ensure your reverse proxy is providing the X-Forwarded-For header or disable the RemoteIP plug/rate limiter." "Rate limiter disabled due to forwarded IP not being found. Please ensure your reverse proxy is providing the X-Forwarded-For header or disable the RemoteIP plug/rate limiter."
) )

View file

@ -9,7 +9,7 @@ defmodule Pleroma.Web.Push do
def init do def init do
unless enabled() do unless enabled() do
Logger.warn(""" Logger.warning("""
VAPID key pair is not found. If you wish to enabled web push, please run VAPID key pair is not found. If you wish to enabled web push, please run
mix web_push.gen.keypair mix web_push.gen.keypair

View file

@ -57,7 +57,7 @@ defmodule Pleroma.Web.Push.Impl do
end end
def perform(_) do def perform(_) do
Logger.warn("Unknown notification type") Logger.warning("Unknown notification type")
{:error, :unknown_type} {:error, :unknown_type}
end end

View file

@ -75,7 +75,7 @@ defmodule Pleroma.Web.RichMedia.Parser do
end end
defp log_error(url, reason) do defp log_error(url, reason) do
Logger.warn(fn -> "Rich media error for #{url}: #{inspect(reason)}" end) Logger.warning(fn -> "Rich media error for #{url}: #{inspect(reason)}" end)
end end
end end

View file

@ -163,7 +163,7 @@ defmodule Pleroma.Web.WebFinger do
get_template_from_xml(body) get_template_from_xml(body)
else else
error -> error ->
Logger.warn("Can't find LRDD template in #{inspect(meta_url)}: #{inspect(error)}") Logger.warning("Can't find LRDD template in #{inspect(meta_url)}: #{inspect(error)}")
{:error, :lrdd_not_found} {:error, :lrdd_not_found}
end end
end end

View file

@ -127,7 +127,10 @@ defmodule Pleroma.Cluster do
defp start_slave({node_host, override_configs}) do defp start_slave({node_host, override_configs}) do
log(node_host, "booting federated VM") log(node_host, "booting federated VM")
{:ok, node} = :slave.start(~c"127.0.0.1", node_name(node_host), vm_args())
{:ok, node} =
do_start_slave(%{host: "127.0.0.1", name: node_name(node_host), args: vm_args()})
add_code_paths(node) add_code_paths(node)
load_apps_and_transfer_configuration(node, override_configs) load_apps_and_transfer_configuration(node, override_configs)
ensure_apps_started(node) ensure_apps_started(node)
@ -219,4 +222,18 @@ defmodule Pleroma.Cluster do
|> Enum.at(0) |> Enum.at(0)
|> String.to_atom() |> String.to_atom()
end end
if System.otp_release() >= "25" do
@peer :peer
else
@peer :slave
end
defp do_start_slave(%{host: host, name: name, args: args} = opts) do
if System.otp_release() >= "25" do
@peer.start(opts)
else
@peer.start(host, name, args)
end
end
end end

View file

@ -41,7 +41,7 @@ defmodule Pleroma.Tests.Helpers do
# NOTE: `clear_config([section, key], value)` != `clear_config([section], key: value)` (!) # NOTE: `clear_config([section, key], value)` != `clear_config([section], key: value)` (!)
# Displaying a warning to prevent unintentional clearing of all but one keys in section # Displaying a warning to prevent unintentional clearing of all but one keys in section
if Keyword.keyword?(temp_setting) and length(temp_setting) == 1 do if Keyword.keyword?(temp_setting) and length(temp_setting) == 1 do
Logger.warn( Logger.warning(
"Please change `clear_config([section], key: value)` to `clear_config([section, key], value)`" "Please change `clear_config([section], key: value)` to `clear_config([section, key], value)`"
) )
end end

View file

@ -21,7 +21,7 @@ defmodule HttpRequestMock do
else else
error -> error ->
with {:error, message} <- error do with {:error, message} <- error do
Logger.warn(to_string(message)) Logger.warning(to_string(message))
end end
{_, _r} = error {_, _r} = error