python-provy / provy

provy is a provisioning system in python.

Home Page:http://docs.provy.me

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does ensure_line should really change owner?

jbzdak opened this issue · comments

Here is the logic --- depending on the contents of the file it might, or might not update the owner of this file.

def ensure_line(self, line, file_path,  owner=None, sudo=False):
        owner_user = owner or self.context['owner']
        if not self.has_line(line, file_path):
            self.execute('echo "%s" >> %s' % (line, file_path), stdout=False, sudo=sudo)
            self.change_file_owner(file_path, owner_user)
            self.log('Line "%s" not found in %s. Adding it.' % (line, file_path))

Hmmm... this is a good point, I think we should classify it as a bug, what do you think?

+1

On Fri, Oct 19, 2012 at 1:52 AM, Diogo Baeder notifications@github.comwrote:

Hmmm... this is a good point, I think we should classify it as a bug, what
do you think?


Reply to this email directly or view it on GitHubhttps://github.com/heynemann/provy/issues/69#issuecomment-9589841.

Fixed. Now ensure_line doesn't change ownership anymore (this should be done explicitly by the user), and the "owner" parameter is the "user" passed to "execute", so that the line is added with the intended user that runs the command.