Skip to content

Commit

Permalink
Merge 06293cf into 4974bb1
Browse files Browse the repository at this point in the history
  • Loading branch information
TheFriendlyCoder committed May 27, 2019
2 parents 4974bb1 + 06293cf commit b883c1a
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 154 deletions.
96 changes: 0 additions & 96 deletions src/pyjen/exceptions.py

This file was deleted.

15 changes: 8 additions & 7 deletions src/pyjen/plugins/conditionalbuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"""
import xml.etree.ElementTree as ElementTree
from pyjen.utils.plugin_api import find_plugin
from pyjen.exceptions import PluginNotSupportedError
from pyjen.utils.xml_plugin import XMLPlugin


Expand Down Expand Up @@ -79,9 +78,10 @@ def condition(self):
assert node is not None
plugin = find_plugin(node.attrib["class"])
if not plugin:
raise PluginNotSupportedError(
"Conditional build step condition %s not supported by PyJen.",
node.attrib["class"]
raise NotImplementedError(
"Conditional build step condition {0} not supported by PyJen.".format(
node.attrib["class"]
)
)
return plugin(node)

Expand All @@ -92,9 +92,10 @@ def builder(self):
build_step_node = self._root.find("buildStep")
plugin = find_plugin(build_step_node.attrib["class"])
if not plugin:
raise PluginNotSupportedError(
"Build step plugin %s is not supported by PyJen.",
build_step_node.attrib["class"]
raise NotImplementedError(
"Build step plugin {0} is not supported by PyJen.".format(
build_step_node.attrib["class"]
)
)

# We have to reconstruct the XML for the build step from the
Expand Down
38 changes: 2 additions & 36 deletions src/pyjen/plugins/freestylejob.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,40 +3,6 @@
from pyjen.job import Job
from pyjen.utils.jobxml import JobXML
from pyjen.utils.plugin_api import find_plugin
from pyjen.exceptions import PluginNotSupportedError

"""<project>
<description/>
<keepDependencies>false</keepDependencies>
<properties>
<com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty plugin="gitlab-plugin@1.5.12">
<gitLabConnection/>
</com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty>
<com.sonyericsson.rebuild.RebuildSettings plugin="rebuild@1.30">
<autoRebuild>false</autoRebuild>
<rebuildDisabled>false</rebuildDisabled>
</com.sonyericsson.rebuild.RebuildSettings>
<hudson.plugins.throttleconcurrents.ThrottleJobProperty plugin="throttle-concurrents@2.0.1">
<categories class="java.util.concurrent.CopyOnWriteArrayList"/>
<throttleEnabled>false</throttleEnabled>
<throttleOption>project</throttleOption>
<limitOneJobWithMatchingParams>false</limitOneJobWithMatchingParams>
<paramsToUseForLimit/>
</hudson.plugins.throttleconcurrents.ThrottleJobProperty>
</properties>
<scm class="hudson.scm.NullSCM"/>
<assignedNode>qfqwefqwfwfe</assignedNode>
<canRoam>false</canRoam>
<disabled>false</disabled>
<blockBuildWhenDownstreamBuilding>false</blockBuildWhenDownstreamBuilding>
<blockBuildWhenUpstreamBuilding>false</blockBuildWhenUpstreamBuilding>
<triggers/>
<concurrentBuild>false</concurrentBuild>
<builders/>
<publishers/>
<buildWrappers/>
</project>
"""


class FreestyleJob(Job):
Expand Down Expand Up @@ -328,8 +294,8 @@ def scm(self):
node = self._root.find('scm')
plugin_class = find_plugin(node.attrib["class"])
if plugin_class is None:
raise PluginNotSupportedError("SCM XML plugin not found",
node.attrib["class"])
raise NotImplementedError(
"SCM XML plugin not found: " + node.attrib["class"])
return plugin_class(node)

@scm.setter
Expand Down
5 changes: 2 additions & 3 deletions src/pyjen/plugins/pipelinejob.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import xml.etree.ElementTree as ElementTree
from pyjen.utils.jobxml import JobXML
from pyjen.utils.plugin_api import find_plugin
from pyjen.exceptions import PluginNotSupportedError


class PipelineJob(Job):
Expand Down Expand Up @@ -162,8 +161,8 @@ def scm(self):
plugin_name = scm_node.attrib["class"]
plugin = find_plugin(plugin_name)
if plugin is None:
raise PluginNotSupportedError(
"PyJen has no plugin installed for Jenkins plugin ",
raise NotImplementedError(
"PyJen has no plugin installed for Jenkins plugin: " +
plugin_name)
return plugin(scm_node)

Expand Down
5 changes: 2 additions & 3 deletions src/pyjen/plugins/sectionedview.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from pyjen.view import View
from pyjen.utils.viewxml import ViewXML
from pyjen.utils.plugin_api import find_plugin
from pyjen.exceptions import PluginNotSupportedError


class SectionedView(View):
Expand Down Expand Up @@ -82,8 +81,8 @@ def add_section(self, section_type, name):
"""
plugin_class = find_plugin(section_type)
if not plugin_class:
raise PluginNotSupportedError(
"Failed loading Sectioned View section",
raise NotImplementedError(
"Failed loading Sectioned View section: " +
section_type)
new_section = plugin_class.create(name)
new_section.parent = self
Expand Down
5 changes: 2 additions & 3 deletions src/pyjen/queue_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from requests.exceptions import HTTPError
from pyjen.build import Build
from pyjen.utils.plugin_api import find_plugin
from pyjen.exceptions import PluginNotSupportedError


class QueueItem(object):
Expand Down Expand Up @@ -160,8 +159,8 @@ def job(self):
return None
plugin = find_plugin(job_data["_class"])
if plugin is None:
raise PluginNotSupportedError(
"Job plugin not supported.", job_data["_class"])
raise NotImplementedError(
"Job plugin not supported: " + job_data["_class"])
return plugin(self._api.clone(job_data["url"]))

@property
Expand Down
5 changes: 2 additions & 3 deletions src/pyjen/utils/user_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
import platform
from six.moves import configparser
from pyjen.exceptions import InvalidUserParamsError


class JenkinsConfigParser(configparser.ConfigParser): # pylint: disable=too-many-ancestors
Expand Down Expand Up @@ -63,10 +62,10 @@ def get_credentials(self, jenkins_url):
return None

if not temp_username:
raise InvalidUserParamsError(
raise Exception(
"No username specified for password under " + section_name)
if not temp_password:
raise InvalidUserParamsError("No password specified for user " +
raise Exception("No password specified for user " +
temp_username + " under " +
section_name)
return temp_username, temp_password
Expand Down
5 changes: 2 additions & 3 deletions tests/test_user_params.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from pyjen.utils.user_params import JenkinsConfigParser
from pyjen.exceptions import InvalidUserParamsError
import pytest
import os
import platform
Expand Down Expand Up @@ -98,7 +97,7 @@ def test_get_credentials_no_username():
else:
test_obj.readfp(sample_config)

with pytest.raises(InvalidUserParamsError):
with pytest.raises(Exception):
test_obj.get_credentials(test_url)


Expand All @@ -114,7 +113,7 @@ def test_get_credentials_no_password():
else:
test_obj.readfp(sample_config)

with pytest.raises(InvalidUserParamsError):
with pytest.raises(Exception):
test_obj.get_credentials(test_url)


Expand Down

0 comments on commit b883c1a

Please sign in to comment.