From: Robert 'phaylon' Sedlacek Date: Mon, 18 Jun 2012 22:22:09 +0000 (+0000) Subject: removed unrequired explicit 'list' data levels X-Git-Tag: v0.001_001~40 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=1b608727eb3a7c5c9b54193d1b537aa51dbf8352;p=scpubgit%2FSystem-Introspector.git removed unrequired explicit 'list' data levels --- diff --git a/lib/System/Introspector/Probe/Puppet.pm b/lib/System/Introspector/Probe/Puppet.pm index 811dea0..4c3fde5 100644 --- a/lib/System/Introspector/Probe/Puppet.pm +++ b/lib/System/Introspector/Probe/Puppet.pm @@ -29,11 +29,11 @@ sub _gather_resources { return transform_exceptions { my @lines = output_from_file $self->resources_file; chomp @lines; - return { list => [ map { + return [ map { m{^(\w+)\[(.*)\]$} ? [$1, $2] : [__error__ => $_]; - } @lines ] }; + } @lines ]; }; } @@ -42,7 +42,7 @@ sub _gather_classes { return transform_exceptions { my @lines = output_from_file $self->classes_file; chomp @lines; - return { list => \@lines }; + return \@lines; }; } diff --git a/lib/System/Introspector/Probe/Repositories/Git.pm b/lib/System/Introspector/Probe/Repositories/Git.pm index c416c07..610372d 100644 --- a/lib/System/Introspector/Probe/Repositories/Git.pm +++ b/lib/System/Introspector/Probe/Repositories/Git.pm @@ -92,7 +92,7 @@ sub _find_changes { local $ENV{GIT_DIR} = $dir; my @lines = lines_from_command ['git', 'diff', '--name-only', $local, $remote]; - return { list => \@lines }; + return \@lines; } sub _gather_git_config { diff --git a/lib/System/Introspector/Probe/Users.pm b/lib/System/Introspector/Probe/Users.pm index 6c1a82a..0b4047a 100644 --- a/lib/System/Introspector/Probe/Users.pm +++ b/lib/System/Introspector/Probe/Users.pm @@ -78,7 +78,7 @@ sub _gather_ssh_keys { sub _gather_user_groups { my ($self, $user) = @_; my $groups = output_from_command [groups => $user]; - return { list => [split m{\s+}, $groups] }; + return [split m{\s+}, $groups]; } sub _deparse_htpasswd_line { diff --git a/t/puppet.t b/t/puppet.t index 946ae6d..1e49879 100644 --- a/t/puppet.t +++ b/t/puppet.t @@ -10,10 +10,10 @@ my $probe = System::Introspector::Probe::Puppet->new( ); my $data = $probe->gather; -is_deeply $data->{classes}{list}, +is_deeply $data->{classes}, [qw( user::foo settings user::foo user::bar )], 'classes parsing'; -is_deeply $data->{resources}{list}, +is_deeply $data->{resources}, [[user => 'foo'], [exec => 'ls -lha'], [file => '/home/foo/quux'], diff --git a/t/users.t b/t/users.t index ccd6826..efaba05 100644 --- a/t/users.t +++ b/t/users.t @@ -44,9 +44,11 @@ do { }, }, 'ssh key data'; - is_deeply $user->{groups}, { - list => [qw( testfoo_group_A testfoo_group_B testfoo_group_C )], - }, 'groups list'; + is_deeply $user->{groups}, [qw( + testfoo_group_A + testfoo_group_B + testfoo_group_C + )], 'groups list'; my $tab = $user->{crontab}; ok $tab, 'got crontab results';