Hi,

I've got a "follow-up" problem:

The following is working right:
{ "fields" : { "field1": "value1", "field2" : "value2"}}
will be imported with decoding as  JSON string  and sync to vars resulting in
vars.fields = {
  field1 = "value1"
  field2 = "value2"
}
  
But If I want to get something like

vars.disks["disk_windows C:"] = {
   disk_win_path = "c:"
   disk_win_warn = "20%"
}
 
I got problems with escaping and misleading arrays:

{ "disks[\"disk_windows C:\"]" : {"disk_win_path" : "c:", "disk_win_warn" 
:"20%" }}
will be imported with decoding as JSON string to (Import Source Preview)
{
  disks["disk_windows C:"]: {
     disk_win_path :"c:"
     disk_win_warn :"20%"
  } 

But the Syncing is producing
vars["disks[\"disk_windows C:\"] = {
   disk_win_path = "c:"
   disk_win_warn = "20%"
}


On 12/07/2016 03:24 PM, tilo....@googlemail.com wrote:
> Thanks.
> On 07.12.2016 09:31, Markus Frosch wrote:
>> On 06.12.2016 16:31, tilo....@googlemail.com wrote:
>>> in director/syncrule/addproperty its possible to choose as
>>> "Destination Field" "All custom variables (vars.)"
>>> I'm missing some information about the format of the Source Column.
>>> Json? some kind of yaml?
>>
>> The source column should be a proper PHP type, like assoc Array, or
>> better stdClass.
>>
>> This can be expanded from JSON for example, there are "modifiers" on a
>> ImportSource, that can "Decode a JSON string".
> That works.
> 
>>
>> If you have a custom ImportSource in PHP code, you can just pass the
>> raw PHP type for the column.
>>
>> Regards
>> Markus Frosch
>>
> Regards,
> Tilo Mey

-- 
Linux Information Systems
LIS Stuttgart GmbH
Talstraße 41 70188 Stuttgart Germany
mobil +49-177-6493942 tel +49-711-6403961 fax +49-711-6403955

Geschäftsführer Tilo Mey
Amtsgericht Stuttgart,  HRB 729287, Ust-IdNr DE264295269
Volksbank Stuttgart EG, BIC VOBADESS, IBAN DE75600901000340001003 
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to