Honestpuck / scriptorium

A utility for managing the scripts in Jamf Pro
MIT License
54 stars 6 forks source link

Unable to commit and push a file after editing it #6

Closed akashrpatel closed 3 years ago

akashrpatel commented 3 years ago

Geting an error with the path, it should be: /Users/akashpatel/gitrepos/jamf/scripts/text/ not Users/akashpatel/gitrepos/jamf/scripts/text//scripts/text/

Traceback (most recent call last): File "/usr/local/bin/scriptorium", line 782, in Scripts.main() File "/usr/local/bin/scriptorium", line 776, in main args.func(args, jpc) File "/usr/local/bin/scriptorium", line 439, in do_commit lst = Scripts.do_up(args, jpc) File "/usr/local/bin/scriptorium", line 598, in do_up scrpt = txt_file.read_text() File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1256, in read_text with self.open(mode='r', encoding=encoding, errors=errors) as f: File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1242, in open return io.open(self, mode, buffering, encoding, errors, newline, File "/usr/local/Cellar/python@3.9/3.9.6/Frameworks/Python.framework/Versions/3.9/lib/python3.9/pathlib.py", line 1110, in _opener return self._accessor.open(self, flags, mode) FileNotFoundError: [Errno 2] No such file or directory: '/Users/akashpatel/gitrepos/jamf/scripts/text/scripts/text/FortiClient - Update VPN Plist for Certificate Authentication'

Honestpuck commented 3 years ago

Could you please run the command git version? It would also be useful to know which version of macOS you are running. In the text directory run the command git diff --name-only -z

akashrpatel commented 3 years ago

git version 2.30.1 (Apple Git-130)

Big Sur 11.6

result of git diff --name-only -z: scripts/text/FortiClient - Update VPN Plist for Certificate Authentication^@

Honestpuck commented 3 years ago

OK, so there's the problem. You are getting part of the path picked up by git diff.

Are you running scriptorium while in the directory /Users/akashpatel/gitrepos/jamf/scripts/text/? That's the recommended method. Check out https://github.com/Honestpuck/scriptorium#work-practices

If. you are can you then try installing the latest git via Homebrew and see if it makes a difference.

akashrpatel commented 3 years ago

I ran from the /Users/akashpatel/gitrepos/jamf/scripts/text/ and i get the same issue it's still looking for the file in /scripts/text/scripts/text/ directory.

I modified another file and this is error, same as previous: FileNotFoundError: [Errno 2] No such file or directory: '/Users/akashpatel/gitrepos/jamf/scripts/text/scripts/text/CIS: Inactivity Interval Is Set To 20 Minutes Or Less For The Screen Saver'

I updated git with Homebrew, git version 2.33.0. Same error.

Honestpuck commented 3 years ago

The problem I have is that I can't duplicate your error.

Do you have a .git directory in the text directory? What have you set txt_dir to? What is the output of git status?

akashrpatel commented 3 years ago

here is no .git dir in the text dir. there is .git in the jamf dir.

Running git status displays: On branch master Your branch is up to date with 'origin/master'.

Changes not staged for commit: (use "git add ..." to update what will be committed) (use "git restore ..." to discard changes in working directory) modified: CIS: Inactivity Interval Is Set To 20 Minutes Or Less For The Screen Saver modified: FortiClient - Update VPN Plist for Certificate Authentication

no changes added to commit (use "git add" and/or "git commit -a")

akashrpatel commented 3 years ago

i think i know what the problem is...i created text and xml as directories in the jamf/script repo. I did not create text and xml as repos themselves.

Honestpuck commented 3 years ago

I thought it was something to do with where the repos are created. I had a feeling.