| line | stmt | bran | cond | sub | pod | time | code | 
| 1 |  |  |  |  |  |  | package Tapper::Cmd::Requested; | 
| 2 |  |  |  |  |  |  | our $AUTHORITY = 'cpan:TAPPER'; | 
| 3 |  |  |  |  |  |  | $Tapper::Cmd::Requested::VERSION = '5.0.11'; | 
| 4 | 5 |  |  | 5 |  | 5471105 | use Moose; | 
|  | 5 |  |  |  |  | 519307 |  | 
|  | 5 |  |  |  |  | 45 |  | 
| 5 |  |  |  |  |  |  |  | 
| 6 | 5 |  |  | 5 |  | 35180 | use Tapper::Model 'model'; | 
|  | 5 |  |  |  |  | 4523 |  | 
|  | 5 |  |  |  |  | 273 |  | 
| 7 | 5 |  |  | 5 |  | 44 | use parent 'Tapper::Cmd'; | 
|  | 5 |  |  |  |  | 13 |  | 
|  | 5 |  |  |  |  | 33 |  | 
| 8 |  |  |  |  |  |  |  | 
| 9 |  |  |  |  |  |  |  | 
| 10 |  |  |  |  |  |  |  | 
| 11 |  |  |  |  |  |  |  | 
| 12 |  |  |  |  |  |  |  | 
| 13 |  |  |  |  |  |  | sub add_host { | 
| 14 |  |  |  |  |  |  |  | 
| 15 | 1 |  |  | 1 | 1 | 18095 | my ( $self, $testrun_id, $i_host_id ) = @_; | 
| 16 |  |  |  |  |  |  |  | 
| 17 | 1 | 50 |  |  |  | 8 | if ( $i_host_id !~ /^\d+$/ ) { | 
| 18 | 1 | 50 |  |  |  | 6 | if ( | 
| 19 |  |  |  |  |  |  | !( | 
| 20 |  |  |  |  |  |  | $i_host_id = | 
| 21 |  |  |  |  |  |  | model('TestrunDB') | 
| 22 |  |  |  |  |  |  | ->resultset('Host') | 
| 23 |  |  |  |  |  |  | ->search({ name => $i_host_id },{ rows => 1 }) | 
| 24 |  |  |  |  |  |  | ->first | 
| 25 |  |  |  |  |  |  | ->id | 
| 26 |  |  |  |  |  |  | ) | 
| 27 |  |  |  |  |  |  | ) { | 
| 28 | 0 |  |  |  |  | 0 | return; | 
| 29 |  |  |  |  |  |  | } | 
| 30 |  |  |  |  |  |  | } | 
| 31 |  |  |  |  |  |  |  | 
| 32 | 1 |  |  |  |  | 13385 | my $or_request = | 
| 33 |  |  |  |  |  |  | model('TestrunDB') | 
| 34 |  |  |  |  |  |  | ->resultset('TestrunRequestedHost') | 
| 35 |  |  |  |  |  |  | ->new({ testrun_id => $testrun_id, host_id => $i_host_id }) | 
| 36 |  |  |  |  |  |  | ; | 
| 37 | 1 |  |  |  |  | 691 | $or_request->insert(); | 
| 38 |  |  |  |  |  |  |  | 
| 39 | 1 |  |  |  |  | 17553 | return $or_request->id; | 
| 40 |  |  |  |  |  |  |  | 
| 41 |  |  |  |  |  |  | } | 
| 42 |  |  |  |  |  |  |  | 
| 43 |  |  |  |  |  |  |  | 
| 44 |  |  |  |  |  |  | sub add_feature { | 
| 45 | 1 |  |  | 1 | 1 | 20095 | my ($self, $id, $feature) = @_; | 
| 46 |  |  |  |  |  |  |  | 
| 47 | 1 |  |  |  |  | 8 | my $request = model('TestrunDB')->resultset('TestrunRequestedFeature')->new({testrun_id => $id, feature => $feature}); | 
| 48 | 1 |  |  |  |  | 614 | $request->insert(); | 
| 49 | 1 |  |  |  |  | 14023 | return $request->id; | 
| 50 |  |  |  |  |  |  | } | 
| 51 |  |  |  |  |  |  |  | 
| 52 |  |  |  |  |  |  |  | 
| 53 |  |  |  |  |  |  |  | 
| 54 |  |  |  |  |  |  |  | 
| 55 |  |  |  |  |  |  | 1; # End of Tapper::Cmd::Testrun | 
| 56 |  |  |  |  |  |  |  | 
| 57 |  |  |  |  |  |  | __END__ | 
| 58 |  |  |  |  |  |  |  | 
| 59 |  |  |  |  |  |  | =pod | 
| 60 |  |  |  |  |  |  |  | 
| 61 |  |  |  |  |  |  | =encoding UTF-8 | 
| 62 |  |  |  |  |  |  |  | 
| 63 |  |  |  |  |  |  | =head1 NAME | 
| 64 |  |  |  |  |  |  |  | 
| 65 |  |  |  |  |  |  | Tapper::Cmd::Requested | 
| 66 |  |  |  |  |  |  |  | 
| 67 |  |  |  |  |  |  | =head1 SYNOPSIS | 
| 68 |  |  |  |  |  |  |  | 
| 69 |  |  |  |  |  |  | This project is offers wrapper around database manipulation functions. These | 
| 70 |  |  |  |  |  |  | wrappers handle things like setting default values or id<->name | 
| 71 |  |  |  |  |  |  | translation. This module handles requested hosts and features for a | 
| 72 |  |  |  |  |  |  | testrequest. | 
| 73 |  |  |  |  |  |  |  | 
| 74 |  |  |  |  |  |  | use Tapper::Cmd::Testrun; | 
| 75 |  |  |  |  |  |  |  | 
| 76 |  |  |  |  |  |  | my $bar = Tapper::Cmd::Testrun->new(); | 
| 77 |  |  |  |  |  |  | $bar->add($testrun); | 
| 78 |  |  |  |  |  |  | ... | 
| 79 |  |  |  |  |  |  |  | 
| 80 |  |  |  |  |  |  | =head1 NAME | 
| 81 |  |  |  |  |  |  |  | 
| 82 |  |  |  |  |  |  | Tapper::Cmd::Request - Backend functions for manipluation of requested hosts or features in the database | 
| 83 |  |  |  |  |  |  |  | 
| 84 |  |  |  |  |  |  | =head1 FUNCTIONS | 
| 85 |  |  |  |  |  |  |  | 
| 86 |  |  |  |  |  |  | =head2 add_host | 
| 87 |  |  |  |  |  |  |  | 
| 88 |  |  |  |  |  |  | Add a requested host entry to database. | 
| 89 |  |  |  |  |  |  |  | 
| 90 |  |  |  |  |  |  | =head2 add_host | 
| 91 |  |  |  |  |  |  |  | 
| 92 |  |  |  |  |  |  | Add a requested host for a given testrun. | 
| 93 |  |  |  |  |  |  |  | 
| 94 |  |  |  |  |  |  | @param int              - testrun id | 
| 95 |  |  |  |  |  |  | @param string/integer   - hostname or host id | 
| 96 |  |  |  |  |  |  |  | 
| 97 |  |  |  |  |  |  | @return success - local id (primary key) | 
| 98 |  |  |  |  |  |  | @return error   - undef | 
| 99 |  |  |  |  |  |  |  | 
| 100 |  |  |  |  |  |  | =head2 add_feature | 
| 101 |  |  |  |  |  |  |  | 
| 102 |  |  |  |  |  |  | Add a requested feature for a given testrun. | 
| 103 |  |  |  |  |  |  |  | 
| 104 |  |  |  |  |  |  | @param int    - testrun id | 
| 105 |  |  |  |  |  |  | @param string - feature | 
| 106 |  |  |  |  |  |  |  | 
| 107 |  |  |  |  |  |  | @return success - local id (primary key) | 
| 108 |  |  |  |  |  |  | @return error   - undef | 
| 109 |  |  |  |  |  |  |  | 
| 110 |  |  |  |  |  |  | =head1 AUTHOR | 
| 111 |  |  |  |  |  |  |  | 
| 112 |  |  |  |  |  |  | AMD OSRC Tapper Team, C<< <tapper at amd64.org> >> | 
| 113 |  |  |  |  |  |  |  | 
| 114 |  |  |  |  |  |  | =head1 COPYRIGHT & LICENSE | 
| 115 |  |  |  |  |  |  |  | 
| 116 |  |  |  |  |  |  | Copyright 2012 AMD OSRC Tapper Team, all rights reserved. | 
| 117 |  |  |  |  |  |  |  | 
| 118 |  |  |  |  |  |  | This program is released under the following license: freebsd | 
| 119 |  |  |  |  |  |  |  | 
| 120 |  |  |  |  |  |  | =head1 AUTHORS | 
| 121 |  |  |  |  |  |  |  | 
| 122 |  |  |  |  |  |  | =over 4 | 
| 123 |  |  |  |  |  |  |  | 
| 124 |  |  |  |  |  |  | =item * | 
| 125 |  |  |  |  |  |  |  | 
| 126 |  |  |  |  |  |  | AMD OSRC Tapper Team <tapper@amd64.org> | 
| 127 |  |  |  |  |  |  |  | 
| 128 |  |  |  |  |  |  | =item * | 
| 129 |  |  |  |  |  |  |  | 
| 130 |  |  |  |  |  |  | Tapper Team <tapper-ops@amazon.com> | 
| 131 |  |  |  |  |  |  |  | 
| 132 |  |  |  |  |  |  | =back | 
| 133 |  |  |  |  |  |  |  | 
| 134 |  |  |  |  |  |  | =head1 COPYRIGHT AND LICENSE | 
| 135 |  |  |  |  |  |  |  | 
| 136 |  |  |  |  |  |  | This software is Copyright (c) 2020 by Advanced Micro Devices, Inc.. | 
| 137 |  |  |  |  |  |  |  | 
| 138 |  |  |  |  |  |  | This is free software, licensed under: | 
| 139 |  |  |  |  |  |  |  | 
| 140 |  |  |  |  |  |  | The (two-clause) FreeBSD License | 
| 141 |  |  |  |  |  |  |  | 
| 142 |  |  |  |  |  |  | =cut |