LGTM

On Wed, Apr 7, 2010 at 9:27 AM, John Admanski <[email protected]> wrote:
> Clear out the destination path before retriving a package via autoserv.
> Otherwise it will always appear to the client that the package was fetched
> successfully, since it assumes if a file is where it told the server to put
> it then the package was sent.
>
> Also, add code to the error case in the http fetcher to remove any file
> that may have been fetched. If the wget failed then the package isn't valid
> so we shouldn't leave it lying around.
>
> Signed-off-by: John Admanski <[email protected]>
>
> --- autotest/client/bin/harness_autoserv.py     2010-04-07 09:23:43.000000000 
> -0700
> +++ autotest/client/bin/harness_autoserv.py     2010-04-07 09:23:43.000000000 
> -0700
> @@ -99,6 +99,8 @@
>
>
>     def fetch_pkg_file(self, filename, dest_path):
> +        if os.path.exists(dest_path):
> +            os.remove(dest_path)
>         logging.info('Fetching %s from autoserv to %s', filename, dest_path)
>         self.job_harness.fetch_package(filename, dest_path)
>         if os.path.exists(dest_path):
> --- autotest/client/common_lib/base_packages.py 2010-04-07 09:23:43.000000000 
> -0700
> +++ autotest/client/common_lib/base_packages.py 2010-04-07 09:23:43.000000000 
> -0700
> @@ -152,6 +152,9 @@
>             logging.debug('Successfully fetched %s from %s', filename,
>                           package_url)
>         except error.CmdError:
> +            # remove whatever junk was retrieved when the get failed
> +            self.run_command('rm -f %s' % dest_path)
> +
>             raise error.PackageFetchError('%s not found in %s' % (filename,
>                                                                   
> package_url))
> _______________________________________________
> Autotest mailing list
> [email protected]
> http://test.kernel.org/cgi-bin/mailman/listinfo/autotest
>
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to