]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
cephadm: use DEFAULT_MODE constant at additional locations 51946/head
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 6 Jun 2023 17:26:35 +0000 (13:26 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Tue, 6 Jun 2023 18:32:44 +0000 (14:32 -0400)
Now that we have a DEFAULT_MODE constant we can replace other locations
where 0o600 is used with the constant.

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/cephadm.py

index 26ce0c13d53b6bce14ed2e3fbdcac320e8b27f69..b198e175d06e960b527ec09ef305f6c531022588 100755 (executable)
@@ -6063,7 +6063,7 @@ def registry_login(ctx: CephadmContext, url: Optional[str], username: Optional[s
             cmd.append('--authfile=/etc/ceph/podman-auth.json')
         out, _, _ = call_throws(ctx, cmd)
         if isinstance(engine, Podman):
-            os.chmod('/etc/ceph/podman-auth.json', 0o600)
+            os.chmod('/etc/ceph/podman-auth.json', DEFAULT_MODE)
     except Exception:
         raise Error('Failed to login to custom registry @ %s as %s with given password' % (ctx.registry_url, ctx.registry_username))
 
@@ -7657,7 +7657,7 @@ def authorize_ssh_key(ssh_pub_key: str, ssh_user: str) -> bool:
 
     with open(auth_keys_file, 'a') as f:
         os.fchown(f.fileno(), ssh_uid, ssh_gid)  # just in case we created it
-        os.fchmod(f.fileno(), 0o600)  # just in case we created it
+        os.fchmod(f.fileno(), DEFAULT_MODE)  # just in case we created it
         if add_newline:
             f.write('\n')
         f.write(ssh_pub_key + '\n')
@@ -7676,7 +7676,7 @@ def revoke_ssh_key(key: str, ssh_user: str) -> None:
         _, filename = tempfile.mkstemp()
         with open(filename, 'w') as f:
             os.fchown(f.fileno(), ssh_uid, ssh_gid)
-            os.fchmod(f.fileno(), 0o600)  # secure access to the keys file
+            os.fchmod(f.fileno(), DEFAULT_MODE)  # secure access to the keys file
             for line in lines:
                 if line.strip() == key.strip():
                     deleted = True