98_Hyperion: remove redundant localhost check

git-svn-id: https://svn.fhem.de/fhem/trunk@12384 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
deespe 2016-10-19 21:49:30 +00:00
parent 69d3c4ede2
commit 68bc63894c

View File

@ -192,8 +192,7 @@ sub Hyperion_list2array($$)
sub Hyperion_isLocal($) sub Hyperion_isLocal($)
{ {
my ($hash) = @_; my ($hash) = @_;
return 1 if ($hash->{IP} eq "localhost" || $hash->{IP} eq "127.0.0.1"); return ($hash->{IP} =~ /^(localhost|127\.0{1,3}\.0{1,3}\.(0{1,2})?1)$/)?1:undef;
return undef;
} }
sub Hyperion_Get($@) sub Hyperion_Get($@)
@ -762,7 +761,7 @@ sub Hyperion_Attr(@)
my ($cmd,$name,$attr_name,$attr_value) = @_; my ($cmd,$name,$attr_name,$attr_value) = @_;
my $hash = $defs{$name}; my $hash = $defs{$name};
my $err = undef; my $err = undef;
my $local = ($hash->{IP} =~ /^(localhost|127\.0{1,3}\.0{1,3}\.(0{1,2})?1)$/)?1:undef; my $local = Hyperion_isLocal($hash);
if ($cmd eq "set") if ($cmd eq "set")
{ {
if ($attr_name eq "hyperionBin") if ($attr_name eq "hyperionBin")
@ -771,9 +770,9 @@ sub Hyperion_Attr(@)
{ {
$err = "Invalid value $attr_value for attribute $attr_name. Must be a path like /usr/bin/hyperiond."; $err = "Invalid value $attr_value for attribute $attr_name. Must be a path like /usr/bin/hyperiond.";
} }
elsif (defined $local && !-e $attr_value) elsif ($local && !-e $attr_value)
{ {
$err = "The given file $attr_value is not an available file."; $err = "The given file $attr_value is not available.";
} }
} }
elsif ($attr_name eq "hyperionConfigDir") elsif ($attr_name eq "hyperionConfigDir")
@ -782,9 +781,9 @@ sub Hyperion_Attr(@)
{ {
$err = "Invalid value $attr_value for attribute $attr_name. Must be a path with trailing slash like /etc/hyperion/."; $err = "Invalid value $attr_value for attribute $attr_name. Must be a path with trailing slash like /etc/hyperion/.";
} }
elsif (defined $local && !-d $attr_value) elsif ($local && !-d $attr_value)
{ {
$err = "The given directory $attr_value is not an available directory."; $err = "The given directory $attr_value is not available.";
} }
else else
{ {
@ -837,7 +836,7 @@ sub Hyperion_Attr(@)
Hyperion_Call($hash); Hyperion_Call($hash);
} }
return $err if (defined $err); return $err if (defined $err);
return; return undef;
} }
sub Hyperion_Call($;$) sub Hyperion_Call($;$)