Skip to content

Commit 92f87fa

Browse files
committed
Merge pull request #24 from univ-of-utah-marriott-library-apple/dev
Updated Filesystem information
2 parents 9f61c6a + ea8802b commit 92f87fa

File tree

3 files changed

+44
-10
lines changed

3 files changed

+44
-10
lines changed

management_tools/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import loggers
33
import plist_editor
44

5-
__version__ = '1.8.0'
5+
__version__ = '1.8.1'
66
__all__ = ['app_info', 'fs_analysis', 'loggers', 'plist_editor']
77

88
# This provides the ability to get the version from the command line.

management_tools/fs_analysis.py

+43-9
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def __init__(self, name):
128128
self.__type = None
129129
self.__kblocks = None
130130
self.__kblocks_used = None
131-
self.__kblocks_avail = None
131+
self.__kblocks_free = None
132132
self.__capacity = None
133133
self.__properties = None
134134

@@ -168,14 +168,36 @@ def update(self):
168168
pass
169169
self.__kblocks = info[index]
170170
self.__kblocks_used = info[index + 1]
171-
self.__kblocks_avail = info[index + 2]
172-
self.__capacity = info[index + 3]
171+
self.__kblocks_free = info[index + 2]
172+
self.__capacity = info[index + 3][:-1] # remove the "%" off the end
173173

174174
def __repr__(self):
175+
"""
176+
:return: the identifier used to create this object
177+
"""
178+
return "{}".format(self.name)
179+
180+
def __str__(self):
175181
"""
176182
:return: a string representing this object
177183
"""
178-
return "{} mounted on {}".format(self.name, self.mount_point)
184+
result = (
185+
"{name} mounted on {mount_point}, type: {type}\n"
186+
" total kblocks: {kblocks}\n"
187+
" used kblocks: {kblocks_used}\n"
188+
" available kblocks: {kblocks_free}\n"
189+
" remaining capacity: {capacity}\n"
190+
" other properties: {properties}"
191+
).format(
192+
name = self.name, mount_point = self.mount_point, type = self.type,
193+
kblocks = self.kblocks,
194+
kblocks_used = self.kblocks_used,
195+
kblocks_free = self.kblocks_free,
196+
capacity = self.capacity,
197+
properties = ', '.join(self.properties)
198+
)
199+
200+
return result
179201

180202
########
181203
# PROPERTIES
@@ -198,19 +220,31 @@ def type(self):
198220

199221
@property
200222
def kblocks(self):
201-
return self.__kblocks if self.__kblocks else None
223+
return int(self.__kblocks) if self.__kblocks else None
202224

203225
@property
204226
def kblocks_used(self):
205-
return self.__kblocks_used if self.__kblocks_used else None
227+
return int(self.__kblocks_used) if self.__kblocks_used else None
228+
229+
@property
230+
def kblocks_free(self):
231+
return int(self.__kblocks_free) if self.__kblocks_free else None
232+
233+
@property
234+
def bytes(self):
235+
return 1024 * self.kblocks if self.kblocks else None
236+
237+
@property
238+
def bytes_used(self):
239+
return 1024 * self.kblocks_used if self.kblocks_used else None
206240

207241
@property
208-
def kblocks_avail(self):
209-
return self.__kblocks_avail if self.__kblocks_avail else None
242+
def bytes_free(self):
243+
return 1024 * self.kblocks_free if self.kblocks_free else None
210244

211245
@property
212246
def capacity(self):
213-
return self.__capacity if self.__capacity else None
247+
return int(self.__capacity) if self.__capacity else None
214248

215249
@property
216250
def properties(self):
Binary file not shown.

0 commit comments

Comments
 (0)