erikng / Cacher

A python script for extracting macOS Caching Server data
Apache License 2.0
134 stars 40 forks source link

Configure Server Does Not Work #28

Closed TSPARR closed 7 years ago

TSPARR commented 7 years ago

This is something I ran into recently while trying to get Cacher working with a new 5.2 server. I've always just manually ran sudo serveradmin settings caching:LogClientIdentity = 1 and had no issues. This time I tried to use sudo Cacher --configureserver. This reports a success, but Cacher never finds any stats. I think this is because --configureserver tries to set this setting with "yes", rather than "1". After manually running the appropriate serveradmin commands, Cacher is working without issue.

Looks like this line is what needs changed: https://github.com/erikng/Cacher/blob/master/Cacher#L636

erikng commented 7 years ago

Interesting. I'll have to validate this but sounds like an easy fix.

On Feb 8, 2017, at 1:43 PM, TSPARR notifications@github.com<mailto:notifications@github.com> wrote:

This is something I ran into recently while trying to get Cacher working with a new 5.2 server. I've always just manually ran sudo serveradmin settings caching:LogClientIdentity = 1 and had no issues. This time I tried to use sudo Cacher --configureserver. This reports a success, but Cacher never finds any stats. I think this is because --configureserver tries to set this setting with "yes", rather than "1". After manually running the appropriate serveradmin commands, Cacher is working without issue.

Looks like this line is what needs changed: https://github.com/erikng/Cacher/blob/master/Cacher#L636

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/erikng/Cacher/issues/28, or mute the threadhttps://github.com/notifications/unsubscribe-auth/AFa_GHDRRpvK4HBFBERmLGrnPY7-1Fg5ks5rajW1gaJpZM4L7ZU0.

TSPARR commented 7 years ago

Actually, it looks like this isn't my root issue. If I run Cacher I receive Cacher did not retrieve any stats for 2017-02-08. If I manually run Cacher --targetdate "2017-02-8" I receive feedback.

erikng commented 7 years ago

I'm going through the issues right now, but according to https://help.apple.com/serverapp/mac/5.2/#/apd5E1AD52E-012B-4A41-8F21-8E9EDA56583A

caching:LogClientIdentity should be entered as yes/no statements as they are boolean values.

Here are the following examples and their results:

sudo serveradmin settings caching:LogClientIdentity = yes
    <key>LogClientIdentity</key>
    <true/>
sudo serveradmin settings caching:LogClientIdentity = 1
    <key>LogClientIdentity</key>
    <integer>1</integer>
sudo serveradmin settings caching:LogClientIdentity = true
    <key>LogClientIdentity</key>
    <string>true</string>

Comparing this result with another key that comes on all installations (LocalSubnetsOnly), it is clear that yes is the correct syntax to use.

    <key>LocalSubnetsOnly</key>
    <true/>
sudo /Applications/Server.app/Contents/ServerRoot/usr/sbin/serveradmin settings caching
caching:ServerRoot = "/Library/Server"
caching:LogClientIdentity = yes
caching:LocalSubnetsOnly = yes
erikng commented 7 years ago

Forgot to say, but I did fix your other issue with the dates.

Fixed as of https://github.com/erikng/Cacher/commit/04a533c98f00faac60161933b08233a18e075aaa