Skip to content
This repository has been archived by the owner on Dec 7, 2022. It is now read-only.
/ pulp Public archive

Commit

Permalink
PEP-8 some more of Nodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
Randy Barlow committed Oct 1, 2015
1 parent 031fc4b commit 8a69d81
Show file tree
Hide file tree
Showing 20 changed files with 106 additions and 316 deletions.
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,19 @@ docs/_build
*,cover
tags

# KDevelop
.kdev4/
*.kdev4

# Ninja IDE
*.nja

# Sublime
.codeintel

#Rope
# Rope
.ropeproject

# Vagrant
.vagrant
Vagrantfile
13 changes: 1 addition & 12 deletions nodes/child/pulp_node/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
# Copyright (c) 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

from pkgutil import extend_path

__path__ = extend_path(__path__, __name__)
__path__ = extend_path(__path__, __name__)
13 changes: 1 addition & 12 deletions nodes/child/pulp_node/importers/inventory.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
# Copyright (c) 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

from pulp_node import constants


Expand Down Expand Up @@ -109,4 +98,4 @@ def updated_units(self):
child_last_updated = child_unit.get(constants.LAST_UPDATED, 0)
if parent_last_updated > child_last_updated:
updated.append((unit, ref))
return updated
return updated
13 changes: 1 addition & 12 deletions nodes/common/pulp_node/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
# Copyright (c) 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

from pkgutil import extend_path

__path__ = extend_path(__path__, __name__)
__path__ = extend_path(__path__, __name__)
22 changes: 1 addition & 21 deletions nodes/common/pulp_node/conduit.py
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
# Copyright (c) 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

from pulp.plugins.types import database as types_db
from pulp.server.db.model.repository import RepoContentUnit
from pulp.server.config import config as pulp_conf


# --- nodes conduit ----------------------------------------------------------


class NodesConduit(object):

def get_units(self, repo_id):
Expand All @@ -39,9 +25,6 @@ def get_units(self, repo_id):
return UnitsIterator(units, types)


# --- typedef -----------------------------------------------------------------


class Typedef(object):

def __init__(self):
Expand All @@ -55,9 +38,6 @@ def get(self, type_id):
return typedef


# --- iterators ---------------------------------------------------------------


class UnitsIterator:

@staticmethod
Expand Down Expand Up @@ -112,4 +92,4 @@ def __iter__(self):
return self

def __len__(self):
return self.length
return self.length
25 changes: 8 additions & 17 deletions nodes/common/pulp_node/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,15 @@

SCHEMA = (
('main', REQUIRED,
(
('ca_path', REQUIRED, ANY),
('node_certificate', REQUIRED, ANY),
('verify_ssl', REQUIRED, BOOL),
)
),
(('ca_path', REQUIRED, ANY),
('node_certificate', REQUIRED, ANY),
('verify_ssl', REQUIRED, BOOL))),
('oauth', REQUIRED,
(
('user_id', REQUIRED, ANY),
)
),
(('user_id', REQUIRED, ANY),)),
('parent_oauth', REQUIRED,
(
('key', REQUIRED, ANY),
('secret', REQUIRED, ANY),
('user_id', REQUIRED, ANY),
)
),
(('key', REQUIRED, ANY),
('secret', REQUIRED, ANY),
('user_id', REQUIRED, ANY),)),
)


Expand All @@ -55,4 +46,4 @@ def read_config(path=NODE_CONFIGURATION_PATH, validate=True):
config.update(Config(path))
if validate:
config.validate(SCHEMA)
return config.graph()
return config.graph()
14 changes: 2 additions & 12 deletions nodes/common/pulp_node/error.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
# Copyright (c) 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

from gettext import gettext as _


Expand Down Expand Up @@ -128,7 +117,8 @@ class DistributorNotInstalled(NodeError):
'distributor needs to be installed and loaded by restarting httpd.')

def __init__(self, repo_id, type_id):
super(DistributorNotInstalled, self).__init__(self.ERROR_ID, repo_id=repo_id, type_id=type_id)
super(DistributorNotInstalled, self).__init__(self.ERROR_ID, repo_id=repo_id,
type_id=type_id)

def __str__(self):
return self.DESCRIPTION % self.details
Expand Down
18 changes: 1 addition & 17 deletions nodes/common/pulp_node/extension.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,14 @@
# Copyright (c) 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

from gettext import gettext as _

from pulp.bindings.exceptions import NotFoundException

from pulp_node import constants


# --- constants --------------------------------------------------------------


SECTION_NAME = 'node'
SECTION_DESCRIPTION = _('pulp nodes related commands')


# --- utils ------------------------------------------------------------------

def ensure_node_section(cli):
"""
Ensures that the root section of node-related commands exists in the CLI,
Expand Down Expand Up @@ -86,4 +70,4 @@ def missing_resources(exception):
:rtype: tuple
"""
for _type, _id in exception.extra_data['resources'].items():
yield _id, _type
yield _id, _type
22 changes: 2 additions & 20 deletions nodes/common/pulp_node/poller.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,22 @@
# Copyright (c) 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

import httplib
from time import sleep
from gettext import gettext as _
from time import sleep

from pulp.common.constants import CALL_COMPLETE_STATES, CALL_ERROR_STATE


# --- i18m ------------------------------------------------------------------------------


FETCH_TASK_FAILED = _('Fetch task %(t)s, failed: http=%(c)s')
TASK_FAILED = _('Task %(t)s, failed: state=%(s)s')


# --- exceptions ------------------------------------------------------------------------


class TaskFailed(Exception):
pass


class PollingFailed(Exception):
pass


# --- polling ---------------------------------------------------------------------------

class TaskPoller(object):
"""
The task poller is used to poll a running task by ID.
Expand Down
13 changes: 1 addition & 12 deletions nodes/extensions/admin/pulp_node/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
# Copyright (c) 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

from pkgutil import extend_path

__path__ = extend_path(__path__, __name__)
__path__ = extend_path(__path__, __name__)
13 changes: 1 addition & 12 deletions nodes/extensions/admin/pulp_node/extensions/__init__.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
# Copyright (c) 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the implied warranties of MERCHANTABILITY,
# NON-INFRINGEMENT, or FITNESS FOR A PARTICULAR PURPOSE. You should
# have received a copy of GPLv2 along with this software; if not, see
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.

from pkgutil import extend_path

__path__ = extend_path(__path__, __name__)
__path__ = extend_path(__path__, __name__)
Loading

0 comments on commit 8a69d81

Please sign in to comment.