Skip to content
This repository has been archived by the owner on Aug 30, 2024. It is now read-only.

Commit

Permalink
Placate Codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
gholms committed Jun 16, 2016
1 parent 6a2254f commit 59b5b11
Show file tree
Hide file tree
Showing 70 changed files with 266 additions and 136 deletions.
2 changes: 2 additions & 0 deletions euca2ools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@
__version__ = GIT.stdout.read().strip().lstrip('v')
if type(__version__).__name__ == 'bytes':
__version__ = __version__.decode()
# pylint: disable=bare-except
except:
# Not really a bad thing; we'll just use what we had
pass
# pylint: enable=bare-except
2 changes: 2 additions & 0 deletions euca2ools/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,11 @@ def format_version():
with open('/etc/eucalyptus/eucalyptus-version') as ver_file:
euca_version = ver_file.readline().strip()
version_lines.append('eucalyptus {0}'.format(euca_version))
# pylint: disable=bare-except
except:
# Those were just more crunchy bits. If they don't work, oh well!
pass
# pylint: enable=bare-except
return '\n'.join(version_lines)

def list_config_files(self):
Expand Down
5 changes: 2 additions & 3 deletions euca2ools/commands/argtypes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2012-2014 Eucalyptus Systems, Inc.
# Copyright (c) 2012-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
Expand Down Expand Up @@ -139,8 +139,7 @@ def vpc_interface(iface_as_str):

if len(iface_as_str) == 0:
raise argparse.ArgumentTypeError(
'network interface definitions must be non-empty'.format(
iface_as_str))
'network interface definitions must be non-empty')

bits = iface_as_str.split(':')
iface = {}
Expand Down
4 changes: 3 additions & 1 deletion euca2ools/commands/autoscaling/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013-2015 Eucalyptus Systems, Inc.
# Copyright (c) 2013-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
Expand Down Expand Up @@ -50,8 +50,10 @@ def configure(self):
requestbuilder.service.BaseService.configure(self)
add_fake_region_name(self)

# pylint: disable=no-self-use
def handle_http_error(self, response):
raise AWSError(response)
# pylint: enable=no-self-use


class AutoScalingRequest(requestbuilder.request.AWSQueryRequest):
Expand Down
7 changes: 5 additions & 2 deletions euca2ools/commands/autoscaling/describeautoscalinggroups.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013, 2015 Eucalyptus Systems, Inc.
# Copyright (c) 2013-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
Expand All @@ -23,11 +23,12 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from euca2ools.commands.autoscaling import AutoScalingRequest
from requestbuilder import Arg
from requestbuilder.mixins import TabifyingMixin
from requestbuilder.response import PaginatedResponse

from euca2ools.commands.autoscaling import AutoScalingRequest


class DescribeAutoScalingGroups(AutoScalingRequest, TabifyingMixin):
DESCRIPTION = 'Describe auto-scaling groups'
Expand All @@ -47,8 +48,10 @@ def prepare_for_page(self, page):
# Pages are defined by NextToken
self.params['NextToken'] = page

# pylint: disable=no-self-use
def get_next_page(self, response):
return response.get('NextToken') or None
# pylint: enable=no-self-use

def print_result(self, result):
lines = []
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Eucalyptus Systems, Inc.
# Copyright (c) 2013-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
Expand All @@ -24,11 +24,13 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import argparse
from euca2ools.commands.autoscaling import AutoScalingRequest

from requestbuilder import Arg
from requestbuilder.mixins import TabifyingMixin
from requestbuilder.response import PaginatedResponse

from euca2ools.commands.autoscaling import AutoScalingRequest


class DescribeAutoScalingInstances(AutoScalingRequest, TabifyingMixin):
DESCRIPTION = 'Describe instances in auto-scaling groups'
Expand All @@ -45,8 +47,10 @@ def prepare_for_page(self, page):
# Pages are defined by NextToken
self.params['NextToken'] = page

# pylint: disable=no-self-use
def get_next_page(self, response):
return response.get('NextToken') or None
# pylint: enable=no-self-use

