jssimporter / Spruce

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

Issues with JSSConnection #44

Closed TaylorArmstrongB1 closed 4 years ago

TaylorArmstrongB1 commented 4 years ago

New install. Testing both Sprice 2.0.1 and 3.0.0.b1.

JSSImporter 1.05 configured through AutoPKGR, appears to be working as expected.

When running Spruce, recieving the following errors:

Spruce 2.0.1:

Spruce-2.0.1 % ./spruce.py Traceback (most recent call last): File "./spruce.py", line 1955, in <module> main() File "./spruce.py", line 1942, in main JSSConnection.setup(connection) File "./spruce.py", line 207, in setup cls._jss = jss.JSS(**cls._jss_prefs) File "/Library/Python/2.7/site-packages/python_jss-1.5.0-py2.7.egg/jss/jamf_software_server.py", line 144, in __init__ self.distribution_points = distribution_points.DistributionPoints(self) File "/Library/Python/2.7/site-packages/python_jss-1.5.0-py2.7.egg/jss/distribution_points.py", line 89, in __init__ dpt = self._get_auto_configured_dp(repo) File "/Library/Python/2.7/site-packages/python_jss-1.5.0-py2.7.egg/jss/distribution_points.py", line 140, in _get_auto_configured_dp jss=self.jss) File "/Library/Python/2.7/site-packages/python_jss-1.5.0-py2.7.egg/jss/distribution_point.py", line 563, in __init__ self.is_mounted() File "/Library/Python/2.7/site-packages/python_jss-1.5.0-py2.7.egg/jss/distribution_point.py", line 301, in is_mounted valid_mount_strings = self._get_valid_mount_strings() File "/Library/Python/2.7/site-packages/python_jss-1.5.0-py2.7.egg/jss/distribution_point.py", line 379, in _get_valid_mount_strings ip_address = socket.gethostbyname(url) socket.gaierror: [Errno 8] nodename nor servname provided, or not known

Similar error with Spruce 3.0:

Spruce-3.0.0b1 % ./spruce.py JSS: <Jamf-hosted JSS URL> Preferences used: ~/Library/Preferences/com.github.autopkg.plist Traceback (most recent call last): File "./spruce.py", line 2054, in <module> main() File "./spruce.py", line 2041, in main connect(args) File "./spruce.py", line 2024, in connect JSSConnection.setup(connection) File "./spruce.py", line 210, in setup cls._jss = jss.JSS(**cls._jss_prefs) File "/Library/Application Support/JSSImporter/jss/jamf_software_server.py", line 203, in __init__ self.distribution_points = DistributionPoints(self) File "/Library/Application Support/JSSImporter/jss/distribution_points.py", line 89, in __init__ dpt = self._get_auto_configured_dp(repo) File "/Library/Application Support/JSSImporter/jss/distribution_points.py", line 152, in _get_auto_configured_dp jss=self.jss) File "/Library/Application Support/JSSImporter/jss/distribution_point.py", line 528, in __init__ self.is_mounted() File "/Library/Application Support/JSSImporter/jss/distribution_point.py", line 289, in is_mounted valid_mount_strings = self._get_valid_mount_strings() File "/Library/Application Support/JSSImporter/jss/distribution_point.py", line 367, in _get_valid_mount_strings ip_address = socket.gethostbyname(url) socket.gaierror: [Errno 8] nodename nor servname provided, or not known

Using a service account with full read permissions.

grahampugh commented 4 years ago

Can you provide sanitised output of defaults read ~/Library/Preferences/com.github.autopkg.plist?

TaylorArmstrongB1 commented 4 years ago

Thanks Graham.

