Working on Copr, I want to replace/add one line in file. I spent more
then hour trying various things, but I'm out of ideas.
What I'm trying to do is:
self.conn.module_name = "lineinfile"
self.conn.module_args = "dest=/etc/mock/%s.cfg
line=\"config_opts['chroot_setup_cmd'] = 'install @build %s'\"
regexp=\"^.*chroot_setup_cmd.*$\"" % (self.chroot, self.buildroot_pkgs)
Which in yaml language should be (with placeholders expanded):
- name: putting scl-utils-build into minimal buildroot of fedora-19-i386
lineinfile:
dest=/etc/mock/fedora-19-i386.cfg
line="config_opts['chroot_setup_cmd'] = 'install @build
scl-utils-build'"
regexp="^.*chroot_setup_cmd.*$"
I tried several things - among all:
- change regexp
- do not use regexp at all as that should put $line at the end of
file, which would work as well
- use command module with sed, but there is too much of escaping and
it is unreadable
Can somebody advise me what should be correct form to replace or add
that line to mock config please?
--
Miroslav Suchy, RHCE, RHCDS
Red Hat, Software Engineer, #brno, #devexp, #fedora-buildsys
_______________________________________________
infrastructure mailing list
infrastructure@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/infrastructure