def print_result(self, result):
for instance in result.get('AutoScalingInstances', []):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Eucalyptus Systems, Inc.
# Copyright (c) 2013-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
Expand All @@ -23,11 +23,12 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from euca2ools.commands.autoscaling import AutoScalingRequest
from requestbuilder import Arg
from requestbuilder.mixins import TabifyingMixin
from requestbuilder.response import PaginatedResponse

from euca2ools.commands.autoscaling import AutoScalingRequest


class DescribeLaunchConfigurations(AutoScalingRequest, TabifyingMixin):
DESCRIPTION = 'Describe auto-scaling instance launch configurations'
Expand All @@ -46,8 +47,10 @@ def prepare_for_page(self, page):
# Pages are defined by NextToken
self.params['NextToken'] = page

# pylint: disable=no-self-use
def get_next_page(self, response):
return response.get('NextToken') or None
# pylint: disable=no-self-use

def print_result(self, result):
for config in result.get('LaunchConfigurations', []):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Eucalyptus Systems, Inc.
# Copyright (c) 2013-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
Expand All @@ -23,11 +23,12 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from euca2ools.commands.autoscaling import AutoScalingRequest
from requestbuilder import Arg
from requestbuilder.mixins import TabifyingMixin
from requestbuilder.response import PaginatedResponse

from euca2ools.commands.autoscaling import AutoScalingRequest


