Config-Model-Systemd
view release on metacpan or search on metacpan
contrib/parse-man.pl view on Meta::CPAN
if ($supersedes) {
push @load_extra, "status=deprecated";
push @log, "deprecated in favor of $supersedes";
# put migration in place for the other element
my $new = $meta_root->grab(
step => "class:$config_class element:$supersedes",
autoadd => 1
);
$new->load(steps => qq!migrate_from variables:old="- $element" formula="\$old"!);
}
$obj->load(step => [@load, @load_extra]);
say "class $config_class element $element:\n\t".join("\n\t", @log) if @log;
return $obj;
}
sub extract_choices($choices) {
my @choices = ($choices =~ m!C<([/\w\-+]+)>!g );
if ($choices =~ m{possibly prefixed with (?:a )?C<([!\w]+)>} ) {
contrib/parse-man.pl view on Meta::CPAN
'accept:".*" type=leaf value_type=uniline warn="$unknown_param_msg"'
]);
}
# inject the migration instruction that retrieve $from element setting
# from Service class (where it's deprecated) and copy them to the new
# $from element in Unit class in a service file (hence this migration
# instruction is done only in ServiceUnit class)
$meta_root->load( steps => [
qq!class:Systemd::Section::ServiceUnit element:$to!,
qq!migrate_from variables:service="- - Service $from" formula="\$service"!
]);
}
my $data = parse_xml([@list, @service_list], \%map) ;
# Itself constructor returns an object to read or write the data
# structure containing the model to be edited
my $rw_obj = Config::Model::Itself -> new () ;
# now load the existing model to be edited
contrib/parse-man.pl view on Meta::CPAN
'class:Systemd::Section::Unit',
qq!element:StartLimitInterval type=leaf value_type=uniline status=deprecated!,
qq!warn="StartLimitInterval is now StartLimitIntervalSec."!
]);
# handle migration from both service and unit
$meta_root->load( steps => [
qq!class:Systemd::Section::ServiceUnit element:StartLimitIntervalSec!,
qq!migrate_from variables:unit="- StartLimitInterval"!,
# $service variable is defined in move_deprecated element function
q!use_eval=1 formula="$unit || $service"!
]);
# renamed element in Unit
say "Handling move of OnFailureIsolate to OnFailureJobMode in unit";
$meta_root->load( steps => [
'class:Systemd::Section::Unit',
q!element:OnFailureIsolate type=leaf value_type=uniline status=deprecated!,
q!warn="OnFailureIsolate is now OnFailureJobMode." -!,
q!element:OnFailureJobMode!,
q!migrate_from variables:unit="- OnFailureIsolate"!,
q!formula="$unit"!
]);
say "Saving systemd model...";
$rw_obj->write_all;
say "Done.";
lib/Config/Model/models/Systemd/Section/Service.pl view on Meta::CPAN
between 3 and 5 are good choices when exponential backoff is desired.
Example:
RestartSec=10s
RestartSteps=4
RestartMaxDelaySec=160s
This will produce the following restart intervals: 10s, 20s, 40s, 80s, 160s, 160s, 160s, etc.
Notice the geometric interpolation and the resulting constant ratio between intervals; here it is 2.
The formula for the ratio is
(C<RestartMaxDelaySec> / C<RestartSec>)^(1 / C<RestartSteps>)
. A (repeating) delay equal to C<RestartMaxDelaySec> is always
reached after
C<RestartSteps> + 1
steps.
This setting is effective only if C<RestartMaxDelaySec> is also set and
C<RestartSec> is not zero.',
'RootDirectoryStartOnly' => 'Takes a boolean argument. If true, the root directory, as configured with the
lib/Config/Model/models/Systemd/Section/Service.pod view on Meta::CPAN
between 3 and 5 are good choices when exponential backoff is desired.
Example:
RestartSec=10s
RestartSteps=4
RestartMaxDelaySec=160s
This will produce the following restart intervals: 10s, 20s, 40s, 80s, 160s, 160s, 160s, etc.
Notice the geometric interpolation and the resulting constant ratio between intervals; here it is 2.
The formula for the ratio is
(C<RestartMaxDelaySec> / C<RestartSec>)^(1 / C<RestartSteps>)
. A (repeating) delay equal to C<RestartMaxDelaySec> is always
reached after
C<RestartSteps> + 1
steps.
This setting is effective only if C<RestartMaxDelaySec> is also set and
C<RestartSec> is not zero. I< Optional. Type uniline. >
lib/Config/Model/models/Systemd/Section/ServiceUnit.pl view on Meta::CPAN
'poweroff',
'poweroff-force',
'poweroff-immediate',
'reboot',
'reboot-force',
'reboot-immediate',
'soft-reboot',
'soft-reboot-force'
],
'migrate_from' => {
'formula' => '$service',
'variables' => {
'service' => '- - Service FailureAction'
}
},
'type' => 'leaf',
'value_type' => 'enum'
},
'SuccessAction',
{
'choice' => [
lib/Config/Model/models/Systemd/Section/ServiceUnit.pl view on Meta::CPAN
'poweroff',
'poweroff-force',
'poweroff-immediate',
'reboot',
'reboot-force',
'reboot-immediate',
'soft-reboot',
'soft-reboot-force'
],
'migrate_from' => {
'formula' => '$service',
'variables' => {
'service' => '- - Service SuccessAction'
}
},
'type' => 'leaf',
'value_type' => 'enum'
},
'StartLimitBurst',
{
'migrate_from' => {
'formula' => '$service',
'variables' => {
'service' => '- - Service StartLimitBurst'
}
},
'type' => 'leaf',
'value_type' => 'uniline'
},
'StartLimitIntervalSec',
{
'migrate_from' => {
'formula' => '$unit || $service',
'use_eval' => '1',
'variables' => {
'service' => '- - Service StartLimitInterval',
'unit' => '- StartLimitInterval'
}
},
'type' => 'leaf',
'value_type' => 'uniline'
},
'RebootArgument',
{
'migrate_from' => {
'formula' => '$service',
'variables' => {
'service' => '- - Service RebootArgument'
}
},
'type' => 'leaf',
'value_type' => 'uniline'
}
],
'include' => [
'Systemd::Section::Unit'
lib/Config/Model/models/Systemd/Section/Unit.pl view on Meta::CPAN
'*OnFailure',
'RequiresMountsFor',
'*OnFailure',
'WantsMountsFor',
'*OnFailure',
'OnSuccessJobMode',
'*OnFailure',
'OnFailureJobMode',
{
'migrate_from' => {
'formula' => '$unit',
'variables' => {
'unit' => '- OnFailureIsolate'
}
},
'type' => 'leaf',
'value_type' => 'uniline'
},
'IgnoreOnIsolate',
{
'type' => 'leaf',
( run in 0.562 second using v1.01-cache-2.11-cpan-85f18b9d64f )