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

AbsoluteManageExport #93

Closed
wants to merge 6 commits into
base: master
from

Conversation

Projects
None yet
8 participants
@tburgin
Copy link

tburgin commented May 28, 2014

Here is a processor that takes as input a pkg or executable and a SDPackages.ampkgprops (plist config) to output a .amsdpackages for use in Absolute Manage. If no SDPackages.ampkgprops is specified a default config will be generated.

You can use this processor by making a new recipe or by adding an override like shown below.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Identifier</key>
    <string>local.pkg.AdobeFlashPlayer</string>
    <key>Input</key>
    <dict>
        <key>NAME</key>
        <string>AdobeFlashPlayer</string>
    </dict>
    <key>ParentRecipe</key>
    <string>com.github.autopkg.pkg.FlashPlayerExtractPackage</string>
    <key>Process</key>
    <array>
        <dict>
            <key>Comment</key>
            <string>Export the embedded package into .amsdpackages to use in Absolute Manage</string>
            <key>Arguments</key>
            <dict>
                <key>source_payload_path</key>
                <string>%RECIPE_CACHE_DIR%/%NAME%-%version%.pkg</string>
                <key>dest_payload_path</key>
                <string>%RECIPE_CACHE_DIR%/%NAME%-%version%.amsdpackages</string>
                <key>sdpackages_ampkgprops_path</key>
                <string>/Users/burgintj/Desktop/SDPackages.ampkgprops</string
                <key>import_abman_to_servercenter</key>
                </true>
            </dict>
            <key>Processor</key>
            <string>AbsoluteManageExport</string>
        </dict>
    </array>
</dict>
</plist>

tburgin added some commits May 27, 2014

Almost There
Absolute Manage Sd Export
Set SourceFilePath to source_dir
SourceFilePath seems to be important during the extraction process on
the client.
@timsutton

This comment has been minimized.

Copy link
Member

timsutton commented May 28, 2014

Thanks! This looks like a good start for support for integrating Absolute Manage with AutoPkg.

We've been discussing how to best incorporate support for processors that deal with management platforms other than Munki, and we're of the opinion that these would make more sense for these to be maintained outside of the core set of AutoPkg processors, by subject matter experts who can properly support them. Greg and I only use Munki, as did Per when he wrote AutoPkg, and we can't realistically support processors for systems we aren't familiar with and don't ourselves use.

What we haven't yet decided on is a mechanism for this, but since we already have a mechanism to share recipes it would likely be somehow built on top of the same idea. We'll continue this discussion on the autopkg-discuss group to help brainstorm ideas for how this could work.

@tburgin

This comment has been minimized.

Copy link

tburgin commented May 28, 2014

Sounds Great!

@gregneagle

This comment has been minimized.

Copy link
Contributor

gregneagle commented May 28, 2014

A suggestion for lines 53-55:

https://docs.python.org/2/library/uuid.html

Probably same result, but more readable as far as intent.

@tburgin

This comment has been minimized.

Copy link

tburgin commented May 28, 2014

Good call

str(uuid.uuid4()).upper()

This is much more readable than a lambda.

@patgmac

This comment has been minimized.

Copy link
Member

patgmac commented May 28, 2014

I spoke to Martin Bestmann (lead AbMan dev) last week about having an API for importing packages from AutoPKG. He suggested this exact thing...create a *.ampkgprops bundle which contains the xml file to config the package, and the payload. I started poking around yesterday and it looks like there's a lot that can be set in that xml file. How are those handled on a case by case basis? Would AM recipes need to be maintained with overrides?

I mentioned to Martin that we would also need a way to save the added .ampkgprops package to Server Center, he said he would be willing to add a command line method to save those changes. Now that you have this processor started, I'll ping him on this again to hopefully get it added soon.

@tburgin

This comment has been minimized.

Copy link

tburgin commented May 28, 2014

@patgmac
In your recipe or override you can set this input variable "sdpackages_ampkgprops_path" to a custom xml path.

A command line importation of .amsdpackages would be amazing! Let me know if you need any more Absolute Manage customers to request this.

@patgmac

This comment has been minimized.

Copy link
Member

patgmac commented May 28, 2014

I just emailed Martin regarding importing, since he probably didn't write it down when we talked about it (discussed over lunch).

Thanks for doing this.


