jssimporter / Spruce

Spruce is deprecated. Please see the wiki for alternatives.
GNU General Public License v3.0
148 stars 22 forks source link

Testing branch - Mobile apps report fails due to requests module not imported #40

Closed jwrn3 closed 2 years ago

jwrn3 commented 5 years ago

Just trying the Testing branch (db4ce4c) and when either running all reports or just the mobile apps report (-b, --apps) I get the following:

iMac:Spruce jwrn3 % ./spruce.py -b
JSS: https://jss.blah.com:8443
Preferences used: ~/Library/Preferences/com.github.autopkg.plist
🌲  Building: Mobile Apps... 🌲
Traceback (most recent call last):
  File "./spruce.py", line 2054, in <module>
    main()
  File "./spruce.py", line 2050, in main
    run_reports(args)
  File "./spruce.py", line 1829, in run_reports
    results.append(func(**args_dict))
  File "./spruce.py", line 1201, in build_apps_report
    session = requests.session()
NameError: global name 'requests' is not defined

All other reports are fine.

grahampugh commented 5 years ago

@jwrn3 You should install JSSImporter or the latest python-jss to use the latest Spruce. I'm guessing you've got an old python-jss that doesn't include requests.

jwrn3 commented 5 years ago

It's still an issue for me using 3.0.0b1. I've installed JSSImporter 1.0.2b6 just to make sure but get the same issue with importing requests. Requests et al are all there in the JSSImporter directory:

namaste:JSSImporter jwrn3 % ls -al /Library/Application\ Support/JSSImporter
total 0
drwxr-xr-x  16 root  wheel   512 22 Aug 18:13 .
drwxr-xr-x  50 root  admin  1600 30 Aug 12:10 ..
drwxr-xr-x   3 root  wheel    96 22 Aug 18:13 bin
drwxr-xr-x  92 root  wheel  2944 22 Aug 18:13 boto
drwxr-xr-x   7 root  wheel   224 22 Aug 18:13 boto-2.49.0.dist-info
drwxr-xr-x   9 root  wheel   288 22 Aug 18:13 certifi
drwxr-xr-x  10 root  wheel   320 22 Aug 18:13 certifi-2019.6.16.dist-info
drwxr-xr-x  81 root  wheel  2592 22 Aug 18:13 chardet
drwxr-xr-x  10 root  wheel   320 22 Aug 18:13 chardet-3.0.4.dist-info
drwxr-xr-x  18 root  wheel   576 22 Aug 18:13 idna
drwxr-xr-x   8 root  wheel   256 22 Aug 18:13 idna-2.8.dist-info
drwxr-xr-x  26 root  wheel   832 22 Aug 18:13 jss
drwxr-xr-x  38 root  wheel  1216 22 Aug 18:13 requests
drwxr-xr-x   8 root  wheel   256 22 Aug 18:13 requests-2.22.0.dist-info
drwxr-xr-x  25 root  wheel   800 22 Aug 18:13 urllib3
drwxr-xr-x   8 root  wheel   256 22 Aug 18:13 urllib3-1.25.3.dist-info

I've replicated it on another Mac by simply copying my com.github.autopkg.plist file into ~/Lib/Prefs and then installing JSSImporter 1.0.2b6. Running Spruce-3.0.0b1 gave me the same error.

It's not a big issue and if you'd like me to do any testing then please let me know...

grahampugh commented 5 years ago

Thanks for that. My guess is that I haven't tested it on a device that doesn't already have requests installed, and that I should redirect the path to requests to /Library/Application\ Support/JSSImporter. I'll try that and let you know.

chriszanf commented 4 years ago

I have the same issue but have the lastest version of Spruce (3.0.0b1), JSSImporter (1.0.5) and Python-JSS (2.0.0 pre-release)

Preferences used: ~/Library/Preferences/com.github.autopkg.plist
🌲 Building: Computer Groups Report... 🌲
🌲 Building: Computer Configuration Profile Report... 🌲
🌲 Building: Mobile Device Configuration Profile Report... 🌲
🌲 Building: Mobile Device Group Report... 🌲
🌲 Building: Computer Report... 🌲
🌲 Building: Mobile Apps... 🌲
Traceback (most recent call last):
File "spruce.py", line 2054, in
main()
File "spruce.py", line 2050, in main
run_reports(args)
File "spruce.py", line 1829, in run_reports
results.append(func(**args_dict))
File "spruce.py", line 1201, in build_apps_report
session = requests.session()
NameError: global name 'requests' is not defined

grahampugh commented 2 years ago

Please try with the latest versions of all dependencies. Reopen if still seeing the problem.