[Et-mgmt-commits-list] [SCM] virt-factory branch, master now at v0.0.3-272-g02fcd19
Adrian Likins
alikins at redhat.com
Wed Aug 29 21:29:01 UTC 2007
Hello,
This is an automated email from the git hooks/update script, it was
generated because a ref change was pushed to the repository.
Updating branch, master,
via 02fcd1947f094e0b3a7c6d31a86ee20c98988abe (commit)
via 2944c4858f6a0f2cffe0dbccead7080c73eb5dec (commit)
via 5fc51966bcb5aae570aa1e892f868128ef05cc39 (commit)
via 490511c31feb5d4500bb9dd843da5b5412c03783 (commit)
via 0488d27c92d2b47de188a3861cfe1eb67d3a785f (commit)
via 0f5efd920eba687f10147b1769376c23b50c407b (commit)
via 881935cc5f476d881a0a8b5fcde0255de11b8a79 (commit)
from ee971cd06baed05000c67af246d23802b36fe887 (commit)
- Log -----------------------------------------------------------------
commit 02fcd1947f094e0b3a7c6d31a86ee20c98988abe
Merge: 2944c48... ee971cd...
Author: Adrian Likins <alikins at grimlock.devel.redhat.com>
Date: Wed Aug 29 17:20:16 2007 -0400
Merge branch 'master' of git+ssh://g-alikins@et.redhat.com/git/virt-factory
commit 2944c4858f6a0f2cffe0dbccead7080c73eb5dec
Author: Adrian Likins <alikins at grimlock.devel.redhat.com>
Date: Wed Aug 29 17:20:09 2007 -0400
add a hook for "deployment_get_by_hostname" now so we can specify guest
cmds by hostname or mac address
commit 5fc51966bcb5aae570aa1e892f868128ef05cc39
Author: Adrian Likins <alikins at grimlock.devel.redhat.com>
Date: Wed Aug 29 17:19:09 2007 -0400
refactor the guest related cmds a bit to share some code
commit 490511c31feb5d4500bb9dd843da5b5412c03783
Merge: 0488d27... 8bc4a85...
Author: Adrian Likins <alikins at grimlock.devel.redhat.com>
Date: Wed Aug 29 16:52:08 2007 -0400
Merge branch 'master' of git+ssh://g-alikins@et.redhat.com/git/virt-factory
commit 0488d27c92d2b47de188a3861cfe1eb67d3a785f
Merge: 0f5efd9... 2c309ac...
Author: Adrian Likins <alikins at grimlock.devel.redhat.com>
Date: Wed Aug 29 16:43:29 2007 -0400
Merge branch 'master' of git+ssh://g-alikins@et.redhat.com/git/virt-factory
commit 0f5efd920eba687f10147b1769376c23b50c407b
Merge: 881935c... 8c885ac...
Author: Adrian Likins <alikins at grimlock.devel.redhat.com>
Date: Wed Aug 29 16:34:19 2007 -0400
Merge branch 'master' of git+ssh://g-alikins@et.redhat.com/git/virt-factory
commit 881935cc5f476d881a0a8b5fcde0255de11b8a79
Author: Adrian Likins <alikins at grimlock.devel.redhat.com>
Date: Wed Aug 29 15:01:40 2007 -0400
make that F-7
fix typo'ed profile name
-----------------------------------------------------------------------
Diffstat:
ampm/api_modules/deployment.py | 19 ++++++++++++----
ampm/command_modules/guest_cmds.py | 40 ++++++++++++++++++++++++++++++++++++
ampm/command_modules/pause.py | 30 +++++++++-----------------
ampm/command_modules/shutdown.py | 26 +++++++++-------------
ampm/command_modules/start.py | 25 +++++++++-------------
ampm/command_modules/unpause.py | 33 ++++++++++------------------
build/test-it-all.sh | 2 +-
7 files changed, 99 insertions(+), 76 deletions(-)
diff --git a/ampm/api_modules/deployment.py b/ampm/api_modules/deployment.py
index 5e88982..15054f5 100644
--- a/ampm/api_modules/deployment.py
+++ b/ampm/api_modules/deployment.py
@@ -9,11 +9,17 @@ class Deployment(base_module.BaseModule):
self.token = token
self.server = server
base_module.BaseModule.__init__(self)
- self.methods = ["deployment_list", "deployment_get",
- "deployment_add", "deployment_get_by_mac",
- "deployment_pause", "deployment_unpause",
- "deployment_start", "deployment_stop",
- "deployment_shutdown", "deployment_destroy",
+ self.methods = ["deployment_list",
+ "deployment_get",
+ "deployment_add",
+ "deployment_get_by_mac",
+ "deployment_get_by_hostname",
+ "deployment_pause",
+ "deployment_unpause",
+ "deployment_start",
+ "deployment_stop",
+ "deployment_shutdown",
+ "deployment_destroy",
"deployment_list"]
@@ -38,6 +44,9 @@ class Deployment(base_module.BaseModule):
def deployment_get_by_mac(self, guest):
return self.server.deployment_get_by_mac_address(self.token, {'mac_address': guest})
+ def deployment_get_by_hostname(self, guest):
+ return self.server.deployment_get_by_hostname(self.token, {'hostname': guest})
+
def deployment_get(self, guest_id):
return self.server.deployment_get(self.token, {'id':guest_id})
diff --git a/ampm/command_modules/guest_cmds.py b/ampm/command_modules/guest_cmds.py
new file mode 100644
index 0000000..e2d6ae3
--- /dev/null
+++ b/ampm/command_modules/guest_cmds.py
@@ -0,0 +1,40 @@
+import command_class
+
+import getopt
+import os
+import pprint
+import sys
+import time
+
+from rhpl.translate import _, N_, textdomain, utf8
+
+from client import ampmlib
+
+
+class GuestCommand(command_class.Command):
+ def print_help(self):
+ print "ampm %s guest_name [--guest_id] <guest_id>" % self.mode_string
+
+ def check_missing_args(self):
+ if self.guests == [] and self.guests_ids == []:
+ self.print_help()
+ return True
+ return False
+
+ def find_guest_ids(self):
+
+
+ for guest in self.guests:
+ if guest.find('.') > -1:
+ (retcode, data) = self.api.deployment_get_by_hostname(guest)
+ elif guest.find(':') > -1:
+ (retcode, data) = self.api.deployment_get_by_mac(guest)
+ else:
+ print "%s does not look like a hostname or mac address" % guest
+
+ if retcode > 0:
+ self.show_error(retcode, data)
+ continue
+ if not data or data['data'] == []:
+ continue
+ self.guests_ids.append(data['data'][0]['id'])
diff --git a/ampm/command_modules/pause.py b/ampm/command_modules/pause.py
index 50bb26c..b5e3542 100644
--- a/ampm/command_modules/pause.py
+++ b/ampm/command_modules/pause.py
@@ -2,6 +2,7 @@
import command_class
+import guest_cmds
import getopt
import os
@@ -17,10 +18,8 @@ def run(args, api):
command = Pause(args,api)
-class Pause(command_class.Command):
- def print_help(self):
- print "ampm pause guest_name [--guest_id] <guest_id>"
-
+class Pause(guest_cmds.GuestCommand):
+ mode_string = "pause"
def _parse_args(self, args):
try:
opts, args = getopt.getopt(args, "hvm",
@@ -31,9 +30,7 @@ class Pause(command_class.Command):
print _("Error parsing list arguments: %s") % e
# FIXME: error handling
-
- guest = []
- guests_ids = []
+ self.guests_ids = []
for (opt, val) in opts:
if opt in ["-h", "--help"]:
self.print_help()
@@ -41,21 +38,16 @@ class Pause(command_class.Command):
if opt in ["-v", "--verbose"]:
self.verbose = self.verbose + 1
if opt in ["--guest_id"]:
- guests_ids.append(val)
+ self.guests_ids.append(val)
- guests = args
- for guest in guests:
- (retcode, data) = self.api.deployment_get_by_mac(guest)
- if retcode > 0:
- self.show_error(retcode, data)
- continue
- if not data:
- continue
- guests_ids.append(data['data'][0]['id'])
-
+ self.guests = args
+ if self.check_missing_args():
+ return
+
+ self.find_guest_ids()
- for guest_id in guests_ids:
+ for guest_id in self.guests_ids:
(retcode, data) = self.api.deployment_pause(guest_id)
if retcode > 0:
self.show_error(retcode, data)
diff --git a/ampm/command_modules/shutdown.py b/ampm/command_modules/shutdown.py
index 8c1959b..bab43a0 100644
--- a/ampm/command_modules/shutdown.py
+++ b/ampm/command_modules/shutdown.py
@@ -2,6 +2,7 @@
import command_class
+import guest_cmds
import getopt
import os
@@ -17,9 +18,8 @@ def run(args, api):
command = Shutdown(args,api)
-class Shutdown(command_class.Command):
- def print_help(self):
- print "ampm shutdown guest_name [--guest_id] <guest_id>"
+class Shutdown(guest_cmds.GuestCommand):
+ mode_string = "shutdown"
def _parse_args(self, args):
try:
@@ -33,7 +33,7 @@ class Shutdown(command_class.Command):
guest = []
- guests_ids = []
+ self.guests_ids = []
for (opt, val) in opts:
if opt in ["-h", "--help"]:
self.print_help()
@@ -41,21 +41,17 @@ class Shutdown(command_class.Command):
if opt in ["-v", "--verbose"]:
self.verbose = self.verbose + 1
if opt in ["--guests_id"]:
- guests_ids.append(val)
+ self.guests_ids.append(val)
- guests = args
- for guest in guests:
- (retcode, data) = self.api.deployment_get_by_mac(guest)
- if retcode > 0:
- self.show_error(retcode, data)
- continue
- if not data:
- continue
- guests_ids.append(data['data'][0]['id'])
+ self.guests = args
+ if self.check_missing_args():
+ return
+ self.find_guest_ids()
- for guest_id in guests_ids:
+
+ for guest_id in self.guests_ids:
(retcode, data) = self.api.deployment_shutdown(guest_id)
if retcode > 0:
self.show_error(retcode, data)
diff --git a/ampm/command_modules/start.py b/ampm/command_modules/start.py
index 44c96c5..e614cf1 100644
--- a/ampm/command_modules/start.py
+++ b/ampm/command_modules/start.py
@@ -2,6 +2,7 @@
import command_class
+import guest_cmds
import getopt
import os
@@ -17,9 +18,8 @@ def run(args, api):
command = Start(args,api)
-class Start(command_class.Command):
- def print_help(self):
- print "ampm start profile_name [--guest_id] <guest_id>"
+class Start(guest_cmds.GuestCommand):
+ mode_string = "start"
def _parse_args(self, args):
try:
@@ -33,7 +33,7 @@ class Start(command_class.Command):
guest = []
- guests_ids = []
+ self.guests_ids = []
for (opt, val) in opts:
if opt in ["-h", "--help"]:
self.print_help()
@@ -41,19 +41,14 @@ class Start(command_class.Command):
if opt in ["-v", "--verbose"]:
self.verbose = self.verbose + 1
if opt in ["--guests_id"]:
- guests_ids.append(val)
+ self.guests_ids.append(val)
- guests = args
- for guest in guests:
- (retcode, data) = self.api.deployment_get_by_mac(guest)
- if retcode > 0:
- self.show_error(retcode, data)
- continue
- if not data:
- continue
- guests_ids.append(data['data'][0]['id'])
-
+ self.guests = args
+ if self.check_missing_args():
+ return
+
+ self.find_guest_ids()
for guest_id in guests_ids:
(retcode, data) = self.api.deployment_start(guest_id)
diff --git a/ampm/command_modules/unpause.py b/ampm/command_modules/unpause.py
index 151596d..0776803 100644
--- a/ampm/command_modules/unpause.py
+++ b/ampm/command_modules/unpause.py
@@ -2,6 +2,7 @@
import command_class
+import guest_cmds
import getopt
import os
@@ -17,10 +18,9 @@ def run(args, api):
command = Unpause(args,api)
-class Unpause(command_class.Command):
- def print_help(self):
- print "ampm unpause guest_name [--guest_id] <guest_id>"
-
+class Unpause(guest_cmds.GuestCommand):
+ mode_string = "unpause"
+
def _parse_args(self, args):
try:
opts, args = getopt.getopt(args, "hvm",
@@ -34,7 +34,7 @@ class Unpause(command_class.Command):
guest = []
- guests_ids = []
+ self.guests_ids = []
for (opt, val) in opts:
if opt in ["-h", "--help"]:
self.print_help()
@@ -42,25 +42,16 @@ class Unpause(command_class.Command):
if opt in ["-v", "--verbose"]:
self.verbose = self.verbose + 1
if opt in ["--guests_id"]:
- guests_ids.append(val)
+ self.guests_ids.append(val)
- guests = args
- if guests == [] and guests_ids == []:
- self.print_help()
+ self.guests = args
+ if self.check_missing_args():
return
-
- for guest in guests:
- (retcode, data) = self.api.deployment_get_by_mac(guest)
- if retcode > 0:
- self.show_error(retcode, data)
- continue
- if not data:
- continue
- guests_ids.append(data['data'][0]['id'])
-
-
- for guest_id in guests_ids:
+
+ self.find_guest_ids()
+
+ for guest_id in self.guests_ids:
(retcode, data) = self.api.deployment_unpause(guest_id)
if retcode > 0:
self.show_error(retcode, data)
diff --git a/build/test-it-all.sh b/build/test-it-all.sh
index dd448fe..2f152d0 100755
--- a/build/test-it-all.sh
+++ b/build/test-it-all.sh
@@ -86,7 +86,7 @@ TEST_PROFILE_DEPLOY=Y
DEPLOY_HOST=mdehaan.rdu.redhat.com
# which profile to deploy in the test deploy
-TEST_PROFILE="Test1::F7-x86_64"
+TEST_PROFILE="Test1::F-7-x86_64"
# whether to attempt to slay and undefine the first virtual
# machine prior to starting testing, otherwise, testing
hooks/update
---
Git Source Code Management System
hooks/update refs/heads/master \
ee971cd06baed05000c67af246d23802b36fe887 \
02fcd1947f094e0b3a7c6d31a86ee20c98988abe
More information about the Et-mgmt-commits-list
mailing list