def submodule_update(git_path, module, dest, track_submodules, force=False):
 params = get_submodule_update_params(module, git_path, dest)
 if (not os.path.exists(os.path.join(dest, '.gitmodules'))):
  return (0, '', '')
 cmd = [git_path, 'submodule', 'sync']
 (rc, out, err) = module.run_command(cmd, check_rc=True, cwd=dest)
 if (('remote' in params) and track_submodules):
  cmd = [git_path, 'submodule', 'update', '--init', '--recursive', '--remote']
 else:
  cmd = [git_path, 'submodule', 'update', '--init', '--recursive']
 if force:
  cmd.append('--force')
 (rc, out, err) = module.run_command(cmd, cwd=dest)
 if (rc != 0):
  module.fail_json(msg=(('Failed to init/update submodules: %s' % out) + err))
 return (rc, out, err)

def submodule_update ( git_path , module , dest , track_submodules , force = False ) : params = get_submodule_update_params ( module , git_path , dest ) if ( not os . path . exists ( os . path . join ( dest , '.gitmodules' ) ) ) : return ( 0 , '' , '' ) cmd = [ git_path , 'submodule' , 'sync' ] ( rc , out , err ) = module . run_command ( cmd , check_rc = True , cwd = dest ) if ( ( 'remote' in params ) and track_submodules ) : cmd = [ git_path , 'submodule' , 'update' , '--init' , '--recursive' , '--remote' ] else : cmd = [ git_path , 'submodule' , 'update' , '--init' , '--recursive' ] if force : cmd . append ( '--force' ) ( rc , out , err ) = module . run_command ( cmd , cwd = dest ) if ( rc != 0 ) : module . fail_json ( msg = ( ( 'Failed to init/update submodules: %s' % out ) + err ) ) return ( rc , out , err )
init and update any submodules .