Ask Your Question

R's profile - activity

2016-08-17 09:12:51 -0500 received badge  Nice Question (source)
2016-07-22 06:42:06 -0500 marked best answer Ensuring idempotency using exec?

I have about 20 python scripts which I am invoking via exec. My question is how to ensure idempotency? One way I could think of is to touch a different file every time the one script is executed. But that would require us to maintain 20 different files. I was looking at "refreshonly" in exec, where the triggers only if there is an event (notify or subscribe). I am not clear on this refreshonly option. Could somebody shed some light on this?

Thanks in advance

2016-03-10 18:51:45 -0500 received badge  Notable Question (source)
2016-03-10 18:51:45 -0500 received badge  Famous Question (source)
2016-02-28 11:53:57 -0500 received badge  Famous Question (source)
2016-01-08 11:15:44 -0500 received badge  Famous Question (source)
2015-12-04 17:02:00 -0500 received badge  Famous Question (source)
2015-12-02 17:54:32 -0500 received badge  Famous Question (source)
2015-11-05 13:01:02 -0500 asked a question augtool not saving the XML file to the disk

I am following the following link https://twiki.cern.ch/twiki/bin/view/... to use Augeas to parse a XML file.

    [root@devopsdev manifests]# /opt/puppet/bin/augtool --noload --noautoload --echo
       augtool>  set /augeas/load/xml/lens "Xml.lns"
       augtool> set /augeas/load/xml/incl "/local/mnt/workspace/Book.xml"
       augtool> load
       augtool>set Book[BOOKNAME/#text = \"Oracle 12c\"]/AUTHOR/#text 'Richard Gosling'
       augtool>  set Book[BOOKNAME/#text = \"Oracle 12c\"]/ISBN/#text '0-07-913702-4'
        augtool> save
       augtool> print /files
        /files
       /files/local
       /files/local/mnt
       /files/local/mnt/workspace
       /files/local/mnt/workspace/Book.xml
       /files/local/mnt/workspace/Book.xml/Book
        /files/local/mnt/workspace/Book.xml/Book/#text = "\n"
       /files/local/mnt/workspace/Book.xml/Book/BOOKNAME
      /files/local/mnt/workspace/Book.xml/Book/BOOKNAME/#text = "Oracle 12c"
       /files/local/mnt/workspace/Book.xml/Book/AUTHOR
       /files/Book[1]/AUTHOR/#text = "Richard Gosling"
       /files/Book[2]
       /files/Book[2]/ISBN
        /files/Book[2]/ISBN/#text = "0-07-913702-4"

If I cat the xml I dont see the new changes:

 [root@devopsdev manifests]# cat /local/mnt/workspace/Book.xml 
   <Book>
    <BOOKNAME>Oracle 12c</BOOKNAME>
  </Book>

I am using RHEL and puppet 3.7.2

 [root@devopsdev manifests]# cat /etc/release 
  Red Hat Enterprise Linux Server release 6.6 (Santiago)

 [root@devopsdev manifests]# puppet --version
   3.7.4 (Puppet Enterprise 3.7.2)

Thanks in advance

2015-10-26 14:36:15 -0500 received badge  Popular Question (source)
2015-10-26 14:36:15 -0500 received badge  Notable Question (source)
2015-10-26 13:23:48 -0500 received badge  Notable Question (source)
2015-10-26 13:23:48 -0500 received badge  Famous Question (source)
2015-10-26 13:20:57 -0500 received badge  Famous Question (source)
2015-10-26 13:20:57 -0500 received badge  Popular Question (source)
2015-10-26 13:20:57 -0500 received badge  Notable Question (source)
2015-10-26 13:20:22 -0500 received badge  Notable Question (source)
2015-10-26 13:19:27 -0500 received badge  Popular Question (source)
2015-10-26 13:19:27 -0500 received badge  Notable Question (source)
2015-10-06 14:33:33 -0500 received badge  Famous Question (source)
2015-09-03 12:36:20 -0500 received badge  Popular Question (source)
2015-09-02 16:48:34 -0500 commented answer exec not working on windows

Thanks for the response. I had tried this (including the command within exec) first and it did not work. There is definitely something wonky with puppet on windows. From my personal experience what I've seen is that puppet doesn't play very well with Windows.

2015-09-01 16:49:17 -0500 received badge  Famous Question (source)
2015-09-01 16:48:20 -0500 edited question replace strings in a template file

I am trying to automate Oracle Installation which includes parsing and altering the response file (.rsp). Here is a snippet of how it looks:

  MW_HOME=/devops/oracle/dev/11_1_1_7

So basically dev = Environment name, 11_1_1_7 is the version number. These values change depending on the hostname.

I am thinking of using regsubst for replacing the value of environment name and version number. The values will be passed as a variable to the class. My questions are:

  1. Where do I save the .rsp file (under templates folder) or anywhere on the disk.
  2. How do I read the .rsp file?
  3. how we save the variables in the .rsp file so that it can take values from the variables pased to the class. is it like this:

    MW_HOME=/devops/oracle/$environment_name/$version_number.
    

Please let me know.

Thanks R

2015-09-01 16:45:13 -0500 asked a question exec not working on windows

I have a simple class which will add a domain group "domain\netgroups" to the loca administrators group on a Windows server. When I run puppet apply I see the class finishing successfully but the group is not added to the admin group. I kindly request to let me know what am I missing.

Thanks a lot

class alter_admin_group {
$command="net localgroup Administrators domain\netgroups add"
 if $::osfamily == 'windows' {
  exec { 'Alter_Admin_group':
  command => "C:\\windows\\system32\\cmd.exe /c ${command}",
  group => 'Administrators',
    }
  }
 }
2015-08-31 16:54:41 -0500 received badge  Notable Question (source)
2015-08-21 09:57:39 -0500 received badge  Notable Question (source)
2015-08-14 08:03:48 -0500 received badge  Famous Question (source)
2015-08-12 18:15:30 -0500 commented answer Question about regsubst

Ordered the book, thanks Greg.

2015-08-12 18:15:03 -0500 received badge  Popular Question (source)
2015-08-10 00:12:10 -0500 commented answer Question about regsubst

Many thanks Greg, that is exactly what I wanted. I couldn't find this info anywhere on the web, thanks a ton for sharing such a valuable information.

2015-08-07 18:06:37 -0500 received badge  Student (source)
2015-08-07 01:13:27 -0500 marked best answer Question about regsubst

I have a string called $str="mybook", I want to split the string $str into two variables:

Output should like this the first variable should be $str1="my" $str2="book". Equivalent to UNIX command cut-c. This link talks https://docs.puppetlabs.com/reference... talk only if there is a delimiter. My question is what if there is no delimiter?

Thanks in advance

2015-08-07 01:13:20 -0500 commented answer Question about regsubst

Thanks Greg, my string varies it is sometimes mybook or mybooks. This $b = regsubst($a, '^(..)(.*?)$', '\1') will give me first 2 characters, how to extract the next 3 or 4 characters depending on what is present? if it is $a= mybooks I need $c=books $a=mybook I need $c=book. Thanks a million again