

def copy(name, target, **kwargs):
    "\n    Copy scheduled job to another minion or minions.\n\n    CLI Example:\n\n    .. code-block:: bash\n\n        salt '*' schedule.copy jobname target\n    "
    ret = {
        'comment': [],
        'result': True,
    }
    if (not name):
        ret['comment'] = 'Job name is required.'
        ret['result'] = False
    if (('test' in kwargs) and kwargs['test']):
        ret['comment'] = 'Job: {0} would be copied from schedule.'.format(name)
    else:
        opts_schedule = list_(show_all=True, where='opts', return_yaml=False)
        pillar_schedule = list_(show_all=True, where='pillar', return_yaml=False)
        if (name in opts_schedule):
            schedule_data = opts_schedule[name]
        elif (name in pillar_schedule):
            schedule_data = pillar_schedule[name]
        else:
            ret['comment'] = 'Job {0} does not exist.'.format(name)
            ret['result'] = False
            return ret
        schedule_opts = []
        for (key, value) in six.iteritems(schedule_data):
            temp = '{0}={1}'.format(key, value)
            schedule_opts.append(temp)
        response = __salt__['publish.publish'](target, 'schedule.add', schedule_opts)
        errors = []
        minions = []
        for minion in response:
            minions.append(minion)
            if (not response[minion]):
                errors.append(minion)
        if (not response):
            ret['comment'] = 'no servers answered the published schedule.add command'
            return ret
        elif (len(errors) > 0):
            ret['comment'] = 'the following minions return False'
            ret['minions'] = errors
            return ret
        else:
            ret['result'] = True
            ret['comment'] = 'Copied Job {0} from schedule to minion(s).'.format(name)
            name['minions'] = minions
            return ret
    return ret

dataset/ETHPy150Open saltstack/salt/salt/modules/schedule.py copy/VarMisuse@355/599 `ret`->`name`