I agree that it could be improved, added real parameters handling etc, just did 
not want to get side tracked by this. Run into this while setting new atest env 
and really wanted to be able to move hosts - hence quick fix. Perhaps will get 
back to this and do *more massaging* at some point later

Julius

-----Original Message-----
From: Lucas Meneghel Rodrigues [mailto:[email protected]] 
Sent: Friday, March 08, 2013 7:09 AM
To: Gawlas, Julius
Cc: [email protected]
Subject: Re: [Autotest] [PATCH] Fix host migration script.

Fair enough, this script needs more massaging, but indeed the changes here are 
good and were pushed.

Thanks!

On Thu, Mar 7, 2013 at 11:56 PM, Julius Gawlas <[email protected]> wrote:
> This script was broken - using wrong web_server parameter when calling 
> frontend.AFE; also added user that can be specified on the command 
> line and removed the code that deletes the host from original server - 
> it is easy to do using other means but there are use cases when one 
> might want to keep it.
>
> Signed-off-by: Julius Gawlas <[email protected]>
> ---
>  cli/autotest-rpc-migrate-host |   10 ++++------
>  1 files changed, 4 insertions(+), 6 deletions(-)
>
> diff --git a/cli/autotest-rpc-migrate-host 
> b/cli/autotest-rpc-migrate-host index 4d02c97..b305080 100755
> --- a/cli/autotest-rpc-migrate-host
> +++ b/cli/autotest-rpc-migrate-host
> @@ -8,16 +8,16 @@ except ImportError:
>  from autotest.server import frontend
>
>  try:
> -    old = frontend.AFE(web_server='http://' + sys.argv[1])
> -    new = frontend.AFE(web_server='http://' + sys.argv[2])
> +    old = frontend.AFE(user=sys.argv[1], server=sys.argv[2])
> +    new = frontend.AFE(user=sys.argv[1], server=sys.argv[3])
>
> -    hostname = sys.argv[3]
> +    hostname = sys.argv[4]
>      print 'Migrating %s ...' % hostname
>
>      old_host = old.get_hosts(hostname=hostname)[0]
>      print old_host
>  except Exception:
> -    print ("Usage: %s <old_server> <new_server> <hostname>" %
> +    print ("Usage: %s <user> <old_server> <new_server> <hostname>" %
>             os.path.basename(sys.argv[0]))
>      raise
>      sys.exit(1)
> @@ -65,5 +65,3 @@ for acl in old_host_acls:
>  if not old_host.locked:
>      new_host.modify(locked=False)
>
> -# Delete host from old server
> -old_host.delete()
> --
> 1.7.7.6
>
> _______________________________________________
> Autotest-kernel mailing list
> [email protected]
> https://www.redhat.com/mailman/listinfo/autotest-kernel



--
Lucas

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to