Port modules away from __file__

* __file__ won't work if we want to invoke modules via -m or if we
  figure out how to keep modules from hitting the disk with pipelining.
* module.tmpdir is the new way to place a file where it will be cleaned
  automatically.

Change format string to not depend on __file__:

* cloud/amazon/ec2_elb_lb.py
* cloud/amazon/elb_classic_lb.py

Use module.tempdir:

* packaging/os/apt.py
* files/unarchive.py
This commit is contained in:
Toshio Kuratomi 2018-06-20 06:35:27 -07:00
commit 9350a81ae4
5 changed files with 12 additions and 8 deletions

View file

@ -980,7 +980,7 @@ class ElbManager(object):
self.elb_conn.modify_lb_attribute(self.name, 'ConnectingSettings', attributes.connecting_settings)
def _policy_name(self, policy_type):
return __file__.split('/')[-1].split('.')[0].replace('_', '-') + '-' + policy_type
return 'ec2-elb-lb-{0}'.format(to_native(policy_type, errors='surrogate_or_strict'))
def _create_policy(self, policy_param, policy_meth, policy):
getattr(self.elb_conn, policy_meth)(policy_param, self.elb.name, policy)