kmisc 2.1.112__tar.gz → 2.1.114__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {kmisc-2.1.112 → kmisc-2.1.114}/PKG-INFO +1 -1
- {kmisc-2.1.112 → kmisc-2.1.114}/kmisc/__init__.py +86 -63
- {kmisc-2.1.112 → kmisc-2.1.114}/kmisc.egg-info/PKG-INFO +1 -1
- {kmisc-2.1.112 → kmisc-2.1.114}/LICENSE +0 -0
- {kmisc-2.1.112 → kmisc-2.1.114}/README.md +0 -0
- {kmisc-2.1.112 → kmisc-2.1.114}/kmisc.egg-info/SOURCES.txt +0 -0
- {kmisc-2.1.112 → kmisc-2.1.114}/kmisc.egg-info/dependency_links.txt +0 -0
- {kmisc-2.1.112 → kmisc-2.1.114}/kmisc.egg-info/top_level.txt +0 -0
- {kmisc-2.1.112 → kmisc-2.1.114}/pyproject.toml +0 -0
- {kmisc-2.1.112 → kmisc-2.1.114}/setup.cfg +0 -0
- {kmisc-2.1.112 → kmisc-2.1.114}/setup.py +0 -0
@@ -905,63 +905,67 @@ class FILE:
|
|
905
905
|
return True
|
906
906
|
|
907
907
|
def MkTemp(self,filename=None,suffix='-XXXXXXXX',opt='dry',base_dir='/tmp',custom=None,force=False):
|
908
|
-
if
|
909
|
-
filename=
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
908
|
+
if isinstance(filename,str) and filename:
|
909
|
+
filename='{}{}'.format(filename,suffix)
|
910
|
+
return MkTemp(filename=filename,opt=opt,base_dir=base_dir,force=force)
|
911
|
+
#def MkTemp(self,filename=None,suffix='-XXXXXXXX',opt='dry',base_dir='/tmp',custom=None,force=False):
|
912
|
+
# if IsNone(filename):
|
913
|
+
# filename=os.path.join(base_dir,Random(length=len(suffix)-1,strs=custom,mode='str'))
|
914
|
+
# dir_name=os.path.dirname(filename)
|
915
|
+
# file_name=os.path.basename(filename)
|
916
|
+
# name, ext = os.path.splitext(file_name)
|
917
|
+
# if type(suffix) is not str or force is True:
|
918
|
+
# suffix='-XXXXXXXX'
|
919
|
+
# num_type='.%0{}d'.format(len(suffix)-1)
|
920
|
+
# if dir_name == '.':
|
921
|
+
# dir_name=os.path.dirname(os.path.realpath(__file__))
|
922
|
+
# elif dir_name == '':
|
923
|
+
# dir_name=base_dir
|
924
|
+
# def new_name(name,ext=None,ext2=None):
|
925
|
+
# if ext:
|
926
|
+
# if ext2:
|
927
|
+
# return '{}{}{}'.format(name,ext,ext2)
|
928
|
+
# return '{}{}'.format(name,ext)
|
929
|
+
# if ext2:
|
930
|
+
# return '{}{}'.format(name,ext2)
|
931
|
+
# return name
|
932
|
+
# def new_dest(dest_dir,name,ext=None,force=False):
|
933
|
+
# if os.path.isdir(dest_dir) is False:
|
934
|
+
# return False
|
935
|
+
# i=0
|
936
|
+
# new_file=new_name(name,ext)
|
937
|
+
# while True:
|
938
|
+
# rfile=os.path.join(dest_dir,new_file)
|
939
|
+
# if force is False and os.path.exists(rfile) is False:
|
940
|
+
# return rfile
|
941
|
+
# force=False
|
942
|
+
# if suffix:
|
943
|
+
# if '0' in suffix or 'n' in suffix or 'N' in suffix:
|
944
|
+
# if suffix[-1] not in ['0','n']:
|
945
|
+
# new_file=new_name(name,num_type%i,ext)
|
946
|
+
# else:
|
947
|
+
# new_file=new_name(name,ext,num_type%i)
|
948
|
+
# elif 'x' in suffix or 'X' in suffix:
|
949
|
+
# rnd_str='.{}'.format(Random(length=len(suffix)-1,mode='str'))
|
950
|
+
# if suffix[-1] not in ['X','x']:
|
951
|
+
# new_file=new_name(name,rnd_str,ext)
|
952
|
+
# else:
|
953
|
+
# new_file=new_name(name,ext,rnd_str)
|
954
|
+
# else:
|
955
|
+
# if i == 0:
|
956
|
+
# new_file=new_name(name,ext,'.{}'.format(suffix))
|
957
|
+
# else:
|
958
|
+
# new_file=new_name(name,ext,'.{}.{}'.format(suffix,i))
|
959
|
+
# else:
|
960
|
+
# new_file=new_name(name,ext,'.{}'.format(i))
|
961
|
+
# i+=1
|
962
|
+
# new_dest_file=new_dest(dir_name,name,ext,force=force)
|
963
|
+
# if opt in ['file','f']:
|
964
|
+
# os.mknode(new_dest_file)
|
965
|
+
# elif opt in ['dir','d','directory']:
|
966
|
+
# os.mkdir(new_dest_file)
|
967
|
+
# else:
|
968
|
+
# return new_dest_file
|
965
969
|
|
966
970
|
def SetIdentity(self,path,**opts):
|
967
971
|
if os.path.exists(path):
|
@@ -1808,8 +1812,10 @@ class SCREEN:
|
|
1808
1812
|
def Log(self,title,cmd):
|
1809
1813
|
# ipmitool -I lanplus -H 172.16.114.80 -U ADMIN -P ADMIN sol activate
|
1810
1814
|
pid=os.getpid()
|
1811
|
-
tmp_file=FILE().MkTemp('/tmp/.slc.{}_{}.cfg'.format(title,pid))
|
1812
|
-
log_file=FILE().MkTemp('/tmp/.screen_ck_{}_{}.log'.format(title,pid))
|
1815
|
+
#tmp_file=FILE().MkTemp('/tmp/.slc.{}_{}.cfg'.format(title,pid))
|
1816
|
+
#log_file=FILE().MkTemp('/tmp/.screen_ck_{}_{}.log'.format(title,pid))
|
1817
|
+
tmp_file=MkTemp('/tmp/.slc.{}_{}.cfg-XXXXXXXX'.format(title,pid))
|
1818
|
+
log_file=MkTemp('/tmp/.screen_ck_{}_{}.log-XXXXXXX'.format(title,pid))
|
1813
1819
|
if os.path.isfile(log_file):
|
1814
1820
|
log_file=''
|
1815
1821
|
with open(tmp_file,'w') as f:
|
@@ -2054,13 +2060,27 @@ def findXML(xmlfile,find_name=None,find_path=None,default=None,out='xmlobj',get_
|
|
2054
2060
|
return found_root[0]
|
2055
2061
|
return default
|
2056
2062
|
|
2057
|
-
def findPlanCfg(filename,find_name=None,default=False,original=False):
|
2063
|
+
def findPlanCfg(filename,find_name=None,default=False,original=False,date=None):
|
2064
|
+
# date format : include YYYY, MM, DD, hh, mm, ss information
|
2065
|
+
# Check File
|
2066
|
+
if date:
|
2067
|
+
finfo=InfoFile(filename)
|
2068
|
+
if isinstance(finfo,dict) and 'mtime' in finfo:
|
2069
|
+
# If old file then ignore
|
2070
|
+
if TIME(finfo.get('mtime')).Int() < TIME(date).Int():
|
2071
|
+
return default
|
2072
|
+
else:
|
2073
|
+
# Not found file then ignore
|
2074
|
+
return default
|
2075
|
+
# Passed date condition or no date condition then read the file
|
2058
2076
|
data=cat(filename)
|
2059
2077
|
if data is False:
|
2060
2078
|
return default
|
2061
|
-
if find_name
|
2079
|
+
if find_name:
|
2080
|
+
if isinstance(find_name,str):
|
2081
|
+
find_name=find_name.split(',')
|
2062
2082
|
out=[]
|
2063
|
-
for ff in find_name
|
2083
|
+
for ff in find_name:
|
2064
2084
|
found=False
|
2065
2085
|
for i in data.split('\n'):
|
2066
2086
|
if isinstance(i,str) and '=' in i:
|
@@ -3250,7 +3270,10 @@ def sendanmail(to,subj,msg,html=True):
|
|
3250
3270
|
return Email.Send(to,sender='root@sumtester.supermicro.com',title=subj,msg=msg,html=html)
|
3251
3271
|
|
3252
3272
|
def mktemp(filename=None,suffix='-XXXXXXXX',opt='dry',base_dir='/tmp',force=False):
|
3253
|
-
return FILE().MkTemp(filename=filename,suffix=suffix,opt=opt,base_dir=base_dir,force=force)
|
3273
|
+
#return FILE().MkTemp(filename=filename,suffix=suffix,opt=opt,base_dir=base_dir,force=force)
|
3274
|
+
if isinstance(filename,str) and filename:
|
3275
|
+
filename='{}{}'.format(filename,suffix)
|
3276
|
+
return MkTemp(filename=filename,opt=opt,base_dir=base_dir,force=force)
|
3254
3277
|
|
3255
3278
|
def get_host_name():
|
3256
3279
|
return HOST().Name()
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|