summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBill Peck <bpeck@redhat.com>2009-06-01 13:26:56 -0400
committerBill Peck <bpeck@redhat.com>2009-06-01 13:26:56 -0400
commitc62628e0da8fef729b9035c7e253710a3060ff82 (patch)
tree799cb923644a0071cd1bc0e462c34e9b4fc836a0
parent1ff4d64dddde5cecf2e7f76cb6f1eef84c596413 (diff)
basic distro list/tag/untag commands
-rw-r--r--Client/src/beaker/client/commands/cmd_distro-list.py48
-rw-r--r--Client/src/beaker/client/commands/cmd_distro-tag.py41
-rw-r--r--Client/src/beaker/client/commands/cmd_distro-untag.py41
3 files changed, 130 insertions, 0 deletions
diff --git a/Client/src/beaker/client/commands/cmd_distro-list.py b/Client/src/beaker/client/commands/cmd_distro-list.py
new file mode 100644
index 0000000..fab546d
--- /dev/null
+++ b/Client/src/beaker/client/commands/cmd_distro-list.py
@@ -0,0 +1,48 @@
+# -*- coding: utf-8 -*-
+
+
+from beaker.client import BeakerCommand
+
+
+class Distros_List(BeakerCommand):
+ """list distros"""
+ enabled = True
+
+
+ def options(self):
+ self.parser.usage = "%%prog %s" % self.normalized_name
+
+ self.parser.add_option(
+ "--tag",
+ action="append",
+ help="filter by tag",
+ )
+ self.parser.add_option(
+ "--name",
+ default=None,
+ help="filter by name, use % for wildcard",
+ )
+ self.parser.add_option(
+ "--family",
+ default=None,
+ help="filter by family",
+ )
+ self.parser.add_option(
+ "--arch",
+ default=None,
+ help="filter by arch",
+ )
+
+
+ def run(self, *args, **kwargs):
+ username = kwargs.pop("username", None)
+ password = kwargs.pop("password", None)
+ name = kwargs.pop("name", None)
+ family = kwargs.pop("family", None)
+ arch = kwargs.pop("arch", None)
+ tags = kwargs.pop("tag", [])
+
+ self.set_hub(username, password)
+ print "Name,Arch,OSVersion,Variant,Method,Virt"
+ for distro in self.hub.distros.list(name, family, arch, tags):
+ print ','.join([str(d) for d in distro])
diff --git a/Client/src/beaker/client/commands/cmd_distro-tag.py b/Client/src/beaker/client/commands/cmd_distro-tag.py
new file mode 100644
index 0000000..fa5be3f
--- /dev/null
+++ b/Client/src/beaker/client/commands/cmd_distro-tag.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+
+
+from beaker.client import BeakerCommand
+
+
+class Distros_Tag(BeakerCommand):
+ """tag distros"""
+ enabled = True
+
+
+ def options(self):
+ self.parser.usage = "%%prog %s [options] <tag>" % self.normalized_name
+
+ self.parser.add_option(
+ "--name",
+ default=None,
+ help="tag by name, use % for wildcard",
+ )
+ self.parser.add_option(
+ "--arch",
+ default=None,
+ help="tag by arch",
+ )
+
+
+ def run(self, *args, **kwargs):
+ if len(args) < 1:
+ self.parser.error("Please specify a tag")
+
+ username = kwargs.pop("username", None)
+ password = kwargs.pop("password", None)
+ name = kwargs.pop("name", None)
+ arch = kwargs.pop("arch", None)
+ tag = args[0]
+
+ self.set_hub(username, password)
+ print "Tagged the following distros with tag: %s" % tag
+ print "------------------------------------------------------"
+ for distro in self.hub.distros.tag(name, arch, tag):
+ print distro
diff --git a/Client/src/beaker/client/commands/cmd_distro-untag.py b/Client/src/beaker/client/commands/cmd_distro-untag.py
new file mode 100644
index 0000000..91f3095
--- /dev/null
+++ b/Client/src/beaker/client/commands/cmd_distro-untag.py
@@ -0,0 +1,41 @@
+# -*- coding: utf-8 -*-
+
+
+from beaker.client import BeakerCommand
+
+
+class Distros_Untag(BeakerCommand):
+ """untag distros"""
+ enabled = True
+
+
+ def options(self):
+ self.parser.usage = "%%prog %s [options] <tag>" % self.normalized_name
+
+ self.parser.add_option(
+ "--name",
+ default=None,
+ help="untag by name, use % for wildcard",
+ )
+ self.parser.add_option(
+ "--arch",
+ default=None,
+ help="untag by arch",
+ )
+
+
+ def run(self, *args, **kwargs):
+ if len(args) < 1:
+ self.parser.error("Please specify a tag")
+
+ username = kwargs.pop("username", None)
+ password = kwargs.pop("password", None)
+ name = kwargs.pop("name", None)
+ arch = kwargs.pop("arch", None)
+ tag = args[0]
+
+ self.set_hub(username, password)
+ print "Removed Tag %s from the following distros:" % tag
+ print "------------------------------------------------------"
+ for distro in self.hub.distros.untag(name, arch, tag):
+ print distro