'Copy XML and the jar_path files from Java or MR actions to the deployment directory.
This should run as the workflow user.'

def _copy_files(self, deployment_dir, oozie_xml, oozie_properties):

    self._create_file(deployment_dir, self.job.XML_FILE_NAME, oozie_xml)
    self._create_file(deployment_dir, 'job.properties', data='\n'.join([('%s=%s' % (key, val)) for (key, val) in oozie_properties.iteritems()]))
    files = []
    lib_path = self.fs.join(deployment_dir, 'lib')
    if hasattr(self.job, 'nodes'):
        for node in self.job.nodes:
            jar_path = node.data['properties'].get('jar_path')
            if jar_path:
                if (not jar_path.startswith('/')):
                    jar_path = self.fs.join(self.job.deployment_dir, jar_path)
                if (not jar_path.startswith(lib_path)):
                    files.append(jar_path)
    if USE_LIBPATH_FOR_JARS.get():
        if files:
            files = list(set(files))
            LOG.debug(('Adding    to    oozie.libpath    %s' % files))
            if self.properties.get('oozie.libpath'):
                files.append(self.properties['oozie.libpath'])
            self.properties['oozie.libpath'] = ','.join(files)
    elif files:
        for jar_file in files:
            LOG.debug(('Updating    %s' % jar_file))
            jar_lib_path = self.fs.join(lib_path, self.fs.basename(jar_file))
            if (self.fs.exists(jar_lib_path) and self.fs.exists(jar_file)):
                stat_src = self.fs.stats(jar_file)
                stat_dest = self.fs.stats(jar_lib_path)
                if (stat_src.fileId != stat_dest.fileId):
                    self.fs.remove(jar_lib_path, skip_trash=True)
            self.fs.copyfile(jar_file, jar_lib_path)
