jssimporter / JSSImporter

JSSImporter is deprecated. Please see the wiki for alternatives
Apache License 2.0
145 stars 38 forks source link

[1.0.3] Error mounting hidden share #169

Closed LRSFC-DanJ closed 4 years ago

LRSFC-DanJ commented 4 years ago

When running JSSImporter through an AutoPkgr recipe, I receive a generic error when it attempts to mount our SMB distribution point, which is a hidden share with a $ at the end.

While I have seen other threads on here saying "it works if you remove the $", that is not a workaround that we wish to use.

The OS can mount the share no problem, the Python code in mount_shares_better.py can mount the share no problem, and os.path.exists is able to return True, so the problem must lie in python-jss or JSSImporter somewhere.

Our smb distribution point URL is similar to: smb://DOMAIN;serviceaccountusername:***@jds-servername.our.domain.com:445/DistributionPoint$

I can provide this on the command line to "mount" or in "Connect to Server" in Finder and it works fine. Also as mentioned previously, I tried passing it to mount_shares_better and it mounted perfectly.

mount_shares_better.py does return "/Volumes/DistributionPoint$" with no escape characters though, and while os.path.exists appears to understand it anyway, could this be why it doesn't work properly? I notice there's some regex stuff happening in there when looking at mount point strings, could it need regex-style escaping in order for that to work properly?

grahampugh commented 4 years ago

Hi LRSFC-DanJ - I guess that's not a setup that has been tested. Very happy to accept a PR on this if you figure it out. The problem may well lie in python-jss rather than JSSImporter.

LRSFC-DanJ commented 4 years ago

Well, it may take me a while, as I'm not hugely experienced with Python. But so far I can say for sure the problem is not in mount_shares_better.py, I tried that code in an interactive Python session on my Mac at work and it was able to successfully mount our DP share and returned /Volumes/DistributionPoint$.

So the problem is somewhere "above" that, in something that is calling that function or making use of that result.

Is there a way to enable some kind of debug logging at all?

LRSFC-DanJ commented 4 years ago

Had a friend with more experience look at it. Turns out the fix is incredibly simple.

share_name = quote(self.connection["share_name"], safe="~()*!.'$")

In distribution_point.py, just add in the dollar symbol in that "safe" character list.

grahampugh commented 4 years ago

Hi @LRSFC-DanJ, since we now bundle in python-jss with the JSSImporter installer package, I have incorporated the change into release 1.0.5 of JSSImporter.

Can you check it out and make sure it meets your needs? I ran the new version without a problem, so if it fixes your needs, I'll switch it from pre-release to full release so it gets picked up by AutoPkgr etc.

https://github.com/jssimporter/JSSImporter/releases/tag/v1.0.5

LRSFC-DanJ commented 4 years ago

Thanks for releasing a fixed version. I've installed it but unfortunately my AutoPkgr seems to be playing up now (it doesn't respond when I try to open it) so I might have to give it another go tomorrow.

LRSFC-DanJ commented 4 years ago

I've had to reset my virtual machine and reinstall AutoPkgr and the new JSSImporter from scratch.

After doing that, AutoPkgr picked up the new manually installed JSSImporter version and appears to be working perfectly - I just used it to create a new Google Chrome package which did not bring up any errors.

grahampugh commented 4 years ago

Great. I've pushed 1.0.5 to latest release.