change error handling, add attributs disable and disabledForIntervals

This commit is contained in:
Marko Oldenburg 2020-10-28 19:14:44 +01:00
parent c28ae2e245
commit 4cd8b0ecea
3 changed files with 34 additions and 10 deletions

View File

@ -34,7 +34,7 @@ package main;
use strict; use strict;
use warnings; use warnings;
use utf8; use utf8;
use Meta; use FHEM::Meta;
use FHEM::backupToStorage; use FHEM::backupToStorage;
@ -47,6 +47,7 @@ sub backupToStorage_Initialize {
$hash->{DefFn} = \&FHEM::backupToStorage::Define; $hash->{DefFn} = \&FHEM::backupToStorage::Define;
$hash->{NotifyFn} = \&FHEM::backupToStorage::Notify; $hash->{NotifyFn} = \&FHEM::backupToStorage::Notify;
$hash->{UndefFn} = \&FHEM::backupToStorage::Undef; $hash->{UndefFn} = \&FHEM::backupToStorage::Undef;
$hash->{AttrFn} = \&FHEM::backupToStorage::Attr;
$hash->{RenameFn} = \&FHEM::backupToStorage::Rename; $hash->{RenameFn} = \&FHEM::backupToStorage::Rename;
$hash->{DeleteFn} = \&FHEM::backupToStorage::Delete; $hash->{DeleteFn} = \&FHEM::backupToStorage::Delete;
$hash->{ShutdownFn} = \&FHEM::backupToStorage::Shutdown; $hash->{ShutdownFn} = \&FHEM::backupToStorage::Shutdown;
@ -178,7 +179,7 @@ sub backupToStorage_Initialize {
], ],
"release_status": "devepolment", "release_status": "devepolment",
"license": "GPL_2", "license": "GPL_2",
"version": "v1.1.0", "version": "v1.2.0",
"author": [ "author": [
"Marko Oldenburg <fhemsupport@cooltux.net>" "Marko Oldenburg <fhemsupport@cooltux.net>"
], ],

View File

@ -1,2 +1,2 @@
UPD 2020-10-24_10:07:46 6179 FHEM/98_backupToStorage.pm UPD 2020-10-28_19:14:19 6242 FHEM/98_backupToStorage.pm
UPD 2020-10-24_10:05:11 16831 lib/FHEM/backupToStorage.pm UPD 2020-10-28_19:13:53 17356 lib/FHEM/backupToStorage.pm

View File

@ -318,6 +318,19 @@ sub Set {
return; return;
} }
sub Attr {
my $cmd = shift;
my $name = shift;
my $attrName = shift;
my $attrVal = shift;
if ( $cmd eq 'set' ) {
}
}
sub Rename { sub Rename {
my $new = shift; my $new = shift;
my $old = shift; my $old = shift;
@ -438,11 +451,21 @@ sub FileUpload {
. ' , returnString: ' . ' , returnString: '
. $returnString . "\n" . $returnString . "\n"
if ( $subprocess->{loglevel} > 4 ); if ( $subprocess->{loglevel} > 4 );
$response->{ncUpload} = ( $returnCode == 72057594037927935
&& $returnString eq '' if ( $returnString =~ /100\s[0-9].*\s100\s[0-9].*/m
? 'upload successfully' and $returnString =~ /\s\s<o:hint xmlns:o="o:">(.*)<\/o:hint>/m ) {
: $returnString ); $response->{ncUpload} = $1;
}
elsif ( $returnString =~ /100\s[0-9].*\s100\s[0-9].*/m ) {
$response->{ncUpload} = 'upload successfully';
}
elsif ( $returnString =~ /(curl:\s.*)/ ){
$response->{ncUpload} = $1;
}
else {
$response->{ncUpload} = 'unknown error';
}
} }
my $json = eval { encode_json($response) }; my $json = eval { encode_json($response) };
@ -461,7 +484,7 @@ sub ExecuteNCupload {
my $subprocess = shift; my $subprocess = shift;
my $command = $subprocess->{curl}; my $command = $subprocess->{curl};
$command .= ' -s -u '; $command .= ' -u ';
$command .= $subprocess->{user} . ':' . $subprocess->{pass}; $command .= $subprocess->{user} . ':' . $subprocess->{pass};
$command .= ' -T ' . $subprocess->{backupfile}; $command .= ' -T ' . $subprocess->{backupfile};
$command .= ' "' . $subprocess->{proto} . '://'; $command .= ' "' . $subprocess->{proto} . '://';