On 18/11/2011, at 13:14, Michael Mraka wrote:

> Marcelo Moreira de Mello wrote:
> %   Basically the problem happens when you have a configuration channel
> %   which provides a directory as a symlink, the rhncfg-client get
> 
> A directory as a symlink - do you mean a link that points to a directory?
Correct.
> 
> %   command works for the first time. When trying to redeploy the files
> %   again, rhncfg-client get fails and rollback the files since since
> %   shutil.copy() fails to overwrite the existing symlink directory. The
> %   issue does not happen when the symlink is a file. 
> 
> This issue has been already addressed (by commit
> 06a1f13b03f569c6a251e5fbe45069e6b8bb0c9f as stated in the bugzilla).
> Is there a case where it doesn't work? What issue not covered by the
> current fix does the new patch solve?
Even having the commit 06a1f13b03f569c6a251e5fbe45069e6b8bb0c9f applied, the 
issue is not totally covered. Look below: 

# grep "if os.path.isdir(path) and not os.path.islink(path):" 
/usr/share/rhn/config_common/transactions.py -A10 -B10
            for dep_file in self.files:
                path = dep_file['path']

                log_debug(6, "writing new version of %s to tmp file ..." % path)
                # make any directories needed...
                #
                # TODO:  it'd be nice if this had a hook for letting me know
                # which ones are created... then i could clean created
                # dirs on rollback
                (directory, filename) = os.path.split(path)
                if os.path.isdir(path) and not os.path.islink(path):
                    raise cfg_exceptions.FileEntryIsDirectory(path)
                if not os.path.exists(directory) and os.path.isdir(directory):
                    log_debug(7, "creating directories for %s ..." % directory)
                    dirs_created = utils.mkdir_p(directory)
                    self.new_dirs.extend(dirs_created)
                    log_debug(7, "directories created and added to list for 
rollback")
                
                # write the new contents to a tmp file, and store the path of 
the
                # new tmp file by it's eventual target path
                self.newtemp_by_path[path], temp_new_dirs = 
fp.process(dep_file, os.path.sep)

# rhncfg-client elist
Mode          Owner Group          Size Rev      Config Channel    File
lrwxrwxrwx     root root             14   1               teste    
/boot/cross-dir -> /usr/local/bin
lrwxrwxrwx     root root             11   2               teste    
/boot/cross-link -> /etc/passwd
-rw-r--r--     root root             15   1                    teste    
/etc/test-file-regular
lrwxrwxrwx     root root             10   2               teste    
/root/sym-link-same-part -> /etc/hosts
lrwxrwxrwx     root root              4   1                teste    /teste -> 
/tmp

# rhncfg-client get /teste
Deploying /teste

# ls -lah /teste
lrwxrwxrwx 1 root root 4 Nov 18 13:26 /teste -> /tmp

# rhncfg-client get /teste
Deploy failed, rollback successful

After applying the patch proposed, the re-deploymented worked as expected

# rm -f /teste ; rhncfg-client get /teste ; ls -la /teste ; rhncfg-client get 
/teste ; ls -la /teste
Deploying /teste
lrwxrwxrwx 1 root root 4 Nov 18 13:28 /teste -> /tmp
Deploying /teste
lrwxrwxrwx 1 root root 4 Nov 18 13:29 /teste -> /tmp


  Thanks Michael. 

  Best, 
mmello


> 
> Regards,
> 
> 
> --
> Michael Mráka
> Satellite Engineering, Red Hat
> 
> _______________________________________________
> Spacewalk-devel mailing list
> Spacewalk-devel@redhat.com
> https://www.redhat.com/mailman/listinfo/spacewalk-devel


_______________________________________________
Spacewalk-devel mailing list
Spacewalk-devel@redhat.com
https://www.redhat.com/mailman/listinfo/spacewalk-devel

Reply via email to