[Asterisk-code-review] asterisk.py: Bugfix for select directory with most space (...testsuite[master])

Rodrigo Ramirez Norambuena asteriskteam at digium.com
Sun May 12 11:23:55 CDT 2019


Rodrigo Ramirez Norambuena has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/11376


Change subject: asterisk.py: Bugfix for select directory with most space
......................................................................

asterisk.py: Bugfix for select directory with most space

To select the directory with more available space is used the sorted
function with os.statvfs and sorted result in order  [0, 1, 2,...]

As we need the directory with more space in the first position.
For this change the sorted by the reverse order. This patch fix
this condition.

Change-Id: I19ad9c2ba83cdbb1977938fa8287cb413372be1e
---
M lib/python/asterisk/asterisk.py
1 file changed, 4 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/76/11376/1

diff --git a/lib/python/asterisk/asterisk.py b/lib/python/asterisk/asterisk.py
index c40865d..b8323dc 100644
--- a/lib/python/asterisk/asterisk.py
+++ b/lib/python/asterisk/asterisk.py
@@ -324,7 +324,10 @@
         best_tmp = os.getenv("AST_WORK_DIR")
         if not best_tmp:
             # select tmp path with most available space
-            best_tmp = sorted(['/tmp', '/var/tmp'], key=lambda path: os.statvfs(path).f_bavail)[0]
+            best_tmp = sorted(['/tmp', '/var/tmp'],
+                              key=lambda path: os.statvfs(path).f_bavail,
+                              reverse=True)[0]
+
         # Base location of the temporary files created by the testsuite
         test_suite_root = best_tmp + "/asterisk-testsuite"
         # The default etc directory for Asterisk

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/11376
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Change-Id: I19ad9c2ba83cdbb1977938fa8287cb413372be1e
Gerrit-Change-Number: 11376
Gerrit-PatchSet: 1
Gerrit-Owner: Rodrigo Ramirez Norambuena <a at rodrigoramirez.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190512/ffcb3d64/attachment.html>


More information about the asterisk-code-review mailing list