Fix ownership/perms on salt.utils.copyfile()

When salt.utils.copyfile() uses shutil.move() to move the target file to
the destination, the ownership/permissions from the original file that
existed at the destination path are not preserved. For security reasons,
files cached locally and compared to existing files in file.managed
states are created with ownership of root:root (or user:primarygroup, if
the master is running as non-root), with a mode of 600.

Normally, this would not be an issue since
salt.modules.file.check_perms() is invoked to correct the ownership and
permissions. However, recent modifications to that function have
resulted in the ownership/permissions not being modified if these
parameters are passed to check_perms() as None.

Since the user, group, and mode default to None in file.managed states,
if they are not explicitly defined in a state, this results in is the
newly-created file overwriting the old file, and the
ownership/permissions being left untouched.

This commit modifies salt.utils.copyfile() to restore the old file's
ownership and permissions after shutil.move is invoked to replace the
old file with the new one.

Fixes #9527.
Some "DRY" cleanup in the file module

The get_{uid,gid,user,group,mode} functions duplicate a lot of work done
in file.stats. this commit changes file.stats slightly to support
getting uid/gid of broken symlinks (code that was in get_{uid,gid}), and
then uses file.stats to supply the uid, gid, etc. for the get_*
functions.

Additionally, the "follow_symlinks" behavior in file.stats is opposite
from everywhere else in the file module, so the default value for this
parameter has been changed to True, and refs to this function from the
file state has been manually passed as False to preserve backwards
compatibility.
Fix the following crash in a minion when master executes
state.highstate on it.

    2014-01-07 01:45:43,315 [salt.minion      ][INFO    ] User sudo_ubuntu Executing command state.highstate with jid 20140107014542797484
    2014-01-07 01:45:43,332 [salt.minion      ][WARNING ] The minion function caused an exception: Traceback (most recent call last):
      File "/usr/local/lib/python2.7/dist-packages/salt/minion.py", line 626, in _thread_return
        '''
      File "/usr/local/lib/python2.7/dist-packages/salt/modules/state.py", line 237, in highstate
        conflict = running()
      File "/usr/local/lib/python2.7/dist-packages/salt/modules/state.py", line 91, in running
        active = __salt__['saltutil.is_running']('state.*')
      File "/usr/local/lib/python2.7/dist-packages/salt/modules/saltutil.py", line 365, in is_running
        '''
      File "/usr/local/lib/python2.7/dist-packages/salt/modules/saltutil.py", line 396, in running
        continue
    AttributeError: 'module' object has no attribute 'os_is_running'

    2014-01-07 01:45:43,333 [salt.minion      ][INFO    ] Returning information for job: 20140107014542797484
Clarify that execution modules and state modules are not the same thing
Merge pull request #9602 from getlantern/develop

Fix the following crash in a minion when master executes
Merge pull request #9603 from techhat/jcl

Clarify that execution modules and state modules are not the same thing
Merge pull request #9599 from terminalmage/issue9527

Fix ownership/perms on salt.utils.copyfile()
Merge pull request #9600 from terminalmage/file-module-cleanup

Some "DRY" cleanup in the file module
fix for windows masterless read-only highstate.cache.p file
Addresses the issue:  Unable to manage file: stats() got an unexpected keyword argument 'follow_symlinks’
Merge pull request #9610 from thematthopkins/win_file_stats_follow_symlinks_fix

Addresses the issue:  Unable to manage file: stats() got an unexpected keyword argument 'follow_symlinks’
spelling fixes
Merge pull request #9611 from terminalmage/spelling-fixes

spelling fixes
More debug output on cmd.run in case of missing cwd
Fix regression in salt.utils.copyfile()

In pull request #9599, I added code to make salt.utils.copyfile() set
the ownership and permissions of the new file to those of the
pre-existing file. However, this raises an exception when the
destination file doesn't exist, which happens on file.managed states
which are creating new files.

This commit fixes that regression.
Merge pull request #9615 from terminalmage/issue9527

Fix regression in salt.utils.copyfile()
Merge pull request #9612 from Psycojoker/develop

More debug output on cmd.run in case of missing cwd
Fix format strings for python 2.6
Merge pull request #9601 from terminalmage/docs

Replace references to Hydrogen release in docs
Add ruby build configure options to rbenv module

- Allows you to pass in configure options to ruby build environment when
  building rubies via rbenv