Revert "Revert "oran-shell-release: release image for F""
[pti/rtp.git] / meta-starlingx / meta-stx-cloud / recipes-devtools / python / files / python-keyring / lock_keyring_file2.patch
1 Index: keyring-5.3/keyring/backends/file.py
2 ===================================================================
3 --- keyring-5.3.orig/keyring/backends/file.py
4 +++ keyring-5.3/keyring/backends/file.py
5 @@ -92,10 +92,6 @@ class BaseKeyring(FileBacked, KeyringBac
6          # ensure the file exists
7          self._ensure_file_path()
8  
9 -        # load the keyring from the disk
10 -        config = configparser.RawConfigParser()
11 -        config.read(self.file_path)
12 -
13          # obtain lock for the keyring file
14          lock = ''
15          i = 60
16 @@ -107,15 +103,21 @@ class BaseKeyring(FileBacked, KeyringBac
17                  time.sleep(0.500)
18                  i=i-1
19  
20 -        # update the keyring with the password
21 -        if not config.has_section(service):
22 -            config.add_section(service)
23 -        config.set(service, username, password_base64)
24  
25          if i:
26 -            # save the keyring back to the file
27 +            # Load the keyring from the disk
28 +            config = configparser.RawConfigParser()
29 +            config.read(self.file_path)
30 +
31 +            # Update the keyring with the password
32 +            if not config.has_section(service):
33 +                config.add_section(service)
34 +            config.set(service, username, password_base64)
35 +
36 +            # Save the keyring back to the file
37              with open(self.file_path, 'w') as config_file:
38                  config.write(config_file)
39 +
40              lock.close()
41              os.remove('/tmp/.keyringlock')
42