Thanks for pointing it out, Eric. I'll take a look and fix it. Sent from my iPhone
On Nov 29, 2011, at 8:51 PM, Eric Yang <[email protected]> wrote: > It looks like the latest change to FileUtil is changing ambari agent > process umask after file has been created. The umask should be > restored to existing umask after the process is done creating the > files. This prevents untracked umask changes lingering in the system. > What is the reason to preserve umask change? > > regards, > Eric > > ---------- Forwarded message ---------- > From: <[email protected]> > Date: Tue, Nov 29, 2011 at 8:22 PM > Subject: svn commit: r1208264 - in /incubator/ambari/trunk: > agent/src/main/python/ambari_agent/ > controller/src/main/java/org/apache/ambari/controller/ > controller/src/main/java/org/apache/ambari/resource/statemachine/ > To: [email protected] > > > Author: ddas > Date: Wed Nov 30 04:22:15 2011 > New Revision: 1208264 > > URL: http://svn.apache.org/viewvc?rev=1208264&view=rev > Log: > Follow-up commit to AMBARI-140 > > Modified: > incubator/ambari/trunk/agent/src/main/python/ambari_agent/FileUtil.py > URL: > http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/main/python/ambari_agent/FileUtil.py?rev=1208264&r1=1208263&r2=1208264&view=diff > ============================================================================== > --- incubator/ambari/trunk/agent/src/main/python/ambari_agent/FileUtil.py > (original) > +++ incubator/ambari/trunk/agent/src/main/python/ambari_agent/FileUtil.py > Wed Nov 30 04:22:15 2011 > @@ -36,11 +36,18 @@ def writeFile(action, result): > oldCwd = os.getcwd() > fileInfo = action['file'] > try: > - path = > AmbariConfig.config.get('agent','prefix')+"/clusters/"+action['clusterId']+"-"+action['role'] > + if fileInfo['path'].startswith('/'): > + path = fileInfo['path'] > + else: > + path = > AmbariConfig.config.get('agent','prefix')+"/clusters/"+action['clusterId']+"-"+action['role'] > logger.info("path: %s" % path) > os.chdir(path) > user=fileInfo['owner'] > + if user is None: > + user=getpass.getuser() > group=fileInfo['group'] > + if group is None: > + group=getpass.getgroup() > filename=fileInfo['path'] > content=fileInfo['data'] > try: > @@ -50,9 +57,15 @@ def writeFile(action, result): > group=getgrnam(group)[2] > except Exception: > logger.warn("can not find user uid/gid: (%s/%s) for writing %s" > % (user, group, filename)) > - permission=int(fileInfo['permission']) > - umask=int(fileInfo['umask']) > + if fileInfo['permission'] is not None: > + permission=int(fileInfo['permission'],8) > + else: > + permission=0750 > oldMask = os.umask(0) > + if fileInfo['umask'] is not None: > + umask=int(fileInfo['umask']) > + else: > + umask=oldMask > os.umask(int(umask)) > prefix = os.path.dirname(filename) > try:
