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

Friendly Automation asteriskteam at digium.com
Mon Jun 3 10:30:11 CDT 2019


Friendly Automation has submitted this change and it was merged. ( 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(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Sean Bright: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



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-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Rodrigo Ramirez Norambuena <a at rodrigoramirez.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190603/6164e285/attachment-0001.html>


More information about the asterisk-code-review mailing list