Export/import of smart-class-parameters w/ hammer csv

Trying to work around data backup and mirroring for a customer I took a
stab at smart-class-parameters. This is what I have so far[1]:

$ hammer csv smart-class-parameters --export --search access_log
Name,Description,Class,Parameter Type,Default Value,Hidden Value,Use Puppet
Default,Required,Validator Type,Validator Rule,Merge Overrides,Merge
Default,Avoid Duplicates,Override,Override Order,Override Match,Override
Value,Override Omit,Override Use Default
access_log,"",squid::config,string,,true,false,regexp,a*c,false,false,false,Yes,"fqdn,hostgroup,os,domain",
access_log,"",squid,string,${$squid::params::access_log},false,false,"",false,false,false,Yes,"fqdn,hostgroup,os,domain",
access_log,Remove All,
access_log,Override,fqdn=devel.example.com,abc,No,No
access_log,Override,hostgroup=OpenShift Container
Platform,Yes,Yes
access_log,"",squid::config,string,
,true,false,regexp,a*c,false,false,false,Yes,"fqdn,hostgroup,os,domain",
access_log,"",squid,string,${$squid::params::access_log},false,false,"",false,false,false,Yes,"fqdn,hostgroup,os,domain",
access_log,Remove All,
access_log,Override,fqdn=devel.example.com,abc,No,No
access_log,Override,hostgroup=OpenShift Container
Platform,Yes,Yes

Basically, each param is output. If it has overrides, a separate row per
override is output with the "Override" column indicating that this row is
different. It's a way I've found useful for mixing nested concepts.

I don't like the "Remove All" and will likely replace it with a command
line option. The intent is this: Sometimes I want to just add something,
not caring what is already there. Other times I want to force the object to
exactly match the input.

For the primary rows, when a column is present (not all columns need to be
included during import), then the resource has that value set. If the param
doesn't exist, it is created.

Not being at all familiar with smart class parameters, I don't really know
if this is useful or correct. For example, what is the hidden value and
should it be a column? I imagine that I'd perhaps want to set the hidden
value (import) but never export it?

If this looks useful, feedback welcome. If not, I won't complete it.

[1]

I know this is an old thread, but I was wondering if there was any update to this?

I have a use case for this, as ideally I'd want to be able to export/import smart-class parameters, not just for backup/migration, but also for review and auditability.


ยทยทยท On Friday, March 10, 2017 at 4:33:56 PM UTC-5, Tom McKay wrote:

Trying to work around data backup and mirroring for a customer I took a
stab at smart-class-parameters. This is what I have so far[1]:

$ hammer csv smart-class-parameters --export --search access_log
Name,Description,Class,Parameter Type,Default Value,Hidden Value,Use
Puppet Default,Required,Validator Type,Validator Rule,Merge Overrides,Merge
Default,Avoid Duplicates,Override,Override Order,Override Match,Override
Value,Override Omit,Override Use Default

access_log,"",squid::config,string,*****,,true,false,regexp,a*c,false,false,false,Yes,"fqdn,hostgroup,os,domain",,,,

access_log,"",squid,string,${$squid::params::access_log},,false,false,"",,false,false,false,Yes,"fqdn,hostgroup,os,domain",,,,
access_log,,,,,,,,,,,,,Remove All,,,,,
access_log,,,,,,,,,,,,,Override,,fqdn=devel.example.com,abc,No,No
access_log,,,,,,,,,,,,,Override,,hostgroup=OpenShift Container
Platform,,Yes,Yes

access_log,"",squid::config,string,*****,,true,false,regexp,a*c,false,false,false,Yes,"fqdn,hostgroup,os,domain",,,,

access_log,"",squid,string,${$squid::params::access_log},,false,false,"",,false,false,false,Yes,"fqdn,hostgroup,os,domain",,,,
access_log,,,,,,,,,,,,,Remove All,,,,,
access_log,,,,,,,,,,,,,Override,,fqdn=devel.example.com,abc,No,No
access_log,,,,,,,,,,,,,Override,,hostgroup=OpenShift Container
Platform,,Yes,Yes

Basically, each param is output. If it has overrides, a separate row per
override is output with the "Override" column indicating that this row is
different. It's a way I've found useful for mixing nested concepts.

I don't like the "Remove All" and will likely replace it with a command
line option. The intent is this: Sometimes I want to just add something,
not caring what is already there. Other times I want to force the object to
exactly match the input.

For the primary rows, when a column is present (not all columns need to be
included during import), then the resource has that value set. If the param
doesn't exist, it is created.

Not being at all familiar with smart class parameters, I don't really know
if this is useful or correct. For example, what is the hidden value and
should it be a column? I imagine that I'd perhaps want to set the hidden
value (import) but never export it?

If this looks useful, feedback welcome. If not, I won't complete it.

[1]