From 31ed6565f604285b55594029d7bb823b0021a779 Mon Sep 17 00:00:00 2001 From: Maarten Vanraes Date: Mon, 16 May 2016 17:58:04 +0200 Subject: missing find_part function --- lib/ManaTools/Shared/disk_backend/Part.pm | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib') diff --git a/lib/ManaTools/Shared/disk_backend/Part.pm b/lib/ManaTools/Shared/disk_backend/Part.pm index 0b4bb6b6..d30e5864 100644 --- a/lib/ManaTools/Shared/disk_backend/Part.pm +++ b/lib/ManaTools/Shared/disk_backend/Part.pm @@ -368,6 +368,18 @@ sub find_parts { return @res; } +sub find_part { + my $self = shift; + my $parttype = shift; + my @tags = @_; + my $links = $self->links(); + my @res = (); + for my $link (@{$links}) { + return $link->part() if ($link->check($self, $parttype, @tags)); + } + return undef; +} + sub children { my $self = shift; my @children = $self->find_parts(undef, 'child'); -- cgit v1.2.1