Check to see if contents has been specified
Merge pull request #13351 from lyft/fix-nonetype-error-for-file-state

Check to see if contents has been specified
Use an explicit path for the keydir not `getcwd`
Change to an existing directory before importing keyring
Test needs root perms