Re: select_region regex not working since upgrade to 3.18.1

"'Nick Anderson' via help-cfengine" <[email protected]>
Newsgroups gmane.comp.sysutils.cfengine.general
Message-ID <[email protected]>
Xander Cage <[email protected]> writes:

> hi, i have this rather complex file edit stuff for aix stanza file
>editing and since upgrading to 3.18.1 yesterday, it acts weird. ....
>not sure whats wrong here, something changed in 3.18 maybe?

Hi Chris,

The policy you posted didn't have anything to initalize the
configuration files I believe the issue is related to being unable to
select the /last/ section as it seems to work if I add another section
(`more:') during initialization. So, I think you will need to inject a
dummy section.

,----
| bundle agent init
|  {
|    files:
| 
|        "/tmp/pwdalg_cfg_test.cfg"
|          content => "sshaitsv:$(const.n)more:";
| 
|        "/tmp/cfe_testbed/." create => "true";
| 
|        "/tmp/cfe_testbed/login_cfg_test.cfg"
|          content => "sshaitsv:$(const.n)more:";
|  }      
|  bundle agent post 
|  {
|    reports:
|        "/tmp/pwdalg_cfg_test.cfg"
|          printfile => cat( $(this.promiser) );
|        "/tmp/cfe_testbed/login_cfg_test.cfg"
|          printfile => cat( $(this.promiser) );
|  }      
`----
Listing 1: Additional policy

I also tweaked your main bundle to run the init and post.

,----
| bundle agent __main__
| {
|   methods:
|       "init";
|       "parent_bundle";
|       "post";
| }
`----
Listing 2: Tweaked

I get this output which I think shows what you wanted (sans the `more:'
line).

,----
|     info: Updated content of '/tmp/pwdalg_cfg_test.cfg' with content 'sshaitsv:
| more:'
|     info: Created directory '/tmp/cfe_testbed/.'
|     info: Updated content of '/tmp/cfe_testbed/login_cfg_test.cfg' with content 'sshaitsv:
| more:'
|     info: Inserted the promised line '   lpa_module = /usr/lib/security/ssha' into '/tmp/pwdalg_cfg_test.cfg' after locator
|     info: insert_lines promise '   lpa_module = /usr/lib/security/ssha' repaired
|     info: Edited file '/tmp/pwdalg_cfg_test.cfg'
|     info: Inserted the promised line '   lpa_options = algorithm=sha512,cost_num=10,salt_len=24' into '/tmp/pwdalg_cfg_test.cfg' after locator
|     info: insert_lines promise '   lpa_options = algorithm=sha512,cost_num=10,salt_len=24' repaired
|     info: Edited file '/tmp/pwdalg_cfg_test.cfg'
|    error: The promised end pattern '^(\h*|\H+:)$' was not found when selecting region to insert in '/tmp/cfe_testbed/login_cfg_test.cfg'
|    error: The promised end pattern '^(\h*|\H+:)$' was not found when selecting region to insert in '/tmp/cfe_testbed/login_cfg_test.cfg'
|    error: The promised end pattern '^(\h*|\H+:)$' was not found when selecting region to insert in '/tmp/cfe_testbed/login_cfg_test.cfg'
|     info: Inserted the promised line 'usw:' into '/tmp/cfe_testbed/login_cfg_test.cfg' after locator
|     info: insert_lines promise 'usw:' repaired
|     info: Edited file '/tmp/cfe_testbed/login_cfg_test.cfg'
|    error: The promised end pattern '^(\h*|\H+:)$' was not found when selecting region to insert in '/tmp/cfe_testbed/login_cfg_test.cfg'
|    error: The promised end pattern '^(\h*|\H+:)$' was not found when selecting region to insert in '/tmp/cfe_testbed/login_cfg_test.cfg'
| R: /tmp/pwdalg_cfg_test.cfg
| R: sshaitsv:
| R:    lpa_module = /usr/lib/security/ssha
| R:    lpa_options = algorithm=sha512,cost_num=10,salt_len=24
| R: more:
| R: /tmp/cfe_testbed/login_cfg_test.cfg
| R: sshaitsv:
| R: more:
| R: usw:
`----

-- 
You received this message because you are subscribed to the Google Groups "help-cfengine" 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/help-cfengine/87y22qh1lz.fsf%40northern.tech.

-- 
Nick Anderson | Doer of Things | (+1) 785-550-1767 | https://northern.tech

-- 
You received this message because you are subscribed to the Google Groups "help-cfengine" 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/help-cfengine/87y22qh1lz.fsf%40northern.tech.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.