The built-in Git sync function in PSU is not staging (and committing/pushing) files. If I go onto the PSU server and open a Git client, I can see all of the modified files in an unstaged state. I can manually stage/commit/push the files, but that defeats the point. I had been using a Bash script to automate the Git sync processes because of issues like this with past versions of PSU, but decided to give it another shot only to see it’s still not working right for some reason. Any ideas?
If I can get some help figuring out why our file modifications/additions/deletions are not being seen by PSU for it to then stage/commit/push them, that would likely allow me to use the built-in Git sync again.
The issue seems to be largely (if not entirely) limited to a script we use that downloads config files from some of our clients’ firewalls, and it stores these files directly in PSU’s repository folder. The way the script is designed, it overwrites any already-existing file for the particular unit. If I make a change to any of those files WITHIN PSU (like, using the script editor interface), and save those changes, it sees the file has been modified and the Git sync works, so the Git functionality is not completely broken - it seems to just be a problem of HOW we’re changing the files in the repository.
git pull
if conflicted, update git sync status to conflicted and stop sync
git push
git diff-tree
re-run configuration files that have changes to update resources
We don’t do a stage or commit during the git sync. If you are doing changes outside of the API or admin console, you will have to do that manually.
It’s the $WebRequest.Content | Out-File -FilePath $XMLGit line that saves the output to a file inside of the PSU repository.
Are you saying that because we’re not writing the file directly inside of PSU (we’re doing it inside of PSU as a scheduled job that runs the script, which is also inside of PSU), that PSU has no idea that a file has been changed and to include it in the Git sync?
I see. Thanks for clarifying the way you’ve got PSU designed to do the Git syncing, and the workaround. I’ll give that a shot instead of using the Bash script.
Edit: The addition of the git commands at the end of the script did resolve the problem of PSU not seeing the changes, however I also had to add safecrlf = false under the [core] section of .git/config to prevent the job in PSU from displaying the warning message CRLF will be replaced by LF the next time Git touches it while still allowing it to make that EoL modification.