Package com.dtolabs.rundeck.core.common

Examples of com.dtolabs.rundeck.core.common.INodeEntry


        return filters;
    }

    private void mapInstances(final NodeSetImpl nodeSet, final Set<Instance> instances) {
        for (final Instance inst : instances) {
            final INodeEntry iNodeEntry;
            try {
                iNodeEntry = InstanceToNodeMapper.instanceToNode(inst, mapping);
                if (null != iNodeEntry) {
                    nodeSet.putNode(iNodeEntry);
                }
View Full Code Here


        }
    }

    public void beginWorkflowExecution(StepExecutionContext executionContext, WorkflowExecutionItem item) {
        StepContextId currentStep = stepContext.getCurrentStep();
        INodeEntry currentNode = stepContext.getCurrentNode();
        if(null!= currentNode && null != currentStep) {
            //if already node context, begin a parameterized sub workflow
            //change step context to include node name parameter for the step id
            HashMap<String, String> params = new HashMap<String, String>();
            params.put("node", currentNode.getNodename());
            stepContext.beginStepContext(StateUtils.stepContextId(currentStep.getStep(),
                    !currentStep.getAspect().isMain(),params));
        }
        stepContext.beginContext();
        List<Pair<StepContextId, INodeEntry>> currentContext = stepContext.getCurrentContextPairs();
View Full Code Here

    private StepStateChange createStepStateChange(ExecutionState executionState) {
        return createStepStateChange(executionState, null);
    }
    private StepStateChange createStepStateChange(ExecutionState executionState, Map metadata) {
        INodeEntry currentNode = stepContext.getCurrentNode();

        return StateUtils.stepStateChange(StateUtils.stepState(executionState,metadata), null != currentNode ? currentNode
                .getNodename() : null);
    }
View Full Code Here

        return StateUtils.stepStateChange(StateUtils.stepState(executionState,metadata), null != currentNode ? currentNode
                .getNodename() : null);
    }
    private StepStateChange createStepStateChange(StepExecutionResult result){
        INodeEntry currentNode = stepContext.getCurrentNode();
        return createStepStateChange(result, currentNode);
    }
View Full Code Here

                .getNodeRankAttribute(),
                context.isNodeRankOrderAscending());
        //reorder based on configured rank property and order

        NodeStepException caught = null;
        INodeEntry failedNode = null;
        for (final INodeEntry node : nodes1) {
            if (thread.isInterrupted()
                || thread instanceof ServiceThreadBase && ((ServiceThreadBase) thread).isAborted()) {
                interrupted = true;
                break;
            }
            context.getExecutionListener().log(Constants.DEBUG_LEVEL,
                                               "Executing command on node: " + node.getNodename() + ", "
                                               + node.toString());
            try {

                if (thread.isInterrupted()
                    || thread instanceof ServiceThreadBase && ((ServiceThreadBase) thread).isAborted()) {
                    interrupted = true;
                    break;
                }
                final NodeStepResult result;

                //execute the step or dispatchable
                if (null != item) {
                    result = framework.getExecutionService().executeNodeStep(context, item, node);
                } else {
                    result = toDispatch.dispatch(context, node);

                }
                resultMap.put(node.getNodename(), result);
                if (!result.isSuccess()) {
                    success = false;
//                    context.getExecutionListener().log(Constants.ERR_LEVEL,
//                        "Failed execution for node " + node.getNodename() + ": " + result);
                    failures.put(node.getNodename(), result);
                    if (!keepgoing) {
                        failedNode = node;
                        break;
                    }
                } else {
                    nodeNames.remove(node.getNodename());
                }
            } catch (NodeStepException e) {
                success = false;
                failures.put(node.getNodename(),
                             new NodeStepResultImpl(e, e.getFailureReason(), e.getMessage(), node)
                );
                context.getExecutionListener().log(Constants.ERR_LEVEL,
                                                   "Failed dispatching to node " + node.getNodename() + ": "
                                                   + e.getMessage());

                final StringWriter stringWriter = new StringWriter();
                e.printStackTrace(new PrintWriter(stringWriter));
                context.getExecutionListener().log(Constants.DEBUG_LEVEL,
                                                   "Failed dispatching to node " + node.getNodename() + ": "
                                                   + stringWriter.toString());

                if (!keepgoing) {
                    failedNode = node;
                    caught = e;
                    break;
                }
            }
        }
        if (!keepgoing && failures.size() > 0 && null != failedListener) {
            //tell listener of failed node list
            failedListener.nodesFailed(failures);
        }
        if (!keepgoing && null != caught) {
            throw new DispatcherException(
                "Failed dispatching to node " + failedNode.getNodename() + ": " + caught.getMessage(), caught,
                failedNode);
        }
        if (keepgoing && nodeNames.size() > 0) {
            if (null != failedListener) {
                //tell listener of failed node list
View Full Code Here

                    }
                    failures.get(s).add(interpreterResult);
                }
            } else if (NodeDispatchStepExecutor.isWrappedDispatcherException(o)) {
                DispatcherException e = NodeDispatchStepExecutor.extractDispatcherException(o);
                final INodeEntry node = e.getNode();
                if (null != node) {
                    //dispatch failed for a specific node
                    final String key = node.getNodename();
                    if (!failures.containsKey(key)) {
                        failures.put(key, new ArrayList<StepExecutionResult>());
                    }
                    NodeStepException nodeStepException = e.getNodeStepException();
                    if (null != nodeStepException) {
View Full Code Here

    @Override
    public Map<String, String> getLoggingContext() {
        if (null != delegate) {
            return delegate.getLoggingContext();
        }
        INodeEntry currentNode = stepContext.getCurrentNode();
        List<Pair<StepContextId,INodeEntry>> currentContext = stepContext.getCurrentContextPairs();
        if (null != currentContext || null!=currentNode) {
            final HashMap<String, String> loggingContext = new HashMap<String, String>();
            if (null != currentNode) {
                loggingContext.put("node", currentNode.getNodename());
                loggingContext.put("user", currentNode.extractUserName());
            }
            if (null != currentContext) {
                StepContextId last = currentContext.get(currentContext.size() - 1).getFirst();
                if (last.getStep() > -1) {
                    loggingContext.put("step", Integer.toString(last.getStep()));
View Full Code Here

TOP

Related Classes of com.dtolabs.rundeck.core.common.INodeEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.