@@ -76,6 +76,47 @@ def generate_random_bytes(size: int) -> bytes:
76
76
return rba [:size ]
77
77
78
78
79
+ def get_shares (test_info : dict ) -> typing .List [dict ]:
80
+ """
81
+ Get list of shares
82
+
83
+ Parameters:
84
+ test_info: Dict containing the parsed yaml file.
85
+ Returns:
86
+ list of shares
87
+ """
88
+ if "shares" in test_info :
89
+ return test_info ["shares" ]
90
+
91
+ default_fs = test_info .get ("test_backend" , "" )
92
+ arr = []
93
+ for sharename in test_info .get ("exported_sharenames" , []):
94
+ arr .append ({"name" : sharename , "mntdir" : "" , "fs" : default_fs })
95
+ for share in test_info .get ("exported_shares" , []):
96
+ arr .append (
97
+ {
98
+ "name" : share .get ("name" , "" ),
99
+ "mntdir" : share .get ("mntdir" , "" ),
100
+ "fs" : share .get ("fs" , default_fs ),
101
+ }
102
+ )
103
+ test_info ["shares" ] = arr
104
+ return arr
105
+
106
+
107
+ def is_premounted_share (share : dict ) -> bool :
108
+ """
109
+ Is the share dict a premounted share
110
+
111
+ Paramters:
112
+ share: dict of the share
113
+ Returns:
114
+ bool
115
+ """
116
+ mntdir = share .get ("mntdir" , "" )
117
+ return mntdir != ""
118
+
119
+
79
120
def get_premounted_shares (test_info : dict ) -> typing .List [Path ]:
80
121
"""
81
122
Get list of premounted shares
@@ -85,8 +126,11 @@ def get_premounted_shares(test_info: dict) -> typing.List[Path]:
85
126
Returns:
86
127
list of paths with shares
87
128
"""
88
- premounted_shares = test_info .get ("premounted_shares" , [])
89
- return [Path (mnt ) for mnt in premounted_shares ]
129
+ arr = []
130
+ for share in get_shares (test_info ):
131
+ if is_premounted_share (share ):
132
+ arr .append (Path (share ["mntdir" ]))
133
+ return arr
90
134
91
135
92
136
def get_exported_shares (test_info : dict ) -> typing .List [str ]:
@@ -97,4 +141,8 @@ def get_exported_shares(test_info: dict) -> typing.List[str]:
97
141
Returns:
98
142
list of exported shares
99
143
"""
100
- return test_info .get ("exported_sharenames" , [])
144
+ arr = []
145
+ for share in get_shares (test_info ):
146
+ if not is_premounted_share (share ):
147
+ arr .append (share ["name" ])
148
+ return arr
0 commit comments