SlideShare a Scribd company logo
promoter
A Python module for migrating
objects between JSSs
A bit of backstory
• A topic came in from the internal all.tech@ list:
“promote everything from a test environment to prod”
• Discussion was focused on migrating or promoting a policy from test/
staging to prod
• It was agreed that it was better done manually
• I took the idea and starting looking into scripting
The original idea:
• Migrate a policy from one JSS to another
• Policies are complex JSS objects
• To ‘promote’ a policy you need to fulfill its dependencies first
• Parse through the XML, find these dependencies and migrate them
one-by-one before finally posting the policy
The holdup?
• The 8.x series REST API lacked support for some of the objects that
would be in a policy (e.g. scripts)
• A shell script wasn’t the right means to accomplish this…
• …I didn’t know Python
So, here comes v9…
• Didn’t do much work on promoter
• A PSE found out about it from a Developer…
• The first version of promoter written over the weekend
Some good stuff
• The first Python project I ever wrote
• Decent command line interface
• Standard library only
• Multi-platform
In hindsight, it was ugly
• Monolithic script
• All function and no class
• Written as a stand-alone utility
• Well recieved, but other priorities took up my time
Coming back to promoter
• JAMF’s Production JSS is hosted
• No direct database access
• How do I replicate my production environment as closely as
possible?
• Hey, I think I wrote something that handled a similar idea once…
A JSS to JSS replication in 14 seconds

(at 25000% speed…)
The new version
• Ditched utility concept, now a module
• A few core functions using a lightweight JSS REST API wrapper
• ‘Manifests’ are used to manipulate the XML into the desired state
Manifest?
• A dictionary that defines actions to take on the
XML of an object
• ‘exclude’ will remove elements
• ‘override’ will replace the value for an element
with a new one
• ‘inject’ will create an element with a value at the
provided path in the XML
• ‘collections’ is the path to a collection in the XML
where the ID elements need to be removed
{

objectName: {

'exclude': [

Element/Path1,

Element/Path2

],

'override': {

Element/Path1: NewValue,

Element/Path2: NewValue

},

'inject': {

NewElement/Path1: Value,

NewElement/Path2: Value

},

'collections': [

Element/Path1,

Element/Path2,

]

}

}
So where is it?
• Not quite ready for primetime
• Supports migrating whole resources, but not individual objects and
does not handle dependencies (being worked on)
• Adding in some more advanced features to address some
shortcomings (borrowing the concept of Autopkg’s Processors)
• It will be available in GitHub (remains to be seen if on my profile or
the JAMF IT Open Source project)
Thank You!
Maybe some brief Q&A?

More Related Content

PDF
Thinking in React
PDF
Zone.js
PPTX
React. Flux. Redux
KEY
Effective JavaScript
PPTX
Translate word press to your language
KEY
Functional js class
PPT
Building Reactive webapp with React/Flux
PDF
Google App Engine - exploiting limitations
Thinking in React
Zone.js
React. Flux. Redux
Effective JavaScript
Translate word press to your language
Functional js class
Building Reactive webapp with React/Flux
Google App Engine - exploiting limitations

What's hot (19)

PPTX
Api crash
PPT
AngularJS - the folly of choice
PDF
PDF
Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya
PDF
Avoid memory leaks using unit tests - Swift Delhi Meetup - Chapter 15
PDF
RubyConf China 2015 - Rails off assets pipeline
PPTX
How to build a rest api
PDF
We don't need consensus: All agreed?
PDF
RubyConf Taiwan 2016 - Large scale Rails applications
PPTX
Introduction to react native with redux
PDF
Building Codealike: a journey into the developers analytics world
PDF
Threading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
PDF
18 Months of Event Sourcing and CQRS Using Microsoft Orleans
PDF
Ruby is dying. What languages are cool now?
PDF
Java reference objects basic
PDF
Munchkin
PDF
Intro to React
PDF
Semi-automated bank transfers with Rails and Shinsei
PPTX
React101 v3
Api crash
AngularJS - the folly of choice
Actors and Microservices - Can two walk together? - Rotem Hermon, Gigya
Avoid memory leaks using unit tests - Swift Delhi Meetup - Chapter 15
RubyConf China 2015 - Rails off assets pipeline
How to build a rest api
We don't need consensus: All agreed?
RubyConf Taiwan 2016 - Large scale Rails applications
Introduction to react native with redux
Building Codealike: a journey into the developers analytics world
Threading Made Easy! A Busy Developer’s Guide to Kotlin Coroutines
18 Months of Event Sourcing and CQRS Using Microsoft Orleans
Ruby is dying. What languages are cool now?
Java reference objects basic
Munchkin
Intro to React
Semi-automated bank transfers with Rails and Shinsei
React101 v3
Ad

Similar to Promoter – A Python Project for Replicating a JSS via the API (20)

PDF
Beginning JavaScript und CSS development with jQuery 1. ed Edition Richard York
PDF
Python And Xml Includes Index 1st Ed Jones Christopher Ajr
PDF
Beginning JavaScript und CSS development with jQuery 1. ed Edition Richard York
PPTX
Rest API with Swagger and NodeJS
PDF
Beginning JavaScript und CSS development with jQuery 1. ed Edition Richard York
PDF
API Description Languages: Which Is The Right One For Me?
PDF
JavaScript Miller Columns
PPTX
Javascript mynotes
PDF
API Description Languages
PDF
API Description Languages
PDF
Client Server Web Apps with JavaScript and Java Rich Scalable and RESTful 1st...
PDF
Client Server Web Apps with JavaScript and Java 1st Edition Casimir Saternos
PDF
Choosing Javascript Libraries to Adopt for Development
PDF
Not Only Drupal
PPTX
Scaling with swagger
PPTX
API Testing Presentations.pptx
PPTX
MarkLogic Developer Community Resources, September 2013
PPTX
Tampering with JavaScript
PDF
How To Do Everything With JavaScript
PPTX
Web-Services-web services-20052025-051043pm.pptx
Beginning JavaScript und CSS development with jQuery 1. ed Edition Richard York
Python And Xml Includes Index 1st Ed Jones Christopher Ajr
Beginning JavaScript und CSS development with jQuery 1. ed Edition Richard York
Rest API with Swagger and NodeJS
Beginning JavaScript und CSS development with jQuery 1. ed Edition Richard York
API Description Languages: Which Is The Right One For Me?
JavaScript Miller Columns
Javascript mynotes
API Description Languages
API Description Languages
Client Server Web Apps with JavaScript and Java Rich Scalable and RESTful 1st...
Client Server Web Apps with JavaScript and Java 1st Edition Casimir Saternos
Choosing Javascript Libraries to Adopt for Development
Not Only Drupal
Scaling with swagger
API Testing Presentations.pptx
MarkLogic Developer Community Resources, September 2013
Tampering with JavaScript
How To Do Everything With JavaScript
Web-Services-web services-20052025-051043pm.pptx
Ad

More from macbrained (6)

PDF
Munki at Facebook
PDF
Provisioning Certificates
PDF
Macbrained Mentors: Career Dev Tools
PDF
Career dev-tools
PDF
Introducing Docker to Mac Management – Nick McSpadden
PDF
Imaging, The Facebook Way by Luke Robles
Munki at Facebook
Provisioning Certificates
Macbrained Mentors: Career Dev Tools
Career dev-tools
Introducing Docker to Mac Management – Nick McSpadden
Imaging, The Facebook Way by Luke Robles

Recently uploaded (20)

PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Big Data Technologies - Introduction.pptx
PPTX
MYSQL Presentation for SQL database connectivity
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
NewMind AI Weekly Chronicles - August'25-Week II
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
Machine Learning_overview_presentation.pptx
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Encapsulation theory and applications.pdf
gpt5_lecture_notes_comprehensive_20250812015547.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Big Data Technologies - Introduction.pptx
MYSQL Presentation for SQL database connectivity
The AUB Centre for AI in Media Proposal.docx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
20250228 LYD VKU AI Blended-Learning.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
NewMind AI Weekly Chronicles - August'25-Week II
MIND Revenue Release Quarter 2 2025 Press Release
Spectral efficient network and resource selection model in 5G networks
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
Machine Learning_overview_presentation.pptx
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
The Rise and Fall of 3GPP – Time for a Sabbatical?
Encapsulation theory and applications.pdf

Promoter – A Python Project for Replicating a JSS via the API

  • 1. promoter A Python module for migrating objects between JSSs
  • 2. A bit of backstory • A topic came in from the internal all.tech@ list: “promote everything from a test environment to prod” • Discussion was focused on migrating or promoting a policy from test/ staging to prod • It was agreed that it was better done manually • I took the idea and starting looking into scripting
  • 3. The original idea: • Migrate a policy from one JSS to another • Policies are complex JSS objects • To ‘promote’ a policy you need to fulfill its dependencies first • Parse through the XML, find these dependencies and migrate them one-by-one before finally posting the policy
  • 4. The holdup? • The 8.x series REST API lacked support for some of the objects that would be in a policy (e.g. scripts) • A shell script wasn’t the right means to accomplish this… • …I didn’t know Python
  • 5. So, here comes v9… • Didn’t do much work on promoter • A PSE found out about it from a Developer… • The first version of promoter written over the weekend
  • 6. Some good stuff • The first Python project I ever wrote • Decent command line interface • Standard library only • Multi-platform
  • 7. In hindsight, it was ugly • Monolithic script • All function and no class • Written as a stand-alone utility • Well recieved, but other priorities took up my time
  • 8. Coming back to promoter • JAMF’s Production JSS is hosted • No direct database access • How do I replicate my production environment as closely as possible? • Hey, I think I wrote something that handled a similar idea once…
  • 9. A JSS to JSS replication in 14 seconds
 (at 25000% speed…)
  • 10. The new version • Ditched utility concept, now a module • A few core functions using a lightweight JSS REST API wrapper • ‘Manifests’ are used to manipulate the XML into the desired state
  • 11. Manifest? • A dictionary that defines actions to take on the XML of an object • ‘exclude’ will remove elements • ‘override’ will replace the value for an element with a new one • ‘inject’ will create an element with a value at the provided path in the XML • ‘collections’ is the path to a collection in the XML where the ID elements need to be removed {
 objectName: {
 'exclude': [
 Element/Path1,
 Element/Path2
 ],
 'override': {
 Element/Path1: NewValue,
 Element/Path2: NewValue
 },
 'inject': {
 NewElement/Path1: Value,
 NewElement/Path2: Value
 },
 'collections': [
 Element/Path1,
 Element/Path2,
 ]
 }
 }
  • 12. So where is it? • Not quite ready for primetime • Supports migrating whole resources, but not individual objects and does not handle dependencies (being worked on) • Adding in some more advanced features to address some shortcomings (borrowing the concept of Autopkg’s Processors) • It will be available in GitHub (remains to be seen if on my profile or the JAMF IT Open Source project)
  • 13. Thank You! Maybe some brief Q&A?