Closed edestecd closed 6 years ago
@edestecd All this information for readme is only visible to admin.
I can look into getting them through api, let me know which one you prefer.
Fetching them through the api would be preferable, as it requires less configuration from the end user.
After revisiting I realized that the first thing we should consider in regards to these mandatory attributes like 'mu.ci.Description' and 'mu.ci.Lifecycle Status' is that they are not common attributes but rather custom attributes specific to Miami University.
We can not predict what type of custom attribute(s) a particular user's TeamDynamix API requires. So supporting dynamism for the fields (ID, Value, etc) of those attributes through API calls or any other way will not be a very robust solution.
I think in order to make this gem really usable for others:
We can set the user expectations by adding a note about custom mandatory attributes and add an example for "How to get ID, Value etc of a custom attribute via Web UI".
Can we have the user just set the Name of the attribute (example: 'mu.ci.Description'), then do an api call to get the ID?
I agree these attributes, to set on create, should come from yaml. I thought you were already doing that.
I wil have to see if there is an api call to fetch attrbutes. I figured based on existing assets. Anyways, even if we find out ID, what do we do about Value?
On Jan 30, 2018 7:44 AM, "Chris Edester" notifications@github.com wrote:
Can we have the user just set the Name of the attribute (example: 'mu.ci.Description'), then do an api call to get the ID?
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/MiamiOH/foreman_teamdynamix/issues/20#issuecomment-361597096, or mute the thread https://github.com/notifications/unsubscribe-auth/ABk_w1o4KEFi8aF1oeYk9KDWlLh_DQflks5tPxy7gaJpZM4Rwk25 .
one of these may provide attribute ID from name, need to try it https://miamioh.teamdynamix.com/SBTDWebApi/Home/section/Attributes
What is value? Can you give an example? Name: ID: Value:
Oh, you meant the value to set. You could read that from yaml also and run it through eval or send to run any code.
The yaml config file would contain exactly: Name: 'mu.ci.Description', Value: "Foreman host #{host.fqdn} created by ForemanTeamdynamix plugin"
and ID if we can not get it through API, yet to try that
https://miamioh.teamdynamix.com/SBTDWebApi/Home/section/Attributes This action can only be performed by special key-based administrative accounts and not standard TeamDynamix users.
This section of the api has restricted access, so I can not find out if we can get ID from attribute names or not.
OK, we can look int making the plugin work with either admin tokens or user/pass later.
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.