@@ -147,43 +147,43 @@ func SetupProwConfig(resourceType string) (project, serviceAccount string) {
147
147
func ForceChmod (instance * remote.InstanceInfo , filePath string , perms string ) error {
148
148
originalumask , err := instance .SSHNoSudo ("umask" )
149
149
if err != nil {
150
- return fmt .Errorf ("failed to umask. Output: %v, errror: %v" , originalumask , err )
150
+ return fmt .Errorf ("failed to umask. Output: %v, errror: %v" , originalumask , err . Error () )
151
151
}
152
152
output , err := instance .SSHNoSudo ("umask" , "0000" )
153
153
if err != nil {
154
- return fmt .Errorf ("failed to umask. Output: %v, errror: %v" , output , err )
154
+ return fmt .Errorf ("failed to umask. Output: %v, errror: %v" , output , err . Error () )
155
155
}
156
156
output , err = instance .SSH ("chmod" , "-R" , perms , filePath )
157
157
if err != nil {
158
- return fmt .Errorf ("failed to chmod file %s. Output: %v, errror: %v" , filePath , output , err )
158
+ return fmt .Errorf ("failed to chmod file %s. Output: %v, errror: %v" , filePath , output , err . Error () )
159
159
}
160
160
output , err = instance .SSHNoSudo ("umask" , originalumask )
161
161
if err != nil {
162
- return fmt .Errorf ("failed to umask. Output: %v, errror: %v" , output , err )
162
+ return fmt .Errorf ("failed to umask. Output: %v, errror: %v" , output , err . Error () )
163
163
}
164
164
return nil
165
165
}
166
166
167
167
func WriteFile (instance * remote.InstanceInfo , filePath , fileContents string ) error {
168
168
output , err := instance .SSHNoSudo ("echo" , fileContents , ">" , filePath )
169
169
if err != nil {
170
- return fmt .Errorf ("failed to write test file %s. Output: %v, errror: %v" , filePath , output , err )
170
+ return fmt .Errorf ("failed to write test file %s. Output: %v, errror: %v" , filePath , output , err . Error () )
171
171
}
172
172
return nil
173
173
}
174
174
175
175
func ReadFile (instance * remote.InstanceInfo , filePath string ) (string , error ) {
176
176
output , err := instance .SSHNoSudo ("cat" , filePath )
177
177
if err != nil {
178
- return "" , fmt .Errorf ("failed to read test file %s. Output: %v, errror: %v" , filePath , output , err )
178
+ return "" , fmt .Errorf ("failed to read test file %s. Output: %v, errror: %v" , filePath , output , err . Error () )
179
179
}
180
180
return output , nil
181
181
}
182
182
183
183
func WriteBlock (instance * remote.InstanceInfo , path , fileContents string ) error {
184
184
output , err := instance .SSHNoSudo ("echo" , fileContents , "|" , "dd" , "of=" + path )
185
185
if err != nil {
186
- return fmt .Errorf ("failed to write test file %s. Output: %v, errror: %v" , path , output , err )
186
+ return fmt .Errorf ("failed to write test file %s. Output: %v, errror: %v" , path , output , err . Error () )
187
187
}
188
188
return nil
189
189
}
@@ -192,15 +192,15 @@ func ReadBlock(instance *remote.InstanceInfo, path string, length int) (string,
192
192
lengthStr := strconv .Itoa (length )
193
193
output , err := instance .SSHNoSudo ("dd" , "if=" + path , "bs=" + lengthStr , "count=1" , "2>" , "/dev/null" )
194
194
if err != nil {
195
- return "" , fmt .Errorf ("failed to read test file %s. Output: %v, errror: %v" , path , output , err )
195
+ return "" , fmt .Errorf ("failed to read test file %s. Output: %v, errror: %v" , path , output , err . Error () )
196
196
}
197
197
return output , nil
198
198
}
199
199
200
200
func GetFSSizeInGb (instance * remote.InstanceInfo , mountPath string ) (int64 , error ) {
201
201
output , err := instance .SSH ("df" , "--output=size" , "-BG" , mountPath , "|" , "awk" , "'NR==2'" )
202
202
if err != nil {
203
- return - 1 , fmt .Errorf ("failed to get size of path %s. Output: %v, error: %v" , mountPath , output , err )
203
+ return - 1 , fmt .Errorf ("failed to get size of path %s. Output: %v, error: %v" , mountPath , output , err . Error () )
204
204
}
205
205
output = strings .TrimSuffix (strings .TrimSpace (output ), "G" )
206
206
n , err := strconv .ParseInt (output , 10 , 64 )
@@ -213,7 +213,7 @@ func GetFSSizeInGb(instance *remote.InstanceInfo, mountPath string) (int64, erro
213
213
func GetBlockSizeInGb (instance * remote.InstanceInfo , devicePath string ) (int64 , error ) {
214
214
output , err := instance .SSH ("blockdev" , "--getsize64" , devicePath )
215
215
if err != nil {
216
- return - 1 , fmt .Errorf ("failed to get size of path %s. Output: %v, error: %v" , devicePath , output , err )
216
+ return - 1 , fmt .Errorf ("failed to get size of path %s. Output: %v, error: %v" , devicePath , output , err . Error () )
217
217
}
218
218
n , err := strconv .ParseInt (strings .TrimSpace (output ), 10 , 64 )
219
219
if err != nil {
@@ -225,31 +225,31 @@ func GetBlockSizeInGb(instance *remote.InstanceInfo, devicePath string) (int64,
225
225
func Symlink (instance * remote.InstanceInfo , src , dest string ) error {
226
226
output , err := instance .SSH ("ln" , "-s" , src , dest )
227
227
if err != nil {
228
- return fmt .Errorf ("failed to symlink from %s to %s. Output: %v, errror: %v" , src , dest , output , err )
228
+ return fmt .Errorf ("failed to symlink from %s to %s. Output: %v, errror: %v" , src , dest , output , err . Error () )
229
229
}
230
230
return nil
231
231
}
232
232
233
233
func RmAll (instance * remote.InstanceInfo , filePath string ) error {
234
234
output , err := instance .SSH ("rm" , "-rf" , filePath )
235
235
if err != nil {
236
- return fmt .Errorf ("failed to delete all %s. Output: %v, errror: %v" , filePath , output , err )
236
+ return fmt .Errorf ("failed to delete all %s. Output: %v, errror: %v" , filePath , output , err . Error () )
237
237
}
238
238
return nil
239
239
}
240
240
241
241
func MkdirAll (instance * remote.InstanceInfo , dir string ) error {
242
242
output , err := instance .SSH ("mkdir" , "-p" , dir )
243
243
if err != nil {
244
- return fmt .Errorf ("failed to mkdir -p %s. Output: %v, errror: %v" , dir , output , err )
244
+ return fmt .Errorf ("failed to mkdir -p %s. Output: %v, errror: %v" , dir , output , err . Error () )
245
245
}
246
246
return nil
247
247
}
248
248
249
249
func CopyFile (instance * remote.InstanceInfo , src , dest string ) error {
250
250
output , err := instance .SSH ("cp" , src , dest )
251
251
if err != nil {
252
- return fmt .Errorf ("failed to copy %s to %s. Output: %v, errror: %v" , src , dest , output , err )
252
+ return fmt .Errorf ("failed to copy %s to %s. Output: %v, errror: %v" , src , dest , output , err . Error () )
253
253
}
254
254
return nil
255
255
}
@@ -273,7 +273,7 @@ func ValidateLogicalLinkIsDisk(instance *remote.InstanceInfo, link, diskName str
273
273
274
274
devFsPath , err := instance .SSH ("find" , link , "-printf" , "'%l'" )
275
275
if err != nil {
276
- return false , fmt .Errorf ("failed to find symbolic link for %s. Output: %v, errror: %v" , link , devFsPath , err )
276
+ return false , fmt .Errorf ("failed to find symbolic link for %s. Output: %v, errror: %v" , link , devFsPath , err . Error () )
277
277
}
278
278
if len (devFsPath ) == 0 {
279
279
return false , nil
@@ -282,7 +282,7 @@ func ValidateLogicalLinkIsDisk(instance *remote.InstanceInfo, link, diskName str
282
282
fullDevPath := path .Join ("/dev/" , string (sdx ))
283
283
scsiIDOut , err := instance .SSH ("/lib/udev_containerized/scsi_id" , "--page=0x83" , "--whitelisted" , fmt .Sprintf ("--device=%v" , fullDevPath ))
284
284
if err != nil {
285
- return false , fmt .Errorf ("failed to find %s's SCSI ID. Output: %v, errror: %v" , devFsPath , scsiIDOut , err )
285
+ return false , fmt .Errorf ("failed to find %s's SCSI ID. Output: %v, errror: %v" , devFsPath , scsiIDOut , err . Error () )
286
286
}
287
287
scsiID := scsiRegex .FindStringSubmatch (scsiIDOut )
288
288
if len (scsiID ) == 0 {
@@ -296,7 +296,7 @@ func ValidateLogicalLinkIsDisk(instance *remote.InstanceInfo, link, diskName str
296
296
fullDevPath := path .Join ("/dev/" , string (nvmex ))
297
297
nvmeIDOut , err := instance .SSH ("/lib/udev_containerized/google_nvme_id" , fmt .Sprintf ("-d%v" , fullDevPath ))
298
298
if err != nil {
299
- return false , fmt .Errorf ("failed to find %s's NVME ID. Output: %v, errror: %v" , devFsPath , nvmeIDOut , err )
299
+ return false , fmt .Errorf ("failed to find %s's NVME ID. Output: %v, errror: %v" , devFsPath , nvmeIDOut , err . Error () )
300
300
}
301
301
nvmeID := nvmeSerialRegex .FindStringSubmatch (nvmeIDOut )
302
302
if len (nvmeID ) == 0 {
0 commit comments