FWIW, it appears that removing the repo information at least removed the error. It is still running - going to let it finish. (our db is massive, part of the reason I'm testing Spruce as a step towards cleaning things up and purging a lot of useless data).

plist output:

defaults read ~/Library/Preferences/com.github.autopkg.plist

{

"API_PASSWORD" = "<LongandRandom>";
"API_USERNAME" = "API_Read";
"GIT_PATH" = "/usr/local/git/bin/git";
"JSS_REPOS" =     (
);
"JSS_URL" = "https://randomco.jamfcloud.com/";

}

Again, I went into AutoPKGr and removed the DP from the JSSImporter prefs - script is now running, just waiting for it to complete to validate that this actually worked. Still running after 20+ minutes, but our DB is 40+ GB right now. (don't ask, working to fix)

On Mon, Jan 13, 2020 at 3:01 PM Graham Pugh notifications@github.com wrote:

Can you provide sanitised output of defaults read ~/Library/Preferences/com.github.autopkg.plist?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jssimporter/Spruce/issues/44?email_source=notifications&email_token=AN6Q6W6TM3JKQIDOHIKHRI3Q5TCAVA5CNFSM4KGHSCY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEI2CVZA#issuecomment-573844196, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN6Q6W75MA46PKXVM3XTXP3Q5TCAVANCNFSM4KGHSCYQ .

--

Taylor Armstrong MDM Administrator taylor.armstrong@block.one

The information contained in this email is confidential together with any information contained in any attachments to this email. You should not disclose, give or copy the information to anyone other than the person(s) who are named or referenced above. The law may also protect the information as a legally privileged document and/or as a copyright work. If you have received this email and you are not the person named or referenced above, please let the sender know and delete the email from your computer (and, if applicable, your computer system(s) and server(s)). For information about how we process personal data and monitor communications please see our privacy policy https://block.one/privacy-policy/ and for terms of use please see our terms of use here. https://block.one/terms-of-use/

TaylorArmstrongB1 commented 4 years ago

For what it is worth, script finally bombed out, with the following:

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 817, in build_scripts_report

all_policies = jss_connection.Policy(["general",

"scripts"]).retrieve_all()

File "/Library/Application Support/JSSImporter/jss/queryset.py", line 135, in retrieve_all

obj.retrieve()

File "/Library/Application Support/JSSImporter/jss/jssobject.py", line 391, in retrieve

super(Container, self).retrieve()

File "/Library/Application Support/JSSImporter/jss/jssobject.py", line 165, in retrieve

xmldata = self.jss.get(self.url)

File "/Library/Application Support/JSSImporter/jss/jamf_software_server.py", line 318, in get

response = self.session.get(request_url, headers=headers, **kwargs)

File "/Library/Application Support/JSSImporter/requests/sessions.py", line 546, in get

return self.request('GET', url, **kwargs)

File "/Library/Application Support/JSSImporter/requests/sessions.py", line 533, in request

resp = self.send(prep, **send_kwargs)

File "/Library/Application Support/JSSImporter/requests/sessions.py", line 646, in send

r = adapter.send(request, **kwargs)

File "/Library/Application Support/JSSImporter/requests/adapters.py", line 498, in send

raise ConnectionError(err, request=request)

requests.exceptions.ConnectionError: ('Connection aborted.', BadStatusLine('No status line received - the server has closed the connection',))

On Mon, Jan 13, 2020 at 3:31 PM Taylor Armstrong taylor.armstrong@block.one wrote:

Thanks Graham.

FWIW, it appears that removing the repo information at least removed the error. It is still running - going to let it finish. (our db is massive, part of the reason I'm testing Spruce as a step towards cleaning things up and purging a lot of useless data).

plist output:

defaults read ~/Library/Preferences/com.github.autopkg.plist

{

"API_PASSWORD" = "<LongandRandom>";
"API_USERNAME" = "API_Read";
"GIT_PATH" = "/usr/local/git/bin/git";
"JSS_REPOS" =     (
);
"JSS_URL" = "https://randomco.jamfcloud.com/";

}

Again, I went into AutoPKGr and removed the DP from the JSSImporter prefs

  • script is now running, just waiting for it to complete to validate that this actually worked. Still running after 20+ minutes, but our DB is 40+ GB right now. (don't ask, working to fix)

On Mon, Jan 13, 2020 at 3:01 PM Graham Pugh notifications@github.com wrote:

Can you provide sanitised output of defaults read ~/Library/Preferences/com.github.autopkg.plist?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jssimporter/Spruce/issues/44?email_source=notifications&email_token=AN6Q6W6TM3JKQIDOHIKHRI3Q5TCAVA5CNFSM4KGHSCY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEI2CVZA#issuecomment-573844196, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN6Q6W75MA46PKXVM3XTXP3Q5TCAVANCNFSM4KGHSCYQ .

--

Taylor Armstrong MDM Administrator taylor.armstrong@block.one

The information contained in this email is confidential together with any information contained in any attachments to this email. You should not disclose, give or copy the information to anyone other than the person(s) who are named or referenced above. The law may also protect the information as a legally privileged document and/or as a copyright work. If you have received this email and you are not the person named or referenced above, please let the sender know and delete the email from your computer (and, if applicable, your computer system(s) and server(s)). For information about how we process personal data and monitor communications please see our privacy policy https://block.one/privacy-policy/ and for terms of use please see our terms of use here. https://block.one/terms-of-use/

--

Taylor Armstrong MDM Administrator taylor.armstrong@block.one

The information contained in this email is confidential together with any information contained in any attachments to this email. You should not disclose, give or copy the information to anyone other than the person(s) who are named or referenced above. The law may also protect the information as a legally privileged document and/or as a copyright work. If you have received this email and you are not the person named or referenced above, please let the sender know and delete the email from your computer (and, if applicable, your computer system(s) and server(s)). For information about how we process personal data and monitor communications please see our privacy policy https://block.one/privacy-policy/ and for terms of use please see our terms of use here. https://block.one/terms-of-use/

grahampugh commented 4 years ago

I’d rather see the preferences with the repos still in, since that was the part seemingly causing the error.

TaylorArmstrongB1 commented 4 years ago

Will do.

FWIW, Spruce 2.0 does appear to be working with the repo removed, error earlier was Spruce 3.

After putting the repo back in, I have the following in the plist

defaults read ~/Library/Preferences/com.github.autopkg.plist

{

"API_PASSWORD" = "<randomstring>";

"API_USERNAME" = "API_Read";

"GIT_PATH" = "/usr/local/git/bin/git";

"JSS_REPOS" =     (

            {

        name = "FileShare";

        password = Password;

    }

);

"JSS_URL" = "https://SomeCo.jamfcloud.com/";

}

Looks like I see the issue from there, just not sure why the rest of the repo information isn't being pulled in.

On Mon, Jan 13, 2020 at 5:18 PM Graham Pugh notifications@github.com wrote:

I’d rather see the preferences with the repos still in, since that was the part seemingly causing the error.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jssimporter/Spruce/issues/44?email_source=notifications&email_token=AN6Q6W6LFP37JEC3FGPMUPLQ5TSDVA5CNFSM4KGHSCY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEI2QGMQ#issuecomment-573899570, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN6Q6WYAEVHZQWQOTXROMHLQ5TSDVANCNFSM4KGHSCYQ .

--

Taylor Armstrong MDM Administrator taylor.armstrong@block.one

The information contained in this email is confidential together with any information contained in any attachments to this email. You should not disclose, give or copy the information to anyone other than the person(s) who are named or referenced above. The law may also protect the information as a legally privileged document and/or as a copyright work. If you have received this email and you are not the person named or referenced above, please let the sender know and delete the email from your computer (and, if applicable, your computer system(s) and server(s)). For information about how we process personal data and monitor communications please see our privacy policy https://block.one/privacy-policy/ and for terms of use please see our terms of use here. https://block.one/terms-of-use/

grahampugh commented 4 years ago

Can I clarify that you are using Jamf Cloud but a local SMB distribution point? This stuff might be irrelevant, as I guess the repo info should not be used by Spruce, but since it’s all tied up in python-jss, it might be.

TaylorArmstrongB1 commented 4 years ago

Correct. Cloud-hosted, local repo on a synology.

In all honesty, we're not even using the repo at this stage, so it shouldn't affect results, but appears that the code is looking to validate it.

On Tue, Jan 14, 2020 at 1:45 AM Graham Pugh notifications@github.com wrote:

Can I clarify that you are using Jamf Cloud but a local SMB distribution point? This stuff might be irrelevant, as I guess the repo info should not be used by Spruce, but since it’s all tied up in python-jss, it might be.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/jssimporter/Spruce/issues/44?email_source=notifications&email_token=AN6Q6W4RHZBAU7EIHKRNNOTQ5VNQ5A5CNFSM4KGHSCY2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEI3PYAY#issuecomment-574028803, or unsubscribe https://github.com/notifications/unsubscribe-auth/AN6Q6W6U7PAOWYUALCFQCFLQ5VNQ5ANCNFSM4KGHSCYQ .

--

Taylor Armstrong MDM Administrator taylor.armstrong@block.one

The information contained in this email is confidential together with any information contained in any attachments to this email. You should not disclose, give or copy the information to anyone other than the person(s) who are named or referenced above. The law may also protect the information as a legally privileged document and/or as a copyright work. If you have received this email and you are not the person named or referenced above, please let the sender know and delete the email from your computer (and, if applicable, your computer system(s) and server(s)). For information about how we process personal data and monitor communications please see our privacy policy https://block.one/privacy-policy/ and for terms of use please see our terms of use here. https://block.one/terms-of-use/

aarondavidpolley commented 4 years ago

FWIW I was seeing this until I pulled out a distro point from ~/Library/Preferences/com.github.autopkg.plist that belongs to a different Jamf Pro server (UAT vs PROD in a particular environment). Leaving the 2 PROD ones in while connecting to PROD was fine.

aaron.polley@CN-C02V918LHTDD Spruce-3.0.0b1 % ./spruce.py -c    
WARNING: Executing a script that is loading libcrypto in an unsafe way. This will fail in a future version of macOS. Set the LIBRESSL_REDIRECT_STUB_ABORT=1 in the environment to force this into an error.
JSS: https://jss.myjss.com:8443
Preferences used: ~/Library/Preferences/com.github.autopkg.plist
Traceback (most recent call last):
  File "./spruce.py", line 2054, in <module>
    main()
  File "./spruce.py", line 2041, in main
    connect(args)
  File "./spruce.py", line 2024, in connect
    JSSConnection.setup(connection)
  File "./spruce.py", line 210, in setup
    cls._jss = jss.JSS(**cls._jss_prefs)
  File "/Library/Application Support/JSSImporter/jss/jamf_software_server.py", line 203, in __init__
    self.distribution_points = DistributionPoints(self)
  File "/Library/Application Support/JSSImporter/jss/distribution_points.py", line 89, in __init__
    dpt = self._get_auto_configured_dp(repo)
  File "/Library/Application Support/JSSImporter/jss/distribution_points.py", line 157, in _get_auto_configured_dp
    repo["name"]))
ValueError: Error auto-configuring distribution point 'distro.myjss.com'!
aarondavidpolley commented 4 years ago

Nevermind, looks like I have other problems. I'll make sure I'm on the latest AutoPkg/JSSImporter/python JSS and then circle back


aaron.polley@CN-C02V918LHTDD ~ % spruce3.py   
WARNING: Executing a script that is loading libcrypto in an unsafe way. This will fail in a future version of macOS. Set the LIBRESSL_REDIRECT_STUB_ABORT=1 in the environment to force this into an error.
JSS: https://jss.myjss.com:8443
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 "/usr/local/bin/spruce3.py", line 2054, in <module>
    main()
  File "/usr/local/bin/spruce3.py", line 2050, in main
    run_reports(args)
  File "/usr/local/bin/spruce3.py", line 1829, in run_reports
    results.append(func(**args_dict))
  File "/usr/local/bin/spruce3.py", line 1201, in build_apps_report
    session = requests.session()
NameError: global name 'requests' is not defined
aarondavidpolley commented 4 years ago

ok... with everything updated I have produced a report, but all of the emojis are In the format of:

N{evergreen tree}  Computer Report \N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree}\N{evergreen tree} 
grahampugh commented 4 years ago

The emoji problem should be fixed in 3.0.0b3. Also the length of the histograms were far too long, I don't think the calculations of columns took into account that emoji are far wider than normal characters. So, I divided the length of all bars by 3 which seems to make the bars fit better.