miamioh / foreman_teamdynamix Goto Github PK
View Code? Open in Web Editor NEWA Foreman Plugin for TeamDynamix
License: GNU General Public License v3.0
A Foreman Plugin for TeamDynamix
License: GNU General Public License v3.0
Fields not listed to be synced are being blanked.
Figure out how to use this: https://miamioh.teamdynamix.com/SBTDWebApi/Home/section/Assets#POSTapi/{appId}/assets/search
So we can improve the rake task here: https://github.com/MiamiOH/foreman_teamdynamix/blob/master/lib/tasks/sync_hosts_with_teamdynamix.rake#L14
We want something like this:
Host.all.each do |h|
# if there is a TD asset with h.teamdynamix_asset_id update it and next
# if there is a TD asset with name or serialNumber of host.name then update it and set host.teamdynamix_asset_id and next
# if there is not an asset then create one and set host.teamdynamix_asset_id
end
In order to reuse the authentication token to TeamDynamix Api
http://projects.theforeman.org/projects/foreman/wiki/How_to_Create_a_Plugin#Using-the-example-plugin
Copy the files to this repo rather than using that repo directly....
For example, if you create a host named "test" and leave required fields like architecture, operating system, etc. blank, teamdynamix creates the asset "test" anyway. If the host is submitted multiple times for reasons related to this, teamdynamix creates multiples of the same asset.
Just use eval directly and do a literal string in yaml config if you want
https://github.com/MiamiOH/foreman_teamdynamix/blob/master/lib/foreman_teamdynamix/engine.rb#L26
Breaks in Foreman 1.14. Need to refacter
You just get permission denied instead of the tab content
What sync means:
Go through all hosts in Foreman and search for a matching Asset in TD.
If found, update the fields in the TD asset.
If not found, create a TD asset with desired fields.
We should be able to run this rake task in a cron job on regular intervals.
Example: https://github.com/theforeman/puppetdb_foreman/blob/master/app/services/puppetdb.rb
This seems better than using lib
Offending code:
https://github.com/MiamiOH/foreman_teamdynamix/blob/master/lib/teamdynamix_api.rb#L109
https://github.com/MiamiOH/foreman_teamdynamix/blob/master/lib/teamdynamix_api.rb#L114
https://github.com/MiamiOH/foreman_teamdynamix/blob/master/lib/teamdynamix_api.rb#L122
These should at minimum be read from the yaml config file with good instructions in the README on how to obtain them. Any non technical person should be able to find them.
It would be even better if API calls could be made in the plugin to obtain them.
These are probably not the same in our production / sandbox environments and Rails.env is not a good indicator of these. All our foreman environments run with Rails.env == production, b/c the rpm install is setup that way. We don't install from source.
This is a more structured way to do things and it ties into Foreman hooks for the progress bar upon host creation etc...
Here are orchestrations in core Foreman: https://github.com/theforeman/foreman/tree/006929d1057d5b59458d4fbf99cd20853c198ffd/app/models/concerns/orchestration
Here is a plugin that adds an orchestration: https://github.com/theforeman/puppetdb_foreman/blob/master/app/models/concerns/orchestration/puppetdb.rb#L13
Could not create the asset for the host in TeamDynamix: {"status":"400","msg":"Bad Request","body":{"ID":-1,"Message":"Name or serial number must be provided for asset records."}}
This is causing any attribute not being synced to be blanked.
Use the TD api and read username/password from yaml file.
myTab -> host-show-tabs
myTabContent -> host-show-tabs-content
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.