patroni.tags module¶
Tags handling.
Bases:
abc.ABC
An abstract class that encapsulates all the
tags
logic.Child classes that want to use provided facilities must implement
tags
abstract property.Get tags configured for this node, if any.
Handle both predefined Patroni tags and custom defined tags.
Note
A custom tag is any tag added to the configuration
tags
section that is not one ofclonefrom
,nofailover
,noloadbalance
ornosync
.For most of the Patroni predefined tags, the returning object will only contain them if they are enabled as they all are boolean values that default to disabled. However
nofailover
tag is always returned iffailover_priority
tag is defined. In this case, we need both values to see if they are contradictory and thenofailover
value should be used.- Returns
a dictionary of tags set for this node. The key is the tag name, and the value is the corresponding tag value.
True
ifclonefrom
tag isTrue
, elseFalse
.
Common logic for obtaining the value of
failover_priority
fromtags
if defined.If
nofailover
is defined asTrue
, this will return0
. Otherwise, it will return the value offailover_priority
, defaulting to1
if it’s not defined or invalid.
Common logic for obtaining the value of
nofailover
fromtags
if defined.If
nofailover
is not defined, this methods returnsTrue
iffailover_priority
is non-positive,False
otherwise.
True
ifnoloadbalance
isTrue
, elseFalse
.
True
ifnosync
isTrue
, elseFalse
.
Value of
replicatefrom
tag, if any.
Configured tags.
Must be implemented in a child class.