#50157 Issue 50152 - Replace os.getenv('HOME') with os.path.expanduser
Closed 3 years ago by spichugi. Opened 5 years ago by spichugi.
spichugi/389-ds-base home_dir  into  master

@@ -778,7 +778,7 @@ 

  

          # first identify the directories we will scan

          sysconfig_head = self.ds_paths.initconfig_dir

-         privconfig_head = os.path.join(os.getenv('HOME'), ENV_LOCAL_DIR)

+         privconfig_head = os.path.expanduser(os.path.join('~', ENV_LOCAL_DIR))

          if not os.path.isdir(sysconfig_head):

              privconfig_head = None

          self.log.debug("dir (sys) : %s", sysconfig_head)

Description: When HOME env var is not set, the call will fail with an exception.
Instead of HOME we can use expanduser method. The expanduser will do the right thing
and get home directory on all platforms from either env vars or password database.

https://pagure.io/389-ds-base/issue/50152

Reviewed by: ?

rebased onto ada2dfd

5 years ago

Pull-Request has been merged by spichugi

5 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This pull request has been cloned to Github as issue and is available here:
- https://github.com/389ds/389-ds-base/issues/3216

If you want to continue to work on the PR, please navigate to the github issue,
download the patch from the attachments and file a new pull request.

Thank you for understanding. We apologize for all inconvenience.

Pull-Request has been closed by spichugi

3 years ago
Metadata