output_variables = {}
appleSingleTool = "/Library/Application Support/LANrev Agent/LANrev Agent.app/Contents/MacOS/AppleSingleTool"
s = lambda x: binascii.b2a_hex(os.urandom(x)).upper()

This comment has been minimized.

@tburgin

tburgin May 28, 2014

Remove the lambda

output_variables = {}
appleSingleTool = "/Library/Application Support/LANrev Agent/LANrev Agent.app/Contents/MacOS/AppleSingleTool"
s = lambda x: binascii.b2a_hex(os.urandom(x)).upper()
unique_id = s(4) + "-" + s(2) + "-" + s(2) + "-" + s(2) + "-" + s(6)

This comment has been minimized.

@tburgin

tburgin May 28, 2014

unique_id = str(uuid.uuid4()).upper()

appleSingleTool = "/Library/Application Support/LANrev Agent/LANrev Agent.app/Contents/MacOS/AppleSingleTool"
s = lambda x: binascii.b2a_hex(os.urandom(x)).upper()
unique_id = s(4) + "-" + s(2) + "-" + s(2) + "-" + s(2) + "-" + s(6)
unique_id_sd = s(4) + "-" + s(2) + "-" + s(2) + "-" + s(2) + "-" + s(6)

This comment has been minimized.

@tburgin

tburgin May 28, 2014

unique_id_sd = str(uuid.uuid4()).upper()

Changed uuid generation
On the suggestion of @gregneagle, I changed the uuid generation to use
the python class uuid.

I also more exemptionption handling for sdpackages_ampkgprops_path
@patgmac

This comment has been minimized.

Copy link
Member

patgmac commented Jul 3, 2014

Martin just sent me a small change for line 73 to test. I'm getting on a plane in a couple hours so don't have time to test or merge atm.

subprocess.check_output([self.appleSingleTool, "encode", "-s", source_dir, "-t", dest_dir + "/Payloads/" + self.unique_id, "-p", "-x", "-z", "3"])

@tburgin

This comment has been minimized.

Copy link

tburgin commented Jul 10, 2014

I will take a look tonight. I wonder what "-p", "-x", "-z", "3" will do?

@tburgin

This comment has been minimized.

Copy link

tburgin commented Jul 11, 2014

Here are the suggested options, they seem to work fine in the class. I will test next week and update line 73.

-p store/restore UNIX permission [default: false]
-x encrypt encoded data [default: false]; ignored for decode operations
-z <0-9> compression level (0=none, 9=highest) for encoded data [default: 0]; ignored for decode operations

@patgmac

This comment has been minimized.

Copy link
Member

patgmac commented Jul 26, 2014

AM 6.5 now has the ability to import packages from the command line. I don't think it's documented yet, but they sent me instructions. I can't seem to copy/paste in here so email me at pgalla2 at emory dot edu for the details.

@MagerValp

This comment has been minimized.

Copy link
Contributor

MagerValp commented Jul 26, 2014

Gist?

@patgmac

This comment has been minimized.

Copy link
Member

patgmac commented Jul 26, 2014

https://gist.github.com/patgmac/34b2c34fcff2c7b756ab

On Jul 26, 2014, at 2:07 PM, MagerValp notifications@github.com wrote:

Gist?


Reply to this email directly or view it on GitHub.

@tburgin

This comment has been minimized.

Copy link

tburgin commented Jul 26, 2014

Awesome! I will update.

Sent from my iPhone

On Jul 26, 2014, at 2:09 PM, Patrick Gallagher notifications@github.com wrote:

https://gist.github.com/patgmac/34b2c34fcff2c7b756ab

On Jul 26, 2014, at 2:07 PM, MagerValp notifications@github.com wrote:

Gist?


Reply to this email directly or view it on GitHub.


Reply to this email directly or view it on GitHub.

@tburgin

This comment has been minimized.

Copy link

tburgin commented Jul 29, 2014

Run this to set the option

defaults write ~/Library/Preferences/com.poleposition-sw.lanrev_admin AllowURLSDPackageImport -bool true

Run this to verify it is in there as a boolean

defaults read ~/Library/Preferences/com.poleposition-sw.lanrev_admin AllowURLSDPackageImport

This should return 1

@patgmac

This comment has been minimized.

Copy link
Member

patgmac commented Jul 29, 2014

I just tried it and it worked for me. Try stopping the lanrev server before making changes to that file. Depending on the OS on the server, you may need to leave .plist off the file (but I think you would’ve got an error if defaults didn’t like the path).

On Jul 29, 2014, at 11:13 AM, tburgin notifications@github.com wrote:

I have been unsuccessful in getting this to work. Here is what I have done. Has anyone had an success?

Run this to set the option on the main server

sudo defaults write /Library/Preferences/com.poleposition-sw.lanrev_server.plist AllowURLSDPackageImport -bool true
Run this to verify it is in there as a boolean

sudo defaults read /Library/Preferences/com.poleposition-sw.lanrev_server.plist AllowURLSDPackageImport
This should return 1


Reply to this email directly or view it on GitHub.

@tburgin

This comment has been minimized.

Copy link

tburgin commented Jul 29, 2014

Thanks to @abt-btran
This is actually the preference that needs to be changed.

~/Library/Preferences/com.poleposition-sw.lanrev_admin
@patgmac

This comment has been minimized.

Copy link
Member

patgmac commented Jul 29, 2014

Oh, that would makes sense. :-)

On Jul 29, 2014, at 12:27 PM, tburgin notifications@github.com wrote:

Thanks to @abt-btran
This is actually the preference that needs to be changed.

~/Library/Preferences/com.poleposition-sw.lanrev_admin

Reply to this email directly or view it on GitHub.

@patgmac

This comment has been minimized.

Copy link
Member

patgmac commented Aug 13, 2014

Any updates on this?

@tburgin

This comment has been minimized.

Copy link

tburgin commented Aug 13, 2014

Yeah. We have things working as far as importing. However, we are looking into querying the AM SD database to find what has / has not been uploaded. This way we can stop an import of a version of software that is already in the SD database.@thevoidboy has been working on this, as I have been tied up with other things.

We should have a new version posted sometime soon.

@patgmac

This comment has been minimized.

Copy link
Member

patgmac commented Aug 13, 2014

Cool, thanks. We may be able to get Absolute to help with this. Get in touch with me and I can get you in contact with Martin over there. patgmac at gmail.

@gregneagle

This comment has been minimized.

Copy link
Contributor

gregneagle commented Aug 13, 2014

Remind Martin that Tim and I will be presenting on AutoPkg at MacSysAdmin in September: The more the AbsoluteManage processor can do by then, the better for Absolute Manage from a PR perspective...

@patgmac

This comment has been minimized.

Copy link
Member

patgmac commented Aug 13, 2014

Will do. Have you guys decided how you want to handle these system
management processors (AM, JSS, etc)? I know there was some discussion but
not sure if anything was decided.

On Wed, Aug 13, 2014 at 2:13 PM, Greg Neagle notifications@github.com
wrote:

Remind Martin that Tim and I will be presenting on AutoPkg at MacSysAdmin
in September: The more the AbsoluteManage processor can do by then, the
better for Absolute Manage from a PR perspective...

Reply to this email directly or view it on GitHub
#93 (comment).

@gregneagle

This comment has been minimized.

Copy link
Contributor

gregneagle commented Aug 13, 2014

autopkg 0.4.0 will have support for shared processors. Functional now in the current git revision.

See https://github.com/autopkg/recipes/tree/master/SampleSharedProcessor for an example of how one implements a shared processor.

Technically, with the shared processor support, one can access processors from any recipe's folder.

I'm sure more documentations and examples will be needed, but see recent discussions on autopkg-discuss for more info.

@tburgin

This comment has been minimized.

Copy link

tburgin commented Aug 13, 2014

@patgmac Awesome. David will contact you / him.
@gregneagle Awesome. I like what I see.

Merge pull request #1 from thevoidboy/master
Added capability to import and commit
self.sdpackages_template['SDPackageList'][0]['SDPayloadList'][0]['last_modified'] = ""

plistlib.writePlist(self.sdpackages_template, dest_dir + "/SDPackages.ampkgprops")
if import_pkg:

This comment has been minimized.

@tburgin

tburgin Aug 18, 2014

Thanks @thevoidboy
We still need to add some type of check. Currently this code will add PKGs over and over.

@tburgin

This comment has been minimized.

Copy link

tburgin commented Sep 4, 2014

We have a feature request in with AM. Anyone else who wants to see this happen, contact your AM rep and join the request.

