Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate package names showing in Jamf Sync #31

Open
mrmte opened this issue Aug 28, 2024 · 11 comments
Open

Duplicate package names showing in Jamf Sync #31

mrmte opened this issue Aug 28, 2024 · 11 comments

Comments

@mrmte
Copy link

mrmte commented Aug 28, 2024

I have duplicate package names showing in Jamf sync ui. When I look at the files on the share everything is normal and don’t show duplicated.

I cannot unfortunately reproduce the issue because I don’t know how this happened.

@HarryStrandJamf
Copy link
Contributor

Thanks for reporting this...I'll keep my eye out for anything that could potentially cause this to happen. From your description, my guess would be that it refreshed the list of files in the UI without deleting the list of items first. If it happens again, try hitting the refresh button (next to Show Log on the top right) and see if that makes it look normal again, and let me know what happens.

@mrmte
Copy link
Author

mrmte commented Oct 7, 2024

Constantly seeing this!

@mrmte
Copy link
Author

mrmte commented Oct 11, 2024

still an issue

@HarryStrandJamf
Copy link
Contributor

I haven't run across this unfortunately. If you could add more detail about what you were doing when this problem showed up, I might be able to address it.

@HarryStrandJamf
Copy link
Contributor

While Jamf Pro prevents this now, it's possible that packages that were added in the past may have had unique names, but the same file name. Jamf Sync only shows the file names. Is that possibly the reason for some of the duplicates? I haven't verified this, but when adding packages via the classic API, it may be possible that it's not checking to be sure the file names are unique between packages.

@mrmte
Copy link
Author

mrmte commented Oct 18, 2024

No that’s is not the case. Packages are only upload via the web Jamf interface and we do not change the name.

@mrmte
Copy link
Author

mrmte commented Oct 18, 2024

Not sure by what you mean add more detail. I’ve added all I can. I’m not going to add sensitive information for the world to see! This is why Jamf admin needs to be brought back as a supported product. All good intentions aside this is not professional from Jamf.

@HarryStrandJamf
Copy link
Contributor

HarryStrandJamf commented Oct 18, 2024

If there are multiple packages in Jamf Pro with unique names but reference the same file name, and the file doesn't exist on the distribution point, then it will be duplicated like this. When adding package via the Jamf Pro UI, it will prevent this duplication, but it's possible that if they were added before that checking was implemented or if they are added through the API that there may be packages with unique names that reference the same files. It only shows the file names not the package names, so it would appear as a duplication. Let me know if this doesn't seem like this describes your situation. If that is what's happening, it's best to clean that up in Jamf Pro.

@HarryStrandJamf
Copy link
Contributor

HarryStrandJamf commented Oct 18, 2024

Not sure by what you mean add more detail.

Anything extra you can share would be helpful. A screenshot would answer a lot of questions that I don't even know to ask, but I realize that may not be doable due to the public nature of these issues. But if you can let me know the sync status of each of the duplicates (what it says when you hover your mouse over the sync column for those items), that would help.

@HarryStrandJamf
Copy link
Contributor

No that’s is not the case. Packages are only upload via the web Jamf interface and we do not change the name.

Sorry, I missed this reply the first time. Hmm. You didn't use any utilities that may have used the API?

@BIG-RAT
Copy link
Contributor

BIG-RAT commented Oct 31, 2024

Wondering if you could give the following script a run. Loads your list of packages and looks for duplicate records.

#!/bin/bash

function getToken() {
	authToken=$(curl -su ${user}:${pass} -X POST -H "Accept: application/json" ${URL}/api/v1/auth/token
)

	#	echo "authToken: $authToken" >$(tty)
	local theToken=$(/usr/bin/plutil -extract token raw -o - - <<< "$authToken")
	echo $theToken
}

echo "Enter the URL for your Jamf Pro server (https://your.jamfPro.server):"
read URL

tokenURL="$URL/uapi/auth/tokens"

echo "Enter Jamf Admin name for ${URL} [admin]:"
read user

if [ -z $user ];then
	user="jssadmin"
fi

echo "Enter password for $user:"
stty -echo
read pass
stty echo

token=$(getToken)
if [ $token == "" ];then
	echo "exiting"
	exit 1
fi

packages=$(curl -s -X GET -H "authorization: Bearer $token" -H "Content-type: application/json" -d "$newPackage" "$URL/api/v1/packages")

#echo $packages
$(/usr/bin/osascript -l JavaScript << EoS

	var duplicates      = 0;
	var duplicatesArray = [];
	var unique    	    = [];
	packagesArray  		= $packages.results;

	var packageCountDict = {};

	for(var key in packagesArray) {

		let filename = packagesArray[key].fileName;
		let displayName = packagesArray[key].packageName

		if (filename in packageCountDict) {
			packageCountDict[filename].push(displayName);
		} else {
			packageCountDict[filename] = [displayName];
		}

		if (unique.includes(filename)) {
			duplicates += 1;
		} else {
			unique.push(packagesArray[key].fileName);
		}
	}

	console.log('\n----- Summary -----');
	if (duplicates == 0) {
		console.log('no duplicate package records found');
	} else {
		for(var whichFile in packageCountDict) {
			//console.log(whichFile + " count: " + packageCountDict[whichFile].length);
			if (packageCountDict[whichFile].length > 1) {
				console.log(whichFile + " has " + packageCountDict[whichFile].length + " package objects.");
				for (var displayName in packageCountDict[whichFile]) {
					console.log("    " + packageCountDict[whichFile][displayName]);
				}
			}
		}
	}
	console.log('\n');
EoS
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants