From e445c7721498c3a063408108d5bbb6e6745074bb Mon Sep 17 00:00:00 2001 From: Sage Weil Date: Thu, 19 Dec 2019 14:46:22 -0600 Subject: [PATCH] mgr/cephadm: remove old remotes These are not used. Signed-off-by: Sage Weil --- src/pybind/mgr/cephadm/remotes.py | 72 ------------------------------- 1 file changed, 72 deletions(-) diff --git a/src/pybind/mgr/cephadm/remotes.py b/src/pybind/mgr/cephadm/remotes.py index aad5481c629..1c480c105e3 100644 --- a/src/pybind/mgr/cephadm/remotes.py +++ b/src/pybind/mgr/cephadm/remotes.py @@ -22,78 +22,6 @@ def choose_python(): return p return None -def safe_makedirs(path, uid=-1, gid=-1): - """ create path recursively if it doesn't exist """ - try: - os.makedirs(path) - except OSError as e: - if e.errno == errno.EEXIST: - pass - else: - raise - else: - os.chown(path, uid, gid) - -def write_conf(path, conf): - if not os.path.exists(path): - dirpath = os.path.dirname(path) - if os.path.exists(dirpath): - with open(path, "w") as f: - f.write(conf) - os.chmod(path, 0o644) - else: - raise RuntimeError( - "{0} does not exist".format(dirpath)) - -def write_keyring(path, key, overwrite=False, uid=-1, gid=-1): - dirname = os.path.dirname(path) - if not os.path.exists(dirname): - safe_makedirs(dirname, uid, gid) - if not overwrite and os.path.exists(path): - return - with open(path, "wb") as f: - f.write(key.encode('utf-8')) - -def create_mon_path(path, uid=-1, gid=-1): - """create the mon path if it does not exist""" - if not os.path.exists(path): - os.makedirs(path) - os.chown(path, uid, gid); - -def write_file(path, content, mode=0o644, directory=None, uid=-1, gid=-1): - if directory: - if path.startswith("/"): - path = path[1:] - path = os.path.join(directory, path) - if os.path.exists(path): - # Delete file in case we are changing its mode - os.unlink(path) - with os.fdopen(os.open(path, os.O_WRONLY | os.O_CREAT, mode), 'wb') as f: - f.write(content.encode('utf-8')) - os.chown(path, uid, gid) - -def path_getuid(path): - return os.stat(path).st_uid - -def path_getgid(path): - return os.stat(path).st_gid - -def which(executable): - """find the location of an executable""" - locations = ( - '/usr/local/bin', - '/bin', - '/usr/bin', - '/usr/local/sbin', - '/usr/sbin', - '/sbin', - ) - - for location in locations: - executable_path = os.path.join(location, executable) - if os.path.exists(executable_path) and os.path.isfile(executable_path): - return executable_path - if __name__ == '__channelexec__': for item in channel: # type: ignore channel.send(eval(item)) # type: ignore -- 2.39.5