This would return True along with the import date, UID and payload name. Or False if nothing exists.

lanrevadmin://querysoftwarepackage?packagename="some name"

If would also be nice to query based on UID or Payload name

lanrevadmin://querysoftwarepackage?uid="some UID"
lanrevadmin://querysoftwarepackage?payloadname="some payload"
@patgmac

This comment has been minimized.

Copy link
Member

patgmac commented Oct 8, 2014

Do you have a COBRA number we can reference?

On Thu, Sep 4, 2014 at 3:28 PM, tburgin notifications@github.com wrote:

We have a feature request in with AM. Anyone else who wants to see this
happen, contact your AM rep and join the request.

This would return True along with the import date, UID and payload name.
Or False if nothing exists.

lanrevadmin://querysoftwarepackage?packagename="some name"

If would also be nice to query based on UID or Payload name

lanrevadmin://querysoftwarepackage?uid="some UID"
lanrevadmin://querysoftwarepackage?payloadname="some payload"

Reply to this email directly or view it on GitHub
#93 (comment).

@tburgin

This comment has been minimized.

Copy link

tburgin commented Feb 20, 2015

Just getting back into this...

@tburgin

This comment has been minimized.

Copy link

tburgin commented Feb 20, 2015

I have submitted a fresh case with Absolute Manage.
Case Number: 9545802817

While we wait to hear back. Does anyone have any insight if Absolute Manage has implemented something like:

lanrevadmin://querysoftwarepackage?packagename="some name"
@tburgin

This comment has been minimized.

Copy link

tburgin commented Feb 20, 2015

I received word from one of the engineers that most likely our feature request will not happen this quarter.

Like we have discussed in the past...
If you always run autopkg from the same system, duplicate packages will not be imported into Absolute Manage. This "works" but I don't like it. I would much rather have Absolute Manage be the driving factor and be able to run atopkg from any system without duplicate consequences.

He did send me this:
http://forums.absolute.com/kb.php?a=1062

<key>Processor</key>
<string>StopProcessingIf</string> -- Stop processing if no updated version was found.
<key>Arguments</key>
<dict>
<key>predicate</key>
<string>new_package_request == FALSE</string>

Assuming I am always running it from the same machine, packages will not get re-downloaded or duplicated into AM.

#!/bin/sh -x


# Update all repos
repos=`autopkg repo-list | awk '//{print $1}'`
for i in $repos;do
    autopkg repo-update $i ;
done

# Execute all recipes for Absolute
recipes=`autopkg list-recipes | grep -i absolute`
for i in $recipes;do
    autopkg run $i ;
done
@arubdesu

This comment has been minimized.

Copy link
Member

arubdesu commented Feb 20, 2015

uh, any particular reason this script seems to be replicating the functionality of repo-update all and run --list /path/to/listOfAMrecipes.txt?

@tburgin

This comment has been minimized.

Copy link

tburgin commented Feb 20, 2015

No reason, Just pasted what I got from the Absolute Manage engineer. Guess he didn't know about that feature

@tburgin

This comment has been minimized.

Copy link

tburgin commented Feb 24, 2015

I dig some digging and found that Absolute Manage actually keeps a cached version of the Software Distribution Packages database (sqlite3). I have updated the AbsoluteManageExport to do some basic checking to prevent duplicates.

https://github.com/tburgin/AbsoluteManageExport

The processor runs fine when installed locally. However I am having trouble using it as a shared processor.

I add this repo

https://github.com/tburgin/AbsoluteManageExport

And use this recipe.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Description</key>
    <string>Creates an Absolute Manage package (.amsdpackages), imports it into the Absolute Manage Admin console and uploads it to the Absolute Manage Server.</string>
    <key>Identifier</key>
    <string>com.github.tburgin.tburgin-recipes.Absolute.AdobeFlashPlayer</string>
    <key>Input</key>
    <dict>
        <key>NAME</key>
        <string>AdobeFlashPlayer</string>
    </dict>
    <key>ParentRecipe</key>
    <string>com.github.autopkg.pkg.FlashPlayerExtractPackage</string>
    <key>MinimumVersion</key>
    <string>0.4.0</string>
    <key>Process</key>
    <array>
        <dict>
            <key>Processor</key>
            <string>com.github.tburgin.AbsoluteManageExport/AbsoluteManageExport</string>
            <key>Arguments</key>
            <dict>
                <key>dest_payload_path</key>
                <string>%RECIPE_CACHE_DIR%/%NAME%-%version%.amsdpackages</string>
                <key>sdpackages_ampkgprops_path</key>
                <string>%RECIPE_DIR%/%NAME%-Defaults.ampkgprops</string>
                <key>source_payload_path</key>
                <string>%pkg_path%</string>
                <key>import_abman_to_servercenter</key>
                <true/>
            </dict>
            <key>SharedProcessorRepoURL</key>
            <string>https://github.com/tburgin/AbsoluteManageExport</string>
        </dict>
    </array>
