Permalink
Browse files

Update python package names.

  • Loading branch information...
komlenic committed Mar 16, 2017
1 parent 440dbfc commit 64cc053d7d6c427bc0eccb8b5e8cd772a21cf4d2
Showing with 65 additions and 6 deletions.
  1. +56 −0 a0af1a3b08683f21bafea183403ffa2ff2ff80f4.patch
  2. +9 −6 docs/puppet/drubs_centos7.pp
@@ -0,0 +1,56 @@
From a0af1a3b08683f21bafea183403ffa2ff2ff80f4 Mon Sep 17 00:00:00 2001
From: Sasha Sasha <erwerthg@gmail.com>
Date: Thu, 28 May 2015 00:48:56 +0300
Subject: [PATCH] Added killing local subprocess after timeout seconds to
fabric.api.local
---
fabric/operations.py | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/fabric/operations.py b/fabric/operations.py
index 464078e..c399bea 100644
--- a/fabric/operations.py
+++ b/fabric/operations.py
@@ -14,6 +14,7 @@
import time
from glob import glob
from contextlib import closing, contextmanager
+from threading import Timer
from fabric.context_managers import (settings, char_buffered, hide,
quiet as quiet_manager, warn_only as warn_only_manager)
@@ -1109,7 +1110,7 @@ def sudo(command, shell=True, pty=True, combine_stderr=None, user=None,
)
-def local(command, capture=False, shell=None):
+def local(command, capture=False, shell=None, timeout=None):
"""
Run a command on the local system.
@@ -1138,6 +1139,9 @@ def local(command, capture=False, shell=None):
your terminal, but the return value will contain the captured
stdout/stderr.
+ When ``timeout`` is not None, the local subprocess will be killed after
+ timeout seconds
+
In either case, as with `~fabric.operations.run` and
`~fabric.operations.sudo`, this return value exhibits the ``return_code``,
``stderr``, ``failed``, ``succeeded``, ``command`` and ``real_command``
@@ -1181,7 +1185,13 @@ def local(command, capture=False, shell=None):
p = subprocess.Popen(cmd_arg, shell=True, stdout=out_stream,
stderr=err_stream, executable=shell,
close_fds=(not win32))
- (stdout, stderr) = p.communicate()
+ if timeout:
+ timer = Timer(timeout, p.kill)
+ timer.start()
+ (stdout, stderr) = p.communicate()
+ timer.cancel()
+ else:
+ (stdout, stderr) = p.communicate()
finally:
if dev_null is not None:
dev_null.close()
@@ -139,13 +139,16 @@
package { "PyYAML":
ensure => present,
}
package { "python-pip":
package { "python2-pip":
ensure => present,
}
exec { "install-fabric":
unless => "/usr/bin/command -v fab",
command => "/usr/bin/pip install fabric",
require => Package["python-pip"],
package { "openssl-devel":
ensure => present,
}
package { "fabric":
provider => "pip",
ensure => "1.13.1",
require => Package["python2-pip", "openssl-devel"],
}
}
@@ -162,7 +165,7 @@
class drubs {
exec { "install_drubs":
command => "/usr/bin/pip install -I git+https://github.com/komlenic/drubs.git@0.3.3#egg=Drubs",
require => [Package["python-pip"],Package["gcc"]],
require => [Package["python2-pip"],Package["gcc"]],
}
}

0 comments on commit 64cc053

Please sign in to comment.