common.py (ec2-api-14.0.1) | : | common.py (ec2-api-15.0.0) | ||
---|---|---|---|---|
skipping to change at line 21 | skipping to change at line 21 | |||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |||
# See the License for the specific language governing permissions and | # See the License for the specific language governing permissions and | |||
# limitations under the License. | # limitations under the License. | |||
import base64 | import base64 | |||
import collections | import collections | |||
import fnmatch | import fnmatch | |||
import inspect | import inspect | |||
import operator | import operator | |||
from oslo_config import cfg | ||||
from oslo_log import log as logging | ||||
import six | ||||
from ec2api.api import ec2utils | from ec2api.api import ec2utils | |||
from ec2api.api import validator | from ec2api.api import validator | |||
from ec2api.db import api as db_api | from ec2api.db import api as db_api | |||
from ec2api import exception | from ec2api import exception | |||
from ec2api.i18n import _ | from ec2api.i18n import _ | |||
from oslo_config import cfg | ||||
from oslo_log import log as logging | ||||
ec2_opts = [ | ec2_opts = [ | |||
cfg.BoolOpt('disable_ec2_classic', | cfg.BoolOpt('disable_ec2_classic', | |||
help='True if server does not support EC2 Classic mode ' | help='True if server does not support EC2 Classic mode ' | |||
'in favor of default VPC'), | 'in favor of default VPC'), | |||
] | ] | |||
CONF = cfg.CONF | CONF = cfg.CONF | |||
CONF.register_opts(ec2_opts) | CONF.register_opts(ec2_opts) | |||
LOG = logging.getLogger(__name__) | LOG = logging.getLogger(__name__) | |||
skipping to change at line 69 | skipping to change at line 67 | |||
def approveChanges(self): | def approveChanges(self): | |||
del self._cleanups[:] | del self._cleanups[:] | |||
self._suppress_exception = True | self._suppress_exception = True | |||
def _run_cleanups(self, cleanups): | def _run_cleanups(self, cleanups): | |||
for function, args, kwargs in reversed(cleanups): | for function, args, kwargs in reversed(cleanups): | |||
try: | try: | |||
function(*args, **kwargs) | function(*args, **kwargs) | |||
except Exception: | except Exception: | |||
if inspect.ismethod(function): | if inspect.ismethod(function): | |||
if six.PY2: | cmodule = function.__self__.__class__.__module__ | |||
cmodule = function.im_class.__module__ | cname = function.__self__.__class__.__name__ | |||
cname = function.im_class.__name__ | ||||
else: | ||||
cmodule = function.__self__.__class__.__module__ | ||||
cname = function.__self__.__class__.__name__ | ||||
name = '%s.%s.%s' % (cmodule, cname, function.__name__) | name = '%s.%s.%s' % (cmodule, cname, function.__name__) | |||
elif inspect.isfunction(function): | elif inspect.isfunction(function): | |||
name = '%s.%s' % (function.__module__, function.__name__) | name = '%s.%s' % (function.__module__, function.__name__) | |||
else: | else: | |||
name = '%s.%s' % (function.__class__.__module__, | name = '%s.%s' % (function.__class__.__module__, | |||
function.__class__.__name__) | function.__class__.__name__) | |||
formatted_args = '' | formatted_args = '' | |||
args_string = ', '.join([repr(arg) for arg in args]) | args_string = ', '.join([repr(arg) for arg in args]) | |||
kwargs_string = ', '.join([ | kwargs_string = ', '.join([ | |||
'%s=%r' % (key, value) for key, value in kwargs.items() | '%s=%r' % (key, value) for key, value in kwargs.items() | |||
End of changes. 3 change blocks. | ||||
10 lines changed or deleted | 4 lines changed or added |