Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #4786 page error for missing plugin #4812

Merged
merged 2 commits into from May 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -790,7 +790,7 @@ class FrameworkService implements ApplicationContextAware, AuthContextProcessor,
*/
def Description getNodeStepPluginDescription(String type) throws MissingProviderException {
final described = pluginService.getPluginDescriptor(type, rundeckFramework.getNodeStepExecutorService())
described.description
described?.description
}
/**
* Return step plugin description of a certain type
Expand All @@ -800,7 +800,7 @@ class FrameworkService implements ApplicationContextAware, AuthContextProcessor,
*/
def Description getStepPluginDescription(String type) throws MissingProviderException{
final described = pluginService.getPluginDescriptor(type, rundeckFramework.getStepExecutionService())
described.description
described?.description
}

/**
Expand Down
Expand Up @@ -25,7 +25,10 @@ import com.dtolabs.rundeck.core.common.IRundeckProjectConfig
import com.dtolabs.rundeck.core.common.NodeEntryImpl
import com.dtolabs.rundeck.core.common.ProjectManager
import com.dtolabs.rundeck.core.common.PropertyRetriever
import com.dtolabs.rundeck.core.execution.workflow.steps.StepExecutionService
import com.dtolabs.rundeck.core.execution.workflow.steps.node.NodeStepExecutionService
import com.dtolabs.rundeck.core.plugins.DescribedPlugin
import com.dtolabs.rundeck.core.plugins.PluggableProviderService
import com.dtolabs.rundeck.core.plugins.configuration.Description
import com.dtolabs.rundeck.core.plugins.configuration.DynamicProperties
import com.dtolabs.rundeck.core.plugins.configuration.Property
Expand All @@ -35,6 +38,7 @@ import com.dtolabs.rundeck.plugins.util.PropertyBuilder
import grails.test.mixin.TestFor
import org.rundeck.app.spi.Services
import org.rundeck.core.projects.ProjectConfigurable
import rundeck.PluginStep
import spock.lang.Specification
import spock.lang.Unroll

Expand Down Expand Up @@ -452,4 +456,35 @@ class FrameworkServiceSpec extends Specification {
pluga == ['a', 'b', 'c']
plugb == []
}

@Unroll
def "get plugin description for step item nodeStep #nodeStep description #descriptor"() {
given:
service.rundeckFramework = Mock(Framework)
service.pluginService = Mock(PluginService)
def step = new PluginStep(type: 'atype', nodeStep: nodeStep)
def nodeStepService = Mock(NodeStepExecutionService)
def wfStepService = Mock(StepExecutionService)
def desc = DescriptionBuilder.builder().name('atype').build()
when:
def result = service.getPluginDescriptionForItem(step)
then:
if (nodeStep) {
1 * service.rundeckFramework.getNodeStepExecutorService() >> nodeStepService
1 * service.pluginService.getPluginDescriptor('atype', nodeStepService) >>
(descriptor ? new DescribedPlugin(_, desc, 'atype') : null)
} else {
1 * service.rundeckFramework.getStepExecutionService() >> wfStepService
1 * service.pluginService.getPluginDescriptor('atype', wfStepService) >>
(descriptor ? new DescribedPlugin(_, desc, 'atype') : null)
}
result == (descriptor ? desc : null)

where:
nodeStep | descriptor
true | true
true | false
false | true
false | false
}
}