diff --git a/bin/csvdeploy.py b/bin/csvdeploy.py index 91e65b59..23b0c467 100755 --- a/bin/csvdeploy.py +++ b/bin/csvdeploy.py @@ -205,9 +205,10 @@ class _APIClient(Client): return self._put(url, data=data) def execute(self, cluster_data, hosts_data, resp_results): - """The process including create or update a cluster and the cluster - configuration, add or update a host in the cluster, and deploy - the updated hosts. + """The process includes creating or updating a cluster. + + The cluster configuration, add or update a host in the cluster, + and deploy the updated hosts. :param cluster_data: the dictionary of cluster data """ diff --git a/bin/query_switch.py b/bin/query_switch.py index c6848d31..4b4b2cdb 100755 --- a/bin/query_switch.py +++ b/bin/query_switch.py @@ -24,8 +24,10 @@ from compass.apiclient.restful import Client class AddSwitch(object): - """A utility class that handles adding a switch and retrieving - corresponding machines associated with the switch. + """A utility class. + + Handles adding a switch and retrieving corresponding machines + associated with the switch. """ def __init__(self, server_url): @@ -33,8 +35,7 @@ class AddSwitch(object): self._client = Client(server_url) def add_switch(self, queue, ip, snmp_community): - """Add a switch with SNMP credentials and retrieve attached - server machines. + """Add a switch with SNMP credentials. :param queue: The result holder for the machine details. :type queue: A Queue object(thread-safe). diff --git a/compass/actions/deploy.py b/compass/actions/deploy.py index f8639c0b..711bb5ef 100644 --- a/compass/actions/deploy.py +++ b/compass/actions/deploy.py @@ -158,7 +158,9 @@ class ServerPowerMgmt(object): class HostPowerMgmt(object): """Power management for hosts installed OS by OS installer. OS installer - will poweron/poweroff/reset host. + + will poweron/poweroff/reset host. + """ @staticmethod def poweron(host_id, user): diff --git a/compass/actions/health_check/check_hds.py b/compass/actions/health_check/check_hds.py index afc7bf5d..d176f1f3 100644 --- a/compass/actions/health_check/check_hds.py +++ b/compass/actions/health_check/check_hds.py @@ -77,7 +77,6 @@ class HdsCheck(base.BaseCheck): def check_apt_snmp(self, pkg_module): """do apt health check.""" - ## TODO(xicheng): add ubuntu package check here return None def check_snmp_mibs(self): diff --git a/compass/actions/util.py b/compass/actions/util.py index 9aba09a0..34f403a8 100644 --- a/compass/actions/util.py +++ b/compass/actions/util.py @@ -63,6 +63,7 @@ class ActionHelper(object): @staticmethod def get_adapter_info(adapter_id, cluster_id, user): """Get adapter information. Return a dictionary as below, + { "id": 1, "name": "xxx", @@ -93,6 +94,7 @@ class ActionHelper(object): ... } To view a complete output, please refer to backend doc. + """ adapter_info = adapter_db.get_adapter(adapter_id, user=user) metadata = cluster_db.get_cluster_metadata(cluster_id, user=user) @@ -111,6 +113,7 @@ class ActionHelper(object): @staticmethod def get_cluster_info(cluster_id, user): """Get cluster information.Return a dictionary as below, + { "id": 1, "adapter_id": 1, @@ -149,33 +152,34 @@ class ActionHelper(object): @staticmethod def get_hosts_info(cluster_id, hosts_id_list, user): """Get hosts information. Return a dictionary as below, - { - "hosts": { - 1($host_id): { - "reinstall_os": True, - "mac": "xxx", - "name": "xxx", - "roles": [xxx, yyy] - }, - "networks": { - "eth0": { - "ip": "192.168.1.1", - "netmask": "255.255.255.0", - "is_mgmt": True, - "is_promiscuous": False, - "subnet": "192.168.1.0/24" - }, - "eth1": {...} - }, - "os_config": {}, - "package_config": {}, - "deployed_os_config": {}, - "deployed_package_config": {} - }, - 2: {...}, - .... - } - } + + { + "hosts": { + 1($host_id): { + "reinstall_os": True, + "mac": "xxx", + "name": "xxx", + "roles": [xxx, yyy] + }, + "networks": { + "eth0": { + "ip": "192.168.1.1", + "netmask": "255.255.255.0", + "is_mgmt": True, + "is_promiscuous": False, + "subnet": "192.168.1.0/24" + }, + "eth1": {...} + }, + "os_config": {}, + "package_config": {}, + "deployed_os_config": {}, + "deployed_package_config": {} + }, + 2: {...}, + .... + } + } """ hosts_info = {} for host_id in hosts_id_list: diff --git a/compass/api/exception_handler.py b/compass/api/exception_handler.py index a9001394..67c780ee 100644 --- a/compass/api/exception_handler.py +++ b/compass/api/exception_handler.py @@ -38,8 +38,9 @@ class ItemNotFound(HTTPException): class BadRequest(HTTPException): - """Define the exception for invalid/missing parameters or a user makes - a request in invalid state and cannot be processed at this moment. + """Define the exception for invalid/missing parameters. + + User making a request in invalid state cannot be processed. """ def __init__(self, message): super(BadRequest, self).__init__(message, 400) @@ -52,23 +53,19 @@ class Unauthorized(HTTPException): class UserDisabled(HTTPException): - """Define the exception that a disabled user tries to do some operations. - """ + """Define the exception for disabled users.""" def __init__(self, message): super(UserDisabled, self).__init__(message, 403) class Forbidden(HTTPException): - """Define the exception that a user tries to do some operations without - valid permissions. - """ + """Define the exception for invalid permissions.""" def __init__(self, message): super(Forbidden, self).__init__(message, 403) class BadMethod(HTTPException): - """Define the exception for invoking unsupprted or unimplemented methods. - """ + """Define the exception for invoking unsupported methods.""" def __init__(self, message): super(BadMethod, self).__init__(message, 405) diff --git a/compass/apiclient/restful.py b/compass/apiclient/restful.py index ba73adf4..57d2590f 100644 --- a/compass/apiclient/restful.py +++ b/compass/apiclient/restful.py @@ -286,7 +286,7 @@ class Client(object): return self._delete('/switches/%s/machines/%s' % (switch_id, machine_id)) - ## test these + # test these def poll_switch(self, switch_id): data = {} data['find_machines'] = None @@ -306,7 +306,7 @@ class Client(object): data = {} data['set_machines'] = group_machines return self._post('/switches/%s/action' % switch_id, data=data) - ## end + # end def list_switchmachines(self, switch_ip_int=None, port=None, vlans=None, mac=None, tag=None, location=None): @@ -621,7 +621,7 @@ class Client(object): def delete_cluster_config(self, cluster_id): return self._delete('/clusters/%s/config' % cluster_id) - ## test these + # test these def add_hosts_to_cluster(self, cluster_id, hosts): data = {} data['add_hosts'] = hosts diff --git a/compass/apiclient/v1/example.py b/compass/apiclient/v1/example.py index 7463cad6..6f7a7f76 100755 --- a/compass/apiclient/v1/example.py +++ b/compass/apiclient/v1/example.py @@ -28,7 +28,7 @@ COMPASS_SERVER_URL = 'http://127.0.0.1/api' SWITCH_IP = '10.145.81.220' SWITCH_SNMP_VERSION = 'v2c' SWITCH_SNMP_COMMUNITY = 'public' -#MACHINES_TO_ADD = ['00:11:20:30:40:01'] +# MACHINES_TO_ADD = ['00:11:20:30:40:01'] CLUSTER_NAME = 'cluster2' HOST_NAME_PREFIX = 'host' SERVER_USERNAME = 'root' @@ -38,11 +38,11 @@ SERVICE_PASSWORD = 'service' CONSOLE_USERNAME = 'console' CONSOLE_PASSWORD = 'console' HA_VIP = '' -#NAMESERVERS = '192.168.10.6' +# NAMESERVERS = '192.168.10.6' SEARCH_PATH = 'ods.com' -#GATEWAY = '192.168.10.6' -#PROXY = 'http://192.168.10.6:3128' -#NTP_SERVER = '192.168.10.6' +# GATEWAY = '192.168.10.6' +# PROXY = 'http://192.168.10.6:3128' +# NTP_SERVER = '192.168.10.6' MANAGEMENT_IP_START = '192.168.10.130' MANAGEMENT_IP_END = '192.168.10.254' MANAGEMENT_IP_GATEWAY = '192.168.10.1' @@ -70,7 +70,7 @@ STORAGE_PROMISC = 0 HOME_PERCENTAGE = 5 TMP_PERCENTAGE = 5 VAR_PERCENTAGE = 10 -#ROLES_LIST = [['os-dashboard']] +# ROLES_LIST = [['os-dashboard']] PRESET_VALUES = { 'NAMESERVERS': '192.168.10.1', diff --git a/compass/apiclient/v1/restful.py b/compass/apiclient/v1/restful.py index d0e4c5f3..3fb235c0 100644 --- a/compass/apiclient/v1/restful.py +++ b/compass/apiclient/v1/restful.py @@ -275,8 +275,7 @@ class Client(object): return self._get('/machines/%s' % machine_id) def get_clusters(self): - """Lists the details for all clusters. - """ + """Lists the details for all clusters.""" return self._get('/clusters') def get_cluster(self, cluster_id): diff --git a/compass/db/api/cluster.py b/compass/db/api/cluster.py index 45ee8066..55277b59 100644 --- a/compass/db/api/cluster.py +++ b/compass/db/api/cluster.py @@ -1772,8 +1772,7 @@ def update_cluster_host_state_internal( for clusterhost_in_cluster in cluster.clusterhosts: if ( clusterhost_in_cluster.clusterhost_id - == - clusterhost.clusterhost_id + == clusterhost.clusterhost_id ): continue if not clusterhost_in_cluster.state.ready: @@ -1876,8 +1875,7 @@ def update_clusterhost_state_internal( for clusterhost_in_cluster in cluster.clusterhosts: if ( clusterhost_in_cluster.clusterhost_id - == - clusterhost.clusterhost_id + == clusterhost.clusterhost_id ): continue if not clusterhost_in_cluster.state.ready: diff --git a/compass/db/config_validation/default_validator.py b/compass/db/config_validation/default_validator.py index fdc2dab6..224447f7 100644 --- a/compass/db/config_validation/default_validator.py +++ b/compass/db/config_validation/default_validator.py @@ -33,9 +33,11 @@ MAPPER = { def validate_config(session, config, id_name, id_value, patch=True): - """Validates the given config value according to the config - metadata of the asscoiated os_id or adapter_id. Returns - a tuple (status, message). + """Validates config. + + Validates the given config value according to the config + metadata of the asscoiated os_id or adapter_id. Returns + a tuple (status, message). """ if id_name not in MAPPER.keys(): return (False, "Invalid id type %s" % id_name) diff --git a/compass/db/exception.py b/compass/db/exception.py index b9595a26..5823d9e4 100644 --- a/compass/db/exception.py +++ b/compass/db/exception.py @@ -49,6 +49,7 @@ class Unauthorized(DatabaseException): class UserDisabled(DatabaseException): """Define the exception that a disabled user tries to do some operations. + """ def __init__(self, message): super(UserDisabled, self).__init__(message) @@ -57,7 +58,9 @@ class UserDisabled(DatabaseException): class Forbidden(DatabaseException): """Define the exception that a user is trying to make some action - without the right permission. + + without the right permission. + """ def __init__(self, message): super(Forbidden, self).__init__(message) @@ -73,6 +76,7 @@ class NotAcceptable(DatabaseException): class InvalidParameter(DatabaseException): """Define the exception that the request has invalid or missing parameters. + """ def __init__(self, message): super(InvalidParameter, self).__init__(message) @@ -81,6 +85,7 @@ class InvalidParameter(DatabaseException): class InvalidResponse(DatabaseException): """Define the exception that the response is invalid. + """ def __init__(self, message): super(InvalidResponse, self).__init__(message) diff --git a/compass/db/models.py b/compass/db/models.py index b272a8f0..332d5a02 100644 --- a/compass/db/models.py +++ b/compass/db/models.py @@ -541,6 +541,7 @@ class HostNetwork(BASE, TimestampMixin, HelperMixin): class ClusterHostLogHistory(BASE, LogHistoryMixin): """clusterhost installing log history for each file. + """ __tablename__ = 'clusterhost_log_history' @@ -577,6 +578,7 @@ class ClusterHostLogHistory(BASE, LogHistoryMixin): class HostLogHistory(BASE, LogHistoryMixin): """host installing log history for each file. + """ __tablename__ = 'host_log_history' diff --git a/compass/db/v1/model.py b/compass/db/v1/model.py index af7f7d05..d74e355a 100644 --- a/compass/db/v1/model.py +++ b/compass/db/v1/model.py @@ -32,12 +32,12 @@ from flask.ext.login import UserMixin from itsdangerous import URLSafeTimedSerializer BASE = declarative_base() -#TODO(grace) SECRET_KEY should be generated when installing compass -#and save to a config file or DB +# TODO(grace) SECRET_KEY should be generated when installing compass +# and save to a config file or DB SECRET_KEY = "abcd" -#This is used for generating a token by user's ID and -#decode the ID from this token +# This is used for generating a token by user's ID and +# decode the ID from this token login_serializer = URLSafeTimedSerializer(SECRET_KEY) diff --git a/compass/deployment/deploy_manager.py b/compass/deployment/deploy_manager.py index ee509826..105dced5 100644 --- a/compass/deployment/deploy_manager.py +++ b/compass/deployment/deploy_manager.py @@ -92,8 +92,9 @@ class DeployManager(object): self.clean_progress() def deploy_os(self): - """Deploy OS to hosts which need to in the cluster. Return OS deployed - config. + """Deploy OS to hosts which need to in the cluster. + + Return OS deployed config. """ if not self.os_installer: return {} @@ -113,8 +114,9 @@ class DeployManager(object): return self.os_installer.deploy() def deploy_target_system(self): - """Deploy target system to all hosts in the cluster. Return package - deployed config. + """Deploy target system to all hosts in the cluster. + + Return package deployed config. """ if not self.pk_installer: return {} diff --git a/compass/deployment/installers/config_manager.py b/compass/deployment/installers/config_manager.py index fbda45ee..2c3d1dcf 100644 --- a/compass/deployment/installers/config_manager.py +++ b/compass/deployment/installers/config_manager.py @@ -41,8 +41,9 @@ class BaseConfigManager(object): return self.__get_cluster_item(const.OS_VERSION) def get_cluster_baseinfo(self): - """Get cluster base information, including cluster_id, os_version, - and cluster_name. + """Get cluster base information. + + Including cluster_id, os_version and cluster_name. """ attr_names = [const.ID, const.NAME, const.OS_VERSION] @@ -351,21 +352,22 @@ class BaseConfigManager(object): def _get_cluster_roles_mapping_helper(self): """The ouput format will be as below, for example: - { - "controller": [{ - "hostname": "xxx", - "management": { - "interface": "eth0", - "ip": "192.168.1.10", - "netmask": "255.255.255.0", - "subnet": "192.168.1.0/24", - "is_mgmt": True, - "is_promiscuous": False - }, - ... - }], - ... - } + + { + "controller": [{ + "hostname": "xxx", + "management": { + "interface": "eth0", + "ip": "192.168.1.10", + "netmask": "255.255.255.0", + "subnet": "192.168.1.0/24", + "is_mgmt": True, + "is_promiscuous": False + }, + ... + }], + ... + } """ mapping = {} hosts_id_list = self.get_host_id_list() diff --git a/compass/deployment/installers/installer.py b/compass/deployment/installers/installer.py index 07212679..80af157c 100644 --- a/compass/deployment/installers/installer.py +++ b/compass/deployment/installers/installer.py @@ -60,8 +60,9 @@ class BaseInstaller(object): def get_tmpl_vars_from_metadata(self, metadata, config): """Get variables dictionary for rendering templates from metadata. - :param dict metadata: The metadata dictionary. - :param dict config: The + + :param dict metadata: The metadata dictionary. + :param dict config: The """ template_vars = {} self._get_tmpl_vars_helper(metadata, config, template_vars) @@ -69,18 +70,19 @@ class BaseInstaller(object): return template_vars def _get_key_mapping(self, metadata, key, is_regular_key): - """Get the keyword which the input key maps to. This keyword will be - added to dictionary used to render templates. + """Get the keyword which the input key maps to. - If the key in metadata has a mapping to another keyword which is - used for templates, then return this keyword. If the key is started - with '$', which is a variable in metadata, return the key itself as - the mapping keyword. If the key has no mapping, return None. + This keyword will be added to dictionary used to render templates. - :param dict metadata: metadata/submetadata dictionary. - :param str key: The keyword defined in metadata. - :param bool is_regular_key: False when the key defined in metadata - is a variable(starting with '$'). + If the key in metadata has a mapping to another keyword which is + used for templates, then return this keyword. If the key is started + with '$', which is a variable in metadata, return the key itself as + the mapping keyword. If the key has no mapping, return None. + + :param dict metadata: metadata/submetadata dictionary. + :param str key: The keyword defined in metadata. + :param bool is_regular_key: False when the key defined in metadata + is a variable(starting with '$'). """ mapping_to = key if is_regular_key: @@ -92,12 +94,14 @@ class BaseInstaller(object): return mapping_to def _get_submeta_by_key(self, metadata, key): - """Get submetadata dictionary based on current metadata key. And - determines the input key is a regular string keyword or a variable - keyword defined in metadata, which starts with '$'. + """Get submetadata dictionary. - :param dict metadata: The metadata dictionary. - :param str key: The keyword defined in the metadata. + Based on current metadata key. And + determines the input key is a regular string keyword or a variable + keyword defined in metadata, which starts with '$'. + + :param dict metadata: The metadata dictionary. + :param str key: The keyword defined in the metadata. """ if key in metadata: return (True, metadata[key]) diff --git a/compass/deployment/installers/os_installers/cobbler/cobbler.py b/compass/deployment/installers/os_installers/cobbler/cobbler.py index e31734d6..5de9a580 100644 --- a/compass/deployment/installers/os_installers/cobbler/cobbler.py +++ b/compass/deployment/installers/os_installers/cobbler/cobbler.py @@ -89,10 +89,11 @@ class CobblerInstaller(OSInstaller): def get_supported_oses(self): """get supported os versions. - .. note:: - In cobbler, we treat profile name as the indicator - of os version. It is just a simple indicator - and not accurate. + + note:: + In cobbler, we treat profile name as the indicator + of os version. It is just a simple indicator + and not accurate. """ profiles = self.remote.get_profiles() oses = [] @@ -102,20 +103,21 @@ class CobblerInstaller(OSInstaller): def deploy(self): """Sync cobbler to catch up the latest update config and start to - install OS. Return both cluster and hosts deploy configs. The return - format: - { - "cluster": { - "id": 1, - "deployed_os_config": {}, - }, - "hosts": { - 1($clusterhost_id): { - "deployed_os_config": {...}, - }, - .... - } - } + + install OS. Return both cluster and hosts deploy configs. The return + format: + { + "cluster": { + "id": 1, + "deployed_os_config": {}, + }, + "hosts": { + 1($clusterhost_id): { + "deployed_os_config": {...}, + }, + .... + } + } """ host_ids = self.config_manager.get_hosts_id_list_for_os_installation() if not host_ids: @@ -183,13 +185,14 @@ class CobblerInstaller(OSInstaller): def set_package_installer_config(self, package_configs): """Cobbler can install and configure package installer right after - OS installation compelets by setting package_config info provided - by package installer. - :param dict package_configs: The dict of config generated by package - installer for each clusterhost. The IDs - of clusterhosts are the keys of - package_configs. + OS installation compelets by setting package_config info provided + by package installer. + + :param dict package_configs: The dict of config generated by package + installer for each clusterhost. The IDs + of clusterhosts are the keys of + package_configs. """ self.pk_installer_config = package_configs @@ -309,7 +312,8 @@ class CobblerInstaller(OSInstaller): def delete_single_host(self, host_id): """Delete the host from cobbler server and clean up the installation - progress. + + progress. """ hostname = self.config_manager.get_hostname(host_id) try: @@ -321,8 +325,7 @@ class CobblerInstaller(OSInstaller): logging.exception(ex) def _get_host_tmpl_vars_dict(self, host_id, global_vars_dict, **kwargs): - """Generate template variables dictionary. - """ + """Generate template variables dictionary.""" vars_dict = {} if global_vars_dict: # Set cluster template vars_dict from cluster os_config. diff --git a/compass/deployment/installers/pk_installers/ansible_installer/ansible_installer.py b/compass/deployment/installers/pk_installers/ansible_installer/ansible_installer.py index 1b4fc9d3..8dacc7e9 100644 --- a/compass/deployment/installers/pk_installers/ansible_installer/ansible_installer.py +++ b/compass/deployment/installers/pk_installers/ansible_installer/ansible_installer.py @@ -95,15 +95,15 @@ class AnsibleInstaller(PKInstaller): self.__class__.__name__, self.NAME, self.installer_url) def generate_installer_config(self): - """Render ansible config file by OS installing right after - OS is installed successfully. - The output format: - { - '1'($host_id/clusterhost_id):{ - 'tool': 'ansible', - }, - ..... - } + """Render ansible config file by OS installing. + + The output format: + { + '1'($host_id/clusterhost_id):{ + 'tool': 'ansible', + }, + ..... + } """ host_ids = self.config_manager.get_host_id_list() os_installer_configs = {} @@ -119,21 +119,23 @@ class AnsibleInstaller(PKInstaller): return "-".join((dist_sys_name, cluster_name)) def _get_cluster_tmpl_vars(self): - """Generate template variables dict based on cluster level config. - The vars_dict will be: - { - "baseinfo": { - "id":1, - "name": "cluster01", - ... - }, - "package_config": { - .... //mapped from original package config based on metadata - }, - "role_mapping": { - .... - } - } + """Generate template variables dict + + Generates based on cluster level config. + The vars_dict will be: + { + "baseinfo": { + "id":1, + "name": "cluster01", + ... + }, + "package_config": { + .... //mapped from original package config based on metadata + }, + "role_mapping": { + .... + } + } """ cluster_vars_dict = {} # set cluster basic information to vars_dict @@ -242,7 +244,7 @@ class AnsibleInstaller(PKInstaller): files = self.runner_files for dir in dirs: shutil.copytree( - os.path.join(self.adapter_dir, dir), + os.path.join(self.ansible_dir, dir), os.path.join( ansible_run_destination, dir @@ -289,24 +291,26 @@ class AnsibleInstaller(PKInstaller): self.serialize_config(cfg_config, cfg_destination) def deploy(self): - """Start to deploy a distributed system. Return both cluster and hosts - deployed configs. The return format: - { - "cluster": { - "id": 1, - "deployed_package_config": { - "roles_mapping": {...}, - "service_credentials": {...}, - .... - } - }, - "hosts": { - 1($clusterhost_id): { - "deployed_package_config": {...} - }, - .... - } - } + """Start to deploy a distributed system. + + Return both cluster and hosts deployed configs. + The return format: + { + "cluster": { + "id": 1, + "deployed_package_config": { + "roles_mapping": {...}, + "service_credentials": {...}, + .... + } + }, + "hosts": { + 1($clusterhost_id): { + "deployed_package_config": {...} + }, + .... + } + } """ host_list = self.config_manager.get_host_id_list() if not host_list: diff --git a/compass/deployment/installers/pk_installers/chef_installer/chef_installer.py b/compass/deployment/installers/pk_installers/chef_installer/chef_installer.py index cb35f944..288d0849 100644 --- a/compass/deployment/installers/pk_installers/chef_installer/chef_installer.py +++ b/compass/deployment/installers/pk_installers/chef_installer/chef_installer.py @@ -103,8 +103,9 @@ class ChefInstaller(PKInstaller): return "-".join((dist_sys_name, cluster_name)) def get_create_databag(self, databag_name): - """Get databag object from chef server. Create the databag if it - does not exist. + """Get databag object from chef server. + + Creates the databag if it does not exist. """ import chef databag = None @@ -116,11 +117,13 @@ class ChefInstaller(PKInstaller): return databag def get_create_node(self, node_name, env_name=None): - """Get chef node if existing, otherwise create one and set its - environment. + """Get chef node - :param str node_name: The name for this node. - :param str env_name: The environment name for this node. + Gets the node if existing, otherwise create one and set its + environment. + + :param str node_name: The name for this node. + :param str env_name: The environment name for this node. """ import chef if not self.chef_api: @@ -194,8 +197,9 @@ class ChefInstaller(PKInstaller): def add_roles(self, node, roles): """Add roles to the node. - :param object node: The node object. - :param list roles: The list of roles for this node. + + :param object node: The node object. + :param list roles: The list of roles for this node. """ if node is None: raise Exception("Node is None!") @@ -217,13 +221,15 @@ class ChefInstaller(PKInstaller): logging.debug('Runlist for node %s is %s', node.name, node.run_list) def _generate_node_attributes(self, roles, host_vars_dict): - """Generate node attributes from templates according to its roles. The - templates are named by roles without '-'. Return the dictionary - of attributes defined in the templates. + """Generate node attributes. - :param list roles: The roles for this node, used to load the - specific template. - :param dict host_vars_dict: The dict used in cheetah searchList to + Generates from templates according to its roles. The + templates are named by roles without '-'. Return the dictionary + of attributes defined in the templates. + + :param list roles: The roles for this node, used to load the + specific template. + :param dict host_vars_dict: The dict used in cheetah searchList to render attributes from templates. """ if not roles: @@ -296,12 +302,11 @@ class ChefInstaller(PKInstaller): env.save() def upload_environment(self, env_name, global_vars_dict): - """Generate environment attributes based on the template file and - upload it to chef server. + """Generate environment attributes - :param str env_name: The environment name. - :param dict vars_dict: The dictionary used in cheetah searchList to - render attributes from templates. + :param str env_name: The environment name. + :param dict vars_dict: The dictionary used in cheetah searchList to + render attributes from templates. """ env_config = self._generate_env_attributes(global_vars_dict) env = self.get_create_environment(env_name) @@ -341,14 +346,15 @@ class ChefInstaller(PKInstaller): databagitem.save() def _get_host_tmpl_vars(self, host_id, global_vars_dict): - """Generate templates variables dictionary for cheetah searchList based - on host package config. + """Generate templates variables dictionary. - :param int host_id: The host ID. - :param dict global_vars_dict: The vars_dict got from cluster level - package_config. + For cheetah searchList based on host package config. - The output format is the same as cluster_vars_dict. + :param int host_id: The host ID. + :param dict global_vars_dict: The vars_dict got from cluster level + package_config. + + The output format is the same as cluster_vars_dict. """ host_vars_dict = {} if global_vars_dict: @@ -378,20 +384,21 @@ class ChefInstaller(PKInstaller): def _get_cluster_tmpl_vars(self): """Generate template variables dict based on cluster level config. - The vars_dict will be: - { - "baseinfo": { - "id":1, - "name": "cluster01", - ... - }, - "package_config": { - .... //mapped from original package config based on metadata - }, - "role_mapping": { - .... - } - } + + The vars_dict will be: + { + "baseinfo": { + "id":1, + "name": "cluster01", + ... + }, + "package_config": { + .... //mapped from original package config based on metadata + }, + "role_mapping": { + .... + } + } """ cluster_vars_dict = {} # set cluster basic information to vars_dict @@ -422,23 +429,24 @@ class ChefInstaller(PKInstaller): def deploy(self): """Start to deploy a distributed system. Return both cluster and hosts - deployed configs. The return format: - { - "cluster": { - "id": 1, - "deployed_package_config": { - "roles_mapping": {...}, - "service_credentials": {...}, - .... - } - }, - "hosts": { - 1($clusterhost_id): { - "deployed_package_config": {...} - }, - .... - } - } + + deployed configs. The return format: + { + "cluster": { + "id": 1, + "deployed_package_config": { + "roles_mapping": {...}, + "service_credentials": {...}, + .... + } + }, + "hosts": { + 1($clusterhost_id): { + "deployed_package_config": {...} + }, + .... + } + } """ host_list = self.config_manager.get_host_id_list() if not host_list: @@ -498,19 +506,20 @@ class ChefInstaller(PKInstaller): def generate_installer_config(self): """Render chef config file (client.rb) by OS installing right after - OS is installed successfully. - The output format: - { - '1'($host_id/clusterhost_id):{ - 'tool': 'chef', - 'chef_url': 'https://xxx', - 'chef_client_name': '$host_name', - 'chef_node_name': '$host_name', - 'chef_server_ip': 'xxx',(op) - 'chef_server_dns': 'xxx' (op) - }, - ..... - } + + OS is installed successfully. + The output format: + { + '1'($host_id/clusterhost_id):{ + 'tool': 'chef', + 'chef_url': 'https://xxx', + 'chef_client_name': '$host_name', + 'chef_node_name': '$host_name', + 'chef_server_ip': 'xxx',(op) + 'chef_server_dns': 'xxx' (op) + }, + ..... + } """ host_ids = self.config_manager.get_host_id_list() os_installer_configs = {} @@ -552,7 +561,8 @@ class ChefInstaller(PKInstaller): def get_supported_dist_systems(self): """get target systems from chef. All target_systems for compass will - be stored in the databag called "compass". + + be stored in the databag called "compass". """ databag = self.__get_compass_databag() target_systems = {} diff --git a/compass/hdsdiscovery/base.py b/compass/hdsdiscovery/base.py index ad49ada1..77b3b0b6 100644 --- a/compass/hdsdiscovery/base.py +++ b/compass/hdsdiscovery/base.py @@ -31,7 +31,8 @@ class BaseVendor(object): def is_this_vendor(self, sys_info, **kwargs): """Determine if the host is associated with this vendor. - This function must be implemented by vendor itself + + This function must be implemented by vendor itself """ raise NotImplementedError @@ -48,10 +49,11 @@ class BaseSnmpVendor(BaseVendor): self._matched_names = matched_names def is_this_vendor(self, sys_info, **kwargs): - """Determine if the switch belongs to this vendor by matching the - system information retrieved from the switch. - :param str sys_info: the system information retrieved from a switch - Return True + """Determine if the switch belongs to this vendor. + + Matching the system information retrieved from the switch. + :param str sys_info: the system information retrieved from a switch + Return True """ if sys_info: for name in self._matched_names: @@ -62,14 +64,16 @@ class BaseSnmpVendor(BaseVendor): class BasePlugin(object): - """Extended by vendor's plugin, which processes request and - retrieve info directly from the switch. + """Extended by vendor's plugin. + + This plugin processes request and retrieve info directly from the switch. """ __metaclass__ = ABCMeta def process_data(self, oper='SCAN', **kwargs): """Each vendors will have some plugins to do some operations. - Plugin will process request data and return expected result. + + Plugin will process request data and return expected result. :param oper: operation function name. :param kwargs: key-value pairs of arguments diff --git a/compass/hdsdiscovery/hdmanager.py b/compass/hdsdiscovery/hdmanager.py index 262dc6c2..028d444d 100644 --- a/compass/hdsdiscovery/hdmanager.py +++ b/compass/hdsdiscovery/hdmanager.py @@ -39,8 +39,9 @@ class HDManager(object): self.snmp_sysdescr = 'sysDescr.0' def learn(self, host, credential, vendor, req_obj, oper="SCAN", **kwargs): - """Insert/update record of switch_info. Get expected results from - switch according to sepcific operation. + """Insert/update record of switch_info. + + Get expected results from switch according to sepcific operation. :param req_obj: the object of a machine :param host: switch IP address diff --git a/compass/hdsdiscovery/utils.py b/compass/hdsdiscovery/utils.py index b132c6ed..72adb0af 100644 --- a/compass/hdsdiscovery/utils.py +++ b/compass/hdsdiscovery/utils.py @@ -278,7 +278,8 @@ def snmpwalk_by_cl(host, credential, oid, timeout=5, retries=3): def exec_command(command): """Execute command. - Return a tuple: returncode, output and error message(None if no error). + + Return a tuple: returncode, output and error message(None if no error). """ sub_p = subprocess.Popen(command, shell=True, diff --git a/compass/hdsdiscovery/vendors/appliance/appliance.py b/compass/hdsdiscovery/vendors/appliance/appliance.py index 123fed02..3d66f4e3 100644 --- a/compass/hdsdiscovery/vendors/appliance/appliance.py +++ b/compass/hdsdiscovery/vendors/appliance/appliance.py @@ -17,7 +17,7 @@ from compass.hdsdiscovery import base -#Vendor_loader will load vendor instance by CLASS_NAME +# Vendor_loader will load vendor instance by CLASS_NAME CLASS_NAME = 'Appliance' diff --git a/compass/hdsdiscovery/vendors/appliance/plugins/mac.py b/compass/hdsdiscovery/vendors/appliance/plugins/mac.py index 6fec8abe..cc148810 100644 --- a/compass/hdsdiscovery/vendors/appliance/plugins/mac.py +++ b/compass/hdsdiscovery/vendors/appliance/plugins/mac.py @@ -28,8 +28,8 @@ class Mac(base.BaseSnmpMacPlugin): def __init__(self, host, credential): self.host = host - #self.credential = credential - #return + # self.credential = credential + # return def scan(self): """Implemnets the scan method in BasePlugin class. diff --git a/compass/hdsdiscovery/vendors/arista/arista.py b/compass/hdsdiscovery/vendors/arista/arista.py index 609b9bc6..5eacea1b 100644 --- a/compass/hdsdiscovery/vendors/arista/arista.py +++ b/compass/hdsdiscovery/vendors/arista/arista.py @@ -16,7 +16,7 @@ from compass.hdsdiscovery import base -#Vendor_loader will load vendor instance by CLASS_NAME +# Vendor_loader will load vendor instance by CLASS_NAME CLASS_NAME = 'Arista' diff --git a/compass/hdsdiscovery/vendors/hp/hp.py b/compass/hdsdiscovery/vendors/hp/hp.py index 0fc53534..7ddc5e98 100644 --- a/compass/hdsdiscovery/vendors/hp/hp.py +++ b/compass/hdsdiscovery/vendors/hp/hp.py @@ -16,7 +16,7 @@ from compass.hdsdiscovery import base -#Vendor_loader will load vendor instance by CLASS_NAME +# Vendor_loader will load vendor instance by CLASS_NAME CLASS_NAME = 'Hp' diff --git a/compass/hdsdiscovery/vendors/huawei/huawei.py b/compass/hdsdiscovery/vendors/huawei/huawei.py index 1be789b8..19fd0435 100644 --- a/compass/hdsdiscovery/vendors/huawei/huawei.py +++ b/compass/hdsdiscovery/vendors/huawei/huawei.py @@ -16,7 +16,7 @@ from compass.hdsdiscovery import base -#Vendor_loader will load vendor instance by CLASS_NAME +# Vendor_loader will load vendor instance by CLASS_NAME CLASS_NAME = "Huawei" diff --git a/compass/hdsdiscovery/vendors/ovswitch/ovswitch.py b/compass/hdsdiscovery/vendors/ovswitch/ovswitch.py index 2be82453..4d03328f 100644 --- a/compass/hdsdiscovery/vendors/ovswitch/ovswitch.py +++ b/compass/hdsdiscovery/vendors/ovswitch/ovswitch.py @@ -20,7 +20,7 @@ from compass.hdsdiscovery import base from compass.hdsdiscovery import utils -#Vendor_loader will load vendor instance by CLASS_NAME +# Vendor_loader will load vendor instance by CLASS_NAME CLASS_NAME = "OVSwitch" diff --git a/compass/hdsdiscovery/vendors/pica8/pica8.py b/compass/hdsdiscovery/vendors/pica8/pica8.py index d0c9459a..856817e7 100644 --- a/compass/hdsdiscovery/vendors/pica8/pica8.py +++ b/compass/hdsdiscovery/vendors/pica8/pica8.py @@ -16,7 +16,7 @@ from compass.hdsdiscovery import base -#Vendor_loader will load vendor instance by CLASS_NAME +# Vendor_loader will load vendor instance by CLASS_NAME CLASS_NAME = 'Pica8' diff --git a/compass/tasks/tasks.py b/compass/tasks/tasks.py index 3b0e7c66..26f48dc5 100644 --- a/compass/tasks/tasks.py +++ b/compass/tasks/tasks.py @@ -211,43 +211,37 @@ def clean_package_installer( @celery.task(name='compass.tasks.poweron_host') def poweron_host(host_id): - """Deploy the given cluster. - """ + """Deploy the given cluster.""" pass @celery.task(name='compass.tasks.poweroff_host') def poweroff_host(host_id): - """Deploy the given cluster. - """ + """Deploy the given cluster.""" pass @celery.task(name='compass.tasks.reset_host') def reset_host(host_id): - """Deploy the given cluster. - """ + """Deploy the given cluster.""" pass @celery.task(name='compass.tasks.poweron_machine') def poweron_machine(machine_id): - """Deploy the given cluster. - """ + """Deploy the given cluster.""" pass @celery.task(name='compass.tasks.poweroff_machine') def poweroff_machine(machine_id): - """Deploy the given cluster. - """ + """Deploy the given cluster.""" pass @celery.task(name='compass.tasks.reset_machine') def reset_machine(machine_id): - """Deploy the given cluster. - """ + """Deploy the given cluster.""" pass @@ -256,8 +250,7 @@ def os_installed( host_id, clusterhosts_ready, clusters_os_ready ): - """callback when os is installed. - """ + """callback when os is installed.""" try: install_callback.os_installed( host_id, clusterhosts_ready, @@ -271,8 +264,7 @@ def os_installed( def package_installed( cluster_id, host_id, cluster_ready, host_ready ): - """callback when package is installed. - """ + """callback when package is installed.""" try: install_callback.package_installed( cluster_id, host_id, cluster_ready, host_ready @@ -285,8 +277,7 @@ def package_installed( def cluster_installed( cluster_id, clusterhosts_ready ): - """callback when package is installed. - """ + """callback when package is installed.""" try: install_callback.cluster_installed( cluster_id, clusterhosts_ready @@ -297,8 +288,7 @@ def cluster_installed( @celery.task(name='compass.tasks.update_progress') def update_clusters_progress(): - """Calculate the installing progress of the given cluster. - """ + """Calculate the installing progress of the given cluster.""" logging.info('update_clusters_progress') try: update_progress.update_progress() diff --git a/compass/tests/actions/update_progress/test_update_progress.py b/compass/tests/actions/update_progress/test_update_progress.py index 960602b7..e6808970 100644 --- a/compass/tests/actions/update_progress/test_update_progress.py +++ b/compass/tests/actions/update_progress/test_update_progress.py @@ -123,7 +123,7 @@ class TestProgressCalculator(unittest2.TestCase): if not self.flavor_id: raise Exception('flavor id not found') - #add cluster + # add cluster cluster.add_cluster( adapter_id=self.adapter_id, os_id=self.os_id, @@ -139,7 +139,7 @@ class TestProgressCalculator(unittest2.TestCase): for list_cluster in list_clusters: self.cluster_id = list_cluster['id'] - #add switch + # add switch switch.add_switch( ip=SWITCH_IP, user=self.user_object, @@ -154,12 +154,12 @@ class TestProgressCalculator(unittest2.TestCase): port='1' ) - #get machine information + # get machine information list_machines = machine.list_machines(user=self.user_object) for list_machine in list_machines: self.machine_id = list_machine['id'] - #add cluster host + # add cluster host cluster.add_cluster_host( self.cluster_id, user=self.user_object, @@ -171,7 +171,7 @@ class TestProgressCalculator(unittest2.TestCase): self.host_id = list_clusterhost['host_id'] self.clusterhost_id = list_clusterhost['clusterhost_id'] - #add subnet + # add subnet network.add_subnet( subnet=SUBNET, user=self.user_object, @@ -182,7 +182,7 @@ class TestProgressCalculator(unittest2.TestCase): for list_subnet in list_subnets: self.subnet_id = list_subnet['id'] - #add host network + # add host network host.add_host_network( self.host_id, user=self.user_object, @@ -192,14 +192,14 @@ class TestProgressCalculator(unittest2.TestCase): is_mgmt=True ) - #get clusterhost + # get clusterhost list_clusterhosts = cluster.list_clusterhosts( user=self.user_object ) for list_clusterhost in list_clusterhosts: self.clusterhost_id = list_clusterhost['id'] - #update host state + # update host state self.list_hosts = host.list_hosts(user=self.user_object) for list_host in self.list_hosts: self.host_id = list_host['id'] @@ -209,14 +209,14 @@ class TestProgressCalculator(unittest2.TestCase): state='INSTALLING' ) - #update cluster state + # update cluster state cluster.update_cluster_state( self.cluster_id, user=self.user_object, state='INSTALLING' ) - #update clusterhost state + # update clusterhost state cluster.update_clusterhost_state( self.clusterhost_id, user=self.user_object, diff --git a/compass/tests/api/test_api.py b/compass/tests/api/test_api.py index f06d5760..22088946 100644 --- a/compass/tests/api/test_api.py +++ b/compass/tests/api/test_api.py @@ -85,7 +85,7 @@ class ApiTestCase(unittest2.TestCase): resp = json.loads(resp) self.token = resp['token'] - #create a cluster + # create a cluster adapter_name, adapter_id, os_id, flavor_id = ( self._get_adapter_info() ) @@ -105,7 +105,7 @@ class ApiTestCase(unittest2.TestCase): data['flavor_id'] = flavor_id self.post(url, data) - #create a switch + # create a switch url = '/switches' datas = [ { @@ -537,7 +537,7 @@ class TestSubnetAPI(ApiTestCase): self.assertEqual(return_value.status_code, 200) self.assertTrue(item in data.items() for item in resp.items()) - # give a non-existed id + # give a non-existed id url = '/subnets/99' data = { 'subnet': '192.168.100.0/24', @@ -813,7 +813,7 @@ class TestHostAPI(ApiTestCase): self.assertEqual([], resp) def test_show_host(self): - #show a host successfully + # show a host successfully url = '/hosts/1' return_value = self.get(url) resp = json.loads(return_value.get_data()) diff --git a/compass/tests/db/api/test_cluster.py b/compass/tests/db/api/test_cluster.py index 06fe0bf2..a76adeb5 100644 --- a/compass/tests/db/api/test_cluster.py +++ b/compass/tests/db/api/test_cluster.py @@ -408,7 +408,7 @@ class TestUpdateCluster(ClusterTestCase): name='cluster_editable' ) - #reinstall + # reinstall self.assertRaises( exception.Forbidden, cluster.update_cluster, @@ -441,7 +441,7 @@ class TestDelCluster(ClusterTestCase): self.assertNotEqual(1, del_cluster['id']) def test_is_cluster_editable(self): - #state is INSTALLING + # state is INSTALLING cluster.update_cluster_state( self.cluster_id, user=self.user_object, @@ -1596,7 +1596,7 @@ class TestUpdateClusterHosts(ClusterTestCase): result = item self.assertNotIn(self.host_id[0], result) - #add host + # add host cluster.update_cluster_hosts( self.cluster_id, user=self.user_object, diff --git a/compass/tests/db/api/test_metadata_holder.py b/compass/tests/db/api/test_metadata_holder.py index 8c3149e8..bec8a581 100644 --- a/compass/tests/db/api/test_metadata_holder.py +++ b/compass/tests/db/api/test_metadata_holder.py @@ -55,7 +55,7 @@ class MetadataTestCase(unittest2.TestCase): adapter.load_adapters() metadata.load_metadatas() - #Get a os_id and adapter_id + # Get a os_id and adapter_id self.user_object = ( user_api.get_user_object( setting.COMPASS_ADMIN_EMAIL diff --git a/compass/tests/db/api/test_switch.py b/compass/tests/db/api/test_switch.py index 75a39dba..75837e4c 100644 --- a/compass/tests/db/api/test_switch.py +++ b/compass/tests/db/api/test_switch.py @@ -203,8 +203,9 @@ class TestPatchSwitch(BaseTest): ) expected = { 'credentials': { - 'version': '2c', - 'community': 'public'} + 'version': '2c', + 'community': 'public' + } } self.assertTrue( all(item in patch_switch.items() for item in expected.items()) diff --git a/compass/tests/hdsdiscovery/test_hdsdiscovery.py b/compass/tests/hdsdiscovery/test_hdsdiscovery.py index f93745ac..8d66a528 100755 --- a/compass/tests/hdsdiscovery/test_hdsdiscovery.py +++ b/compass/tests/hdsdiscovery/test_hdsdiscovery.py @@ -55,12 +55,12 @@ class HuaweiTest(unittest2.TestCase): def test_is_this_vendor(self): """test device vendor is haiwei.""" - #Incorrect system information + # Incorrect system information incorrect_sys_info = "xxx" self.assertFalse( self.huawei.is_this_vendor(incorrect_sys_info)) - #Correct vendor + # Correct vendor self.assertTrue( self.huawei.is_this_vendor(self.sys_info)) @@ -86,7 +86,7 @@ class HuaweiMacTest(unittest2.TestCase): self.assertIsNone(self.mac_plugin.process_data('GET')) # SNMP Walk Timeout - #utils.snmpwalk_by_cl = Mock(return_value=None) + # utils.snmpwalk_by_cl = Mock(return_value=None) mock_snmpwalk.return_value = None self.assertIsNone(self.mac_plugin.process_data()) @@ -101,7 +101,7 @@ class HuaweiMacTest(unittest2.TestCase): {"mac": "28:6e:d4:64:c7:4a", "port": "2", "vlan": "88"}, {"mac": "00:0c:29:35:dc:02", "port": "3", "vlan": "88"} ] - #utils.snmpwalk_by_cl = Mock(return_value=mock_snmp_walk_result) + # utils.snmpwalk_by_cl = Mock(return_value=mock_snmp_walk_result) mock_snmpwalk.return_value = mock_snmp_walk_result self.mac_plugin.get_port = Mock() self.mac_plugin.get_port.side_effect = ["1", "2", "3"] @@ -196,14 +196,14 @@ class HDManagerTest(unittest2.TestCase): @patch('compass.hdsdiscovery.hdmanager.HDManager.get_sys_info') def test_is_valid_vendor(self, sys_info_mock): """test is_valid_vendor.""" - #non-exsiting vendor under vendors directory + # non-exsiting vendor under vendors directory self.assertFalse( self.manager.is_valid_vendor(self.correct_host, self.correct_credential, 'xxxx') ) - #No system description retrieved + # No system description retrieved sys_info_mock.return_value = (None, 'TIMEOUT') self.assertFalse( self.manager.is_valid_vendor(self.correct_host, @@ -211,7 +211,7 @@ class HDManagerTest(unittest2.TestCase): 'pica8') ) - #Incorrect vendor name + # Incorrect vendor name sys_info = 'Pica8 XorPlus Platform Software' sys_info_mock.return_value = (sys_info, '') self.assertFalse( @@ -220,7 +220,7 @@ class HDManagerTest(unittest2.TestCase): 'huawei') ) - #Correct vendor name + # Correct vendor name self.assertTrue( self.manager.is_valid_vendor(self.correct_host, self.correct_credential, @@ -229,12 +229,12 @@ class HDManagerTest(unittest2.TestCase): def test_learn(self): """test learn.""" - #non-exsiting plugin + # non-exsiting plugin self.assertIsNone(self.manager.learn(self.correct_host, self.correct_credential, 'huawei', 'xxx')) - #non-existing vendor + # non-existing vendor self.assertIsNone(self.manager.learn(self.correct_host, self.correct_credential, 'xxxx', 'mac')) diff --git a/compass/utils/flags.py b/compass/utils/flags.py index 21a74a7e..a3169f56 100644 --- a/compass/utils/flags.py +++ b/compass/utils/flags.py @@ -61,8 +61,7 @@ OPTIONS = Flags() def init(): - """Init flag parsing. - """ + """Init flag parsing.""" OPTIONS.parse_args() diff --git a/compass/utils/util.py b/compass/utils/util.py index eb160192..1dd1f041 100644 --- a/compass/utils/util.py +++ b/compass/utils/util.py @@ -263,10 +263,12 @@ def get_switch_machines_from_file(filename): def execute_cli_by_ssh(cmd, host, username, password=None, keyfile='/root/.ssh/id_rsa', nowait=False): """SSH to execute script on remote machine + :param host: ip of the remote machine :param username: username to access the remote machine :param password: password to access the remote machine :param cmd: command to execute + """ if not cmd: logging.error("No command found!") diff --git a/conf/templates/ansible_installer/openstack_juno/vars/allinone.tmpl b/conf/templates/ansible_installer/openstack_juno/vars/allinone.tmpl index 1bf28d4b..17f16cc7 100644 --- a/conf/templates/ansible_installer/openstack_juno/vars/allinone.tmpl +++ b/conf/templates/ansible_installer/openstack_juno/vars/allinone.tmpl @@ -70,7 +70,7 @@ EXTERNAL_NETWORK_GATEWAY: 203.0.113.1 FLOATING_IP_START: 203.0.113.101 FLOATING_IP_END: 203.0.113.200 -build_in_image: http://cdn.download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img +build_in_image: http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img build_in_image_name: cirros-0.3.3-x86_64-disk.img physical_device: /dev/sdb diff --git a/conf/templates/ansible_installer/openstack_juno/vars/multinodes.tmpl b/conf/templates/ansible_installer/openstack_juno/vars/multinodes.tmpl index 6165b68e..7dafee43 100644 --- a/conf/templates/ansible_installer/openstack_juno/vars/multinodes.tmpl +++ b/conf/templates/ansible_installer/openstack_juno/vars/multinodes.tmpl @@ -131,7 +131,7 @@ EXTERNAL_NETWORK_GATEWAY: 203.0.113.1 FLOATING_IP_START: 203.0.113.101 FLOATING_IP_END: 203.0.113.200 -build_in_image: http://cdn.download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img +build_in_image: http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img build_in_image_name: cirros-0.3.3-x86_64-disk.img physical_device: /dev/sdb diff --git a/conf/templates/ansible_installer/openstack_juno/vars/single-controller.tmpl b/conf/templates/ansible_installer/openstack_juno/vars/single-controller.tmpl index 5dace92c..f4944634 100644 --- a/conf/templates/ansible_installer/openstack_juno/vars/single-controller.tmpl +++ b/conf/templates/ansible_installer/openstack_juno/vars/single-controller.tmpl @@ -83,7 +83,7 @@ EXTERNAL_NETWORK_GATEWAY: 203.0.113.1 FLOATING_IP_START: 203.0.113.101 FLOATING_IP_END: 203.0.113.200 -build_in_image: http://cdn.download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img +build_in_image: http://download.cirros-cloud.net/0.3.3/cirros-0.3.3-x86_64-disk.img build_in_image_name: cirros-0.3.3-x86_64-disk.img physical_device: /dev/sdb diff --git a/ez_setup.py b/ez_setup.py index 41d35d52..a2d293a4 100644 --- a/ez_setup.py +++ b/ez_setup.py @@ -208,11 +208,13 @@ def download_setuptools(version=DEFAULT_VERSION, download_base=DEFAULT_URL, def _extractall(self, path=".", members=None): - """Extract all members from the archive to the current working - directory and set owner, modification time and permissions on - directories afterwards. `path' specifies a different directory - to extract to. `members' is optional and must be a subset of the - list returned by getmembers(). + """Extract all members. + + From the archive to the current working + directory and set owner, modification time and permissions on + directories afterwards. `path' specifies a different directory + to extract to. `members' is optional and must be a subset of the + list returned by getmembers(). """ import copy import operator diff --git a/test-requirements.txt b/test-requirements.txt index e41f7076..f35aa9a6 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,5 +5,5 @@ testtools>=0.9.32 testrepository>=0.0.17 mimeparse coverage>=3.6 -hacking>=0.8.0,<0.9 +hacking pycrypto<=2.0.1 diff --git a/tox.ini b/tox.ini index 5b714197..b73c7d94 100644 --- a/tox.ini +++ b/tox.ini @@ -31,7 +31,7 @@ commands = python setup.py testr --coverage --testr-args='{posargs}' downloadcache = ~/cache/pip [flake8] -ignore = H302,H304,H233,H803,F401 +ignore = H302,H304,H233,H803,F401,H104,H236,H237,H238 show-source = true builtins = _ exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,tools,build