summaryrefslogtreecommitdiffstats
path: root/install.sh
diff options
context:
space:
mode:
authorRoss Brattain <ross.b.brattain@intel.com>2016-11-30 19:56:38 -0800
committerRoss Brattain <ross.b.brattain@intel.com>2016-12-05 07:41:57 -0500
commit0576844bb2cdae6b479504ec1532a5dc56c0b633 (patch)
tree8c50f7e7f9b6c37d60bdf907bb0a0e7f1c3143d1 /install.sh
parentcefc4e95e9b410c12faea47994d5a2162fa90870 (diff)
use context manager for stdin files and use _put_file_shell
requires https://gerrit.opnfv.org/gerrit/#/c/25183/ use new ssh method _put_file_shell to upload files. We have to use _put_file_shell because we rely on ~/ path expansions. Eventually we should move to remote absolute paths so we can use sftp upload. For ssh.execute() replace open() with context manager context managers were invented partly to control freeing resources. Opening files without closing them will leak file descriptors. The old standard method for closing files: f = open('data.txt') try: data = f.read() finally: f.close() was replaced with a context manager with open('data.txt') as f: data = f.read() Reference: Raymond Hettinger's Pycon 2013 presentation: https://speakerdeck.com/pyconslides/transforming-code-into-beautiful-idiomatic-python-by-raymond-hettinger-1 Video: https://youtu.be/OSGv2VnC0go?t=2522 Always use context managers for files Update: rebased now that _put_file_shell was merged Change-Id: Iabfc0e43aa3b7766d7c658115e13d21c31efb2a9 Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
Diffstat (limited to 'install.sh')
0 files changed, 0 insertions, 0 deletions