diff --git a/opt/ahenk/base/file/ssh_file_transfer.py b/opt/ahenk/base/file/ssh_file_transfer.py index 3b05582..658c29b 100644 --- a/opt/ahenk/base/file/ssh_file_transfer.py +++ b/opt/ahenk/base/file/ssh_file_transfer.py @@ -40,7 +40,6 @@ class Ssh(object): try: sftp.chdir(self.target_path) # Test if remote_path exists except IOError: - print(self.target_path) sftp.mkdir(self.target_path) # Create remote_path sftp.chdir(self.target_path) diff --git a/opt/ahenk/base/system/system.py b/opt/ahenk/base/system/system.py index c7ae0a9..3deddc2 100644 --- a/opt/ahenk/base/system/system.py +++ b/opt/ahenk/base/system/system.py @@ -41,6 +41,13 @@ class System: config.read(System.Ahenk.config_path()) return config.get('BASE', 'dbPath') + @staticmethod + def uid(): + config = configparser.ConfigParser() + config._interpolation = configparser.ExtendedInterpolation() + config.read(System.Ahenk.config_path()) + return config.get('CONNECTION', 'uid') + @staticmethod def plugins_path(): config = configparser.ConfigParser() @@ -89,7 +96,7 @@ class System: def received_dir_path(): path = '/tmp/.ahenk/' if Util.is_exist(path) is False: - #TODO write permission add + # TODO write permission add Util.create_directory(path) return path @@ -330,7 +337,8 @@ class System: for iface in psutil.net_io_counters(pernic=True): f = os.popen('ifconfig {} | grep "inet\ addr" | cut -d: -f2 | cut -d" " -f1'.format(iface)) ip = str(f.read()).replace('\n', '') - if re.match(r'^((\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])$', ip) and str(ip) != 'localhost' and str(ip) != '127.0.0.1': + if re.match(r'^((\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])$', + ip) and str(ip) != 'localhost' and str(ip) != '127.0.0.1': arr.append(ip) return arr @@ -355,7 +363,8 @@ class System: try: addr_list = psutil.net_if_addrs() mac = addr_list[str(iface)][2][1] - if re.match("[0-9a-f]{2}([-:])[0-9a-f]{2}(\\1[0-9a-f]{2}){4}$", mac.lower()) and str(mac) != '00:00:00:00:00:00': + if re.match("[0-9a-f]{2}([-:])[0-9a-f]{2}(\\1[0-9a-f]{2}){4}$", mac.lower()) and str( + mac) != '00:00:00:00:00:00': arr.append(mac.lower()) except Exception as e: pass @@ -371,7 +380,8 @@ class System: arr = [] for iface in psutil.net_io_counters(pernic=True): ip = psutil.net_if_addrs()[str(iface)][0][1] - if re.match(r'^((\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])$', ip) and str(ip) != 'localhost' and str(ip) != '127.0.0.1': + if re.match(r'^((\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])\.){3}(\d{1,2}|1\d{2}|2[0-4]\d|25[0-5])$', ip) and str( + ip) != 'localhost' and str(ip) != '127.0.0.1': arr.append(ip) return arr diff --git a/opt/ahenk/base/util/util.py b/opt/ahenk/base/util/util.py index 5370ffd..48b0f83 100644 --- a/opt/ahenk/base/util/util.py +++ b/opt/ahenk/base/util/util.py @@ -255,3 +255,10 @@ class Util: if attr_name in j: return True return False + + @staticmethod + def install_package(package_name, package_version): + command = "sudo apt-get --yes --force-yes install {0}={1}".format(package_name, package_version) + result_code, p_out, p_err = Util.execute(command) + return result_code, p_out, p_err + diff --git a/opt/ahenk/plugins/package-manager b/opt/ahenk/plugins/package-manager new file mode 120000 index 0000000..e4cd6ea --- /dev/null +++ b/opt/ahenk/plugins/package-manager @@ -0,0 +1 @@ +/home/cemre/git/lider-ahenk-package-manager-plugin/ahenk-package-manager/package-manager \ No newline at end of file