On 21 January 2014 00:33, Erwin Bogaard <[email protected]> wrote: > Hi Pete, > > thanks for your reply. > I thought I replied to you last night, but Google doesn't show it. So here > it is again: > > The difficulty with using a template, is that there are just too many > exceptions between the instances. Some keys or arrays are exclusive to one > or several, but not all, instances. Some values of keys are different, > because a different version of a module is installed. > I can, as you suggest, partly overcome that by using inline templates, but > that still just leaves too many other things to consider.
This is a perfect use case for hiera. If you aren't using it I would suggest setting it up. It will allow you to setup variables exactly how you describe above. This will get you started. http://docs.puppetlabs.com/hiera/1/ > That's why Augeas (if I understand the principle behind that correctly), > seemed the way to go. That way you can just add/remove/change configuration > options, while leaving the rest of the config alone. > Problem is: it's only for key=value files. > > Is there a workaround or maybe another solution to this? > > Thanks > > > > On Monday, January 20, 2014 1:06:08 AM UTC+1, Pete wrote: >> >> Hi >> >> On 20 Jan 2014, at 7:34 am, Erwin Bogaard <[email protected]> wrote: >> >> Hi, >> >> I'm looking into a way to manage the SugarCRM config.php (see partial >> example below this message). This proposes several problems: >> 1. The file is full of arrays and arrays-in-arrays (So I think Augeas is >> useless, as far as I understand it) >> 2. Not all config.php's contain the same arrays and/or key-value >> combinations. It's possible that in one config.php a certain arrays is >> needed, while it isn't in another and that teh value of a certain key needs >> to be different and is set from SugarCRM. So to summarize: I don't want to >> manage every array and key/value in config.php. (So I think and >> config.erb-template is out of the question) >> >> >> Using a template is the best way to manage it in my opinion. >> If your dataset is that complex you would need to manage it for each >> individual node no matter which method you chose to utilise. >> Using hiera will make that simple. >> >> It’s not that tricky to generate entries in a template from an array. >> It’s also not that tricky to use an inline_template to generate a >> variable. >> >> 3. I could use exec with sed and for every array and key/value I need to >> manage, but that would probably make it quite complex (if possible at all), >> as I need to check for existance first, and depending on the outcome, add >> the array or key/value or change the existing pair. >> >> >> This is the worst idea in my opinion. Please don’t go down that path. >> Managing that by itself will be a nightmare. >> >> The way I used to do this was manage config_override.php, in which you can >> specify arrays and key/values which override the ones in config.php, with an >> erb template. Problem with that, is that when you change something in the >> SugarCRM-interface, it 's added/changed in config_override.php. Which is >> then regularly overwritten by Puppet, so the change is reverted. >> >> Does anyone have a good suggestion to manage this file reliably and with >> reasonable complexity with Puppet? >> >> ----- >> Example file (partial): >> <?php >> $sugar_config = array ( >> 'Reschedule' => >> array ( >> 'version' => '2.0', >> ), >> 'SAML_X509Cert' => '', >> 'SAML_loginurl' => '', >> 'addAjaxBannedModules' => >> array ( >> 0 => 'AOS_Contracts', >> 1 => 'AOS_Invoices', >> 2 => 'AOS_Quotes', >> 3 => 'AOS_PDF_Templates', >> 4 => 'asol_Reports', >> 5 => 'Accounts', >> 6 => 'Contacts', >> 7 => 'Leads', >> 8 => 'Prospects', >> ), >> 'admin_access_control' => false, >> 'admin_export_only' => false, >> 'aos' => >> array ( >> 'version' => '5.3.2', >> 'contracts' => >> array ( >> 'renewalReminderPeriod' => '14', >> ), >> 'lineItems' => >> array ( >> 'totalTax' => false, >> 'enableGroups' => true, >> ), >> 'invoices' => >> array ( >> 'initialNumber' => '1', >> ), >> 'quotes' => >> array ( >> 'initialNumber' => '1', >> ), >> ), >> 'authenticationClass' => '', >> 'cache_dir' => 'cache/', >> 'calculate_response_time' => true, >> ... >> ... >> ); >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/puppet-users/e7c27236-f397-471e-b0ad-8e881e016a4b%40googlegroups.com. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-users/35c0287b-bcc0-4a1e-9ca7-bc975753da57%40googlegroups.com. > > For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAJ8DPF7xHpuDrNrQ38MU189qhCXPgJQvbHit%3DfgGELLDG9Km_w%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
