> I'm new to puppet and hope somebody can help me. I have a master server with > a few Mac and Windows Agents. I created a custom fact for windows that will > show the current logged in users Sid. I have a manifest that will edit the > HK Users registry Keys. My issue is when I run the agent it fails because it > wants to place the header and other stuff not needed from the string in the > path. I need the Sid only for it to work. It works if I manually insert the > Sid. I'm thinking my answer is regsubst but I really don't know much about > it. what I need to do is remove the first few characters and the last few. > Can anyone help me out or point me in a direction? Or is there something I > can do in my fact.rb to only show the raw data? Thank you in advance this > one has me pulling out my hair.
regsubstr as a function will help (https://docs.puppetlabs.com/references/latest/function.html#regsubst), or you can do it in the fact itself using Ruby's string substitution: http://www.ruby-doc.org/core-2.1.3/String.html#method-i-sub The idea with both is that you need the incoming variable, a regular expression to do the match, and then a replacement. Having said that however, there are many options available to do string manipulation that might help, such as split (which will convert a string into an array by splitting on a common delimiter). If you are struggling with the solution, perhaps you can post your code so far, an example of what the data looks like and what you want it to look like. I'm sure someone can then provide an example and an explanation. ken. -- 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 puppet-users+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/CAE4bNTkJhYecfk0VtmQsqurK9xhrgrFAPZpPurK8sOatSpVHCw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.