-my $ceph_check_keyfile = sub {
- my ($filename, $scfg) = @_;
-
- if (-f $filename) {
- my $content = PVE::Tools::file_get_contents($filename);
- my @lines = split /\n/, $content;
-
- my $section;
-
- foreach my $line (@lines) {
- next if !$line;
-
- $section = $1 if $line =~ m/^\[(\S+)\]$/;
-
- if ($scfg->{type} eq 'rbd') {
- if ((!$section) && (!$section =~ m/^$/)) {
- warn "Not a proper $scfg->{type} authentication file: $filename\n";
- }
- } elsif ($scfg->{type} eq 'cephfs') {
- if ($section || ($line =~ s/^\s+//)) {
- warn "Not a proper $scfg->{type} authentication file: $filename\n";
- }
- }
- }
- }
-
- return undef;
-};
-