]>
git.proxmox.com Git - pve-manager.git/blob - PVE/Jobs/Plugin.pm
1 package PVE
::Jobs
::Plugin
;
6 use PVE
::Cluster
qw(cfs_register_file);
8 use base
qw(PVE::SectionConfig);
12 sub { __PACKAGE__-
>parse_config(@_); },
13 sub { __PACKAGE__-
>write_config(@_); }
18 type
=> { description
=> "Section type." },
20 description
=> "The ID of the job.",
22 format
=> 'pve-configid',
26 description
=> "Determines if the job is enabled.",
32 description
=> "Backup schedule. The format is a subset of `systemd` calendar events.",
33 type
=> 'string', format
=> 'pve-calendar-event',
39 description
=> "Description for the Job.",
45 description
=> "If true, the job will be run as soon as possible if it was missed".
46 " while the scheduler was not running.",
57 my ($class, $filename, $raw) = @_;
59 my $cfg = $class->SUPER::parse_config
($filename, $raw);
61 foreach my $id (sort keys %{$cfg->{ids
}}) {
62 my $data = $cfg->{ids
}->{$id};
65 $data->{enabled
} //= 1;
67 if (defined($data->{comment
})) {
68 $data->{comment
} = PVE
::Tools
::decode_text
($data->{comment
});
75 # call the plugin specific decode/encode code
77 my ($class, $type, $key, $value) = @_;
79 my $plugin = __PACKAGE__-
>lookup($type);
80 return $plugin->decode_value($type, $key, $value);
84 my ($class, $type, $key, $value) = @_;
86 my $plugin = __PACKAGE__-
>lookup($type);
87 return $plugin->encode_value($type, $key, $value);
91 my ($class, $filename, $cfg) = @_;
93 for my $job (values $cfg->{ids
}->%*) {
94 if (defined($job->{comment
})) {
95 $job->{comment
} = PVE
::Tools
::encode_text
($job->{comment
});
99 $class->SUPER::write_config
($filename, $cfg);
103 my ($class, $cfg) = @_;
104 # implement in subclass
105 die "not implemented";