class DescribeNotificationConfigurations(AutoScalingRequest, TabifyingMixin):
DESCRIPTION = ('Describe notification actions associated with '
Expand All @@ -45,8 +46,10 @@ def prepare_for_page(self, page):
# Pages are defined by NextToken
self.params['NextToken'] = page

# pylint: disable=no-self-use
def get_next_page(self, response):
return response.get('NextToken') or None
# pylint: enable=no-self-use

def print_result(self, result):
for config in result.get('NotificationConfigurations', []):
Expand Down
7 changes: 5 additions & 2 deletions euca2ools/commands/autoscaling/describepolicies.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Eucalyptus Systems, Inc.
# Copyright (c) 2013-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
Expand All @@ -23,11 +23,12 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from euca2ools.commands.autoscaling import AutoScalingRequest
from requestbuilder import Arg
from requestbuilder.mixins import TabifyingMixin
from requestbuilder.response import PaginatedResponse

from euca2ools.commands.autoscaling import AutoScalingRequest


class DescribePolicies(AutoScalingRequest, TabifyingMixin):
DESCRIPTION = 'Describe auto-scaling policies'
Expand All @@ -46,8 +47,10 @@ def prepare_for_page(self, page):
# Pages are defined by NextToken
self.params['NextToken'] = page

# pylint: disable=no-self-use
def get_next_page(self, response):
return response.get('NextToken') or None
# pylint: enable=no-self-use

def print_result(self, result):
for policy in result.get('ScalingPolicies', []):
Expand Down
7 changes: 5 additions & 2 deletions euca2ools/commands/autoscaling/describescalingactivities.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Eucalyptus Systems, Inc.
# Copyright (c) 2013-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
Expand All @@ -23,11 +23,12 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from euca2ools.commands.autoscaling import AutoScalingRequest
from requestbuilder import Arg
from requestbuilder.mixins import TabifyingMixin
from requestbuilder.response import PaginatedResponse

from euca2ools.commands.autoscaling import AutoScalingRequest


class DescribeScalingActivities(AutoScalingRequest, TabifyingMixin):
DESCRIPTION = 'Describe past and current auto-scaling activities'
Expand All @@ -47,8 +48,10 @@ def prepare_for_page(self, page):
# Pages are defined by NextToken
self.params['NextToken'] = page

# pylint: disable=no-self-use
def get_next_page(self, response):
return response.get('NextToken') or None
# pylint: enable=no-self-use

def print_result(self, result):
for activity in result.get('Activities', []):
Expand Down
7 changes: 5 additions & 2 deletions euca2ools/commands/autoscaling/describescheduledactions.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Eucalyptus Systems, Inc.
# Copyright (c) 2013-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
Expand All @@ -23,11 +23,12 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from euca2ools.commands.autoscaling import AutoScalingRequest
from requestbuilder import Arg
from requestbuilder.mixins import TabifyingMixin
from requestbuilder.response import PaginatedResponse

from euca2ools.commands.autoscaling import AutoScalingRequest


class DescribeScheduledActions(AutoScalingRequest, TabifyingMixin):
DESCRIPTION = 'Describe scheduled auto-scaling group actions'
Expand Down Expand Up @@ -55,8 +56,10 @@ def prepare_for_page(self, page):
# Pages are defined by NextToken
self.params['NextToken'] = page

# pylint: disable=no-self-use
def get_next_page(self, response):
return response.get('NextToken') or None
# pylint: enable=no-self-use

def print_result(self, result):
for action in result.get('ScheduledUpdateGroupActions', []):
Expand Down
9 changes: 6 additions & 3 deletions euca2ools/commands/autoscaling/describetags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Eucalyptus Systems, Inc.
# Copyright (c) 2013-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
Expand All @@ -23,12 +23,13 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from euca2ools.commands.autoscaling import AutoScalingRequest
from euca2ools.commands.autoscaling.argtypes import autoscaling_filter_def
from requestbuilder import Arg
from requestbuilder.mixins import TabifyingMixin
from requestbuilder.response import PaginatedResponse

from euca2ools.commands.autoscaling import AutoScalingRequest
from euca2ools.commands.autoscaling.argtypes import autoscaling_filter_def


class DescribeTags(AutoScalingRequest, TabifyingMixin):
DESCRIPTION = 'Describe auto-scaling tags'
Expand All @@ -44,8 +45,10 @@ def prepare_for_page(self, page):
# Pages are defined by NextToken
self.params['NextToken'] = page

# pylint: disable=no-self-use
def get_next_page(self, response):
return response.get('NextToken') or None
# pylint: enable=no-self-use

def print_result(self, result):
for tag in result.get('Tags', []):
Expand Down
7 changes: 5 additions & 2 deletions euca2ools/commands/autoscaling/putscalingpolicy.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013 Eucalyptus Systems, Inc.
# Copyright (c) 2013-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
Expand All @@ -23,9 +23,10 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

from euca2ools.commands.autoscaling import AutoScalingRequest
from requestbuilder import Arg

from euca2ools.commands.autoscaling import AutoScalingRequest


class PutScalingPolicy(AutoScalingRequest):
DESCRIPTION = "Create or update an auto-scaling group's scaling policy"
Expand Down Expand Up @@ -56,5 +57,7 @@ class PutScalingPolicy(AutoScalingRequest):
that this policy will change the group's desired capacity by at
least this much''')]

# pylint: disable=no-self-use
def print_result(self, result):
print result.get('PolicyARN')
# pylint: enable=no-self-use
4 changes: 3 additions & 1 deletion euca2ools/commands/bootstrap/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2015 Eucalyptus Systems, Inc.
# Copyright (c) 2015-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
Expand Down Expand Up @@ -48,8 +48,10 @@ def configure(self):
requestbuilder.service.BaseService.configure(self)
add_fake_region_name(self)

# pylint: disable=no-self-use
def handle_http_error(self, response):
raise AWSError(response)
# pylint: enable=no-self-use


class BootstrapRequest(requestbuilder.request.AWSQueryRequest):
Expand Down
6 changes: 3 additions & 3 deletions euca2ools/commands/bundle/bundleanduploadimage.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright 2013-2015 Eucalyptus Systems, Inc.
# Copyright (c) 2013-2016 Hewlett Packard Enterprise Development LP
#
# Redistribution and use of this software in source and binary forms,
# with or without modification, are permitted provided that the following
Expand All @@ -23,12 +23,12 @@
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import argparse
import multiprocessing
import os.path
import tarfile

from requestbuilder import Arg
from requestbuilder.exceptions import ClientError
from requestbuilder.mixins import FileTransferProgressBarMixin

from euca2ools.bundle.pipes.core import create_bundle_pipeline
Expand Down Expand Up @@ -70,7 +70,7 @@ def configure(self):
self.service, url=self.args.get('bootstrap_url'))
self.args['bootstrap_auth'] = \
BootstrapRequest.AUTH_CLASS.from_other(self.auth)
except:
except ClientError:
self.log.debug('bootstrap setup failed; auto cert fetching '
'will be unavailable', exc_info=True)

Expand Down
Loading

0 comments on commit 59b5b11

Please sign in to comment.