Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: sebastien/cuisine
base: 77056106f8
...
head fork: sebastien/cuisine
compare: 69b470e7ac
  • 2 commits
  • 1 file changed
  • 0 commit comments
  • 2 contributors
Commits on Apr 05, 2012
@prune998 prune998 Added yum commands for package maintenance on RedHat like OS (RHEL, C…
…entOS...)
4a45ba7
Commits on Apr 09, 2012
@sebastien Merge pull request #69 from prune998/master
Please accept the pull request to add the YUM package commands
69b470e
Showing with 50 additions and 1 deletion.
  1. +50 −1 src/cuisine.py
View
51 src/cuisine.py
@@ -143,7 +143,7 @@ def __exit__(self, *args, **kws):
# =============================================================================
def select_package( option=None ):
- supported = ["apt"]
+ supported = ["apt", "yum"]
if not (option is None):
assert option in supported, "Option must be one of: %s" % (supported)
fabric.api.env["option_package"] = option
@@ -525,6 +525,11 @@ def package_ensure(package, update=False):
case it's not already there. If `update` is true, then the
package will be updated if it already exists."""
+@dispatch
+def package_clean(package=None):
+ """Clean the repository for un-needed files
+ ."""
+
# -----------------------------------------------------------------------------
# APT PACKAGE (DEBIAN/UBUNTU)
# -----------------------------------------------------------------------------
@@ -562,6 +567,50 @@ def package_ensure_apt(package, update=False):
if update: package_update(package)
return True
+def package_clean_apt(package=None):
+ pass
+
+# -----------------------------------------------------------------------------
+# YUM PACKAGE (RedHat, CentOS)
+# added by Prune - 20120408 - v1.0
+# -----------------------------------------------------------------------------
+
+def repository_ensure_yum(repository):
+ pass
+
+def package_upgrade_yum():
+ sudo("yum --assumeyes update")
+
+def package_update_yum(package=None):
+ if package == None:
+ sudo("yum --assumeyes update")
+ else:
+ if type(package) in (list, tuple):
+ package = " ".join(package)
+ sudo("yum --assumeyes upgrade " + package)
+
+def package_upgrade_yum(package=None):
+ sudo("yum --assumeyes upgrade")
+
+def package_install_yum(package, update=False):
+ if update:
+ sudo("yum --assumeyes update")
+ if type(package) in (list, tuple):
+ package = " ".join(package)
+ sudo("yum --assumeyes install %s" % (package))
+
+def package_ensure_yum(package, update=False):
+ status = run("yum list installed %s ; true" % package)
+ if status.find("No matching Packages") != -1 or status.find(package) == -1:
+ package_install(package)
+ return False
+ else:
+ if update: package_update(package)
+ return True
+
+def package_clean_yum(package=None):
+ sudo("yum --assumeyes clean all")
+
# =============================================================================
#
# SHELL COMMANDS

No commit comments for this range

Something went wrong with that request. Please try again.