</dict>
</plist>

But Always get this:

Processing AdobeFlashPlayer.Absolute...
Failed.
Receipt written to /tmp/receipts/AdobeFlashPlayer-receipt-20150224-102723.plist

The following recipes failed:
    AdobeFlashPlayer.Absolute
        Unknown processor 'com.github.tburgin.AbsoluteManageExport/AbsoluteManageExport'. This shared processor can be added via the repo: https://github.com/tburgin/AbsoluteManageExport.

Nothing downloaded, packaged or imported.
@yngast

This comment has been minimized.

Copy link

yngast commented Feb 24, 2015

I noticed that Adobe renamed the dmg, one have to add Install at the end of the name in the download recipe for it to download.
Don’t know if that helps
Yngve

On 24 feb 2015 V:9, at 16:51, tburgin notifications@github.com wrote:

I dig some digging and found that Absolute Manage actually keeps a cached version of the Software Distribution Packages database (sqlite3). I have updated the AbsoluteManageExport to do some basic checking to prevent duplicates.

https://github.com/tburgin/AbsoluteManageExport https://github.com/tburgin/AbsoluteManageExport
The processor runs fine when installed locally. However I am having trouble using it as a shared processor.

I add this repo

https://github.com/tburgin/AbsoluteManageExport
And use this recipe.

Description Creates an Absolute Manage package (.amsdpackages), imports it into the Absolute Manage Admin console and uploads it to the Absolute Manage Server. Identifier com.github.tburgin.tburgin-recipes.Absolute.AdobeFlashPlayer Input NAME AdobeFlashPlayer ParentRecipe com.github.autopkg.pkg.FlashPlayerExtractPackage MinimumVersion 0.4.0 Process Processor com.github.tburgin.AbsoluteManageExport/AbsoluteManageExport Arguments dest_payload_path %RECIPE_CACHE_DIR%/%NAME%-%version%.amsdpackages sdpackages_ampkgprops_path %RECIPE_DIR%/%NAME%-Defaults.ampkgprops source_payload_path %pkg_path% import_abman_to_servercenter SharedProcessorRepoURL https://github.com/tburgin/AbsoluteManageExport But Always get this:

Processing AdobeFlashPlayer.Absolute...
Failed.
Receipt written to /tmp/receipts/AdobeFlashPlayer-receipt-20150224-102723.plist

The following recipes failed:
AdobeFlashPlayer.Absolute
Unknown processor 'com.github.tburgin.AbsoluteManageExport/AbsoluteManageExport'. This shared processor can be added via the repo: https://github.com/tburgin/AbsoluteManageExport.

Nothing downloaded, packaged or imported.

Reply to this email directly or view it on GitHub #93 (comment).

@timsutton

This comment has been minimized.

Copy link
Member

timsutton commented Feb 24, 2015

When you refer to a shared processor like: com.github.tburgin.AbsoluteManageExport/AbsoluteManageExport, the part preceding the slash is a recipe identifier. So I'd think it should work if you change this to com.github.tburgin.AbsoluteManageExport.AdobeFlashPlayer, or alternatively make a stub recipe called com.github.tburgin.AbsoluteManageExport as suggested in the Processor Locations wiki page.

@tburgin

This comment has been minimized.

Copy link

tburgin commented Feb 24, 2015

@timsutton Thanks. I uploaded a stub recipe to the repo. Using AbsoluteManageExport as a shared processor now works well.

@tburgin

This comment has been minimized.

Copy link

tburgin commented Apr 15, 2015

AbsoluteManageExport is being hosted here. Closing this issue.
https://github.com/tburgin/AbsoluteManageExport

@tburgin tburgin closed this Apr 15, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment