Skip to content

Commit

Permalink
Merge pull request #2436 from rundeck/issue/2435
Browse files Browse the repository at this point in the history
Fix #2435 fix create job from execution
  • Loading branch information
gschueler committed Apr 14, 2017
2 parents eba2792 + f7e207f commit 71429b8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2067,7 +2067,7 @@ class ScheduledExecutionController extends ControllerBase{
/**
* action to populate the Create form with execution info from a previous (transient) execution
*/
def createFromExecution={
def createFromExecution(){

log.debug("ScheduledExecutionController: create : params: " + params)
Execution execution = Execution.get(params.executionId)
Expand Down Expand Up @@ -2119,7 +2119,7 @@ class ScheduledExecutionController extends ControllerBase{
def wf=WorkflowController.getSessionWorkflow(session,null,props.workflow)
session.editWFPassThru=true

def model=create.call()
def model=create()
render(view:'create',model:model)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -969,4 +969,36 @@ class ScheduledExecutionControllerSpec extends Specification {
response.json == [total: 2, options: [f1: 'filerefid1', f2: 'filerefid2']]

}
def "create from execution"() {
given:

def exec = new Execution(
user: "testuser", project: "testproj", loglevel: 'WARN',
workflow: new Workflow(
commands: [new CommandExec(adhocExecution: true, adhocRemoteString: 'a remote string')]
).save()
).save()
params.executionId = exec.id.toString()
controller.frameworkService = Mock(FrameworkService) {
_ * getAuthContextForSubjectAndProject(_, _) >> Mock(UserAndRolesAuthContext) {
getRoles() >> ['a', 'b']
getUsername() >> 'bob'
}
authorizeProjectResourceAll(_, _, _, _) >> true
authorizeProjectExecutionAll(_, exec, _) >> true
getProjectGlobals(_) >> [:]
}
controller.scheduledExecutionService = Mock(ScheduledExecutionService)
controller.notificationService = Mock(NotificationService) {
1 * listNotificationPlugins() >> [:]
}
controller.orchestratorPluginService = Mock(OrchestratorPluginService) {
1 * listDescriptions()
}
when:
def result = controller.createFromExecution()
then:
response.status == 200
model.scheduledExecution != null
}
}

0 comments on commit 71429b8

Please sign in to comment.