Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
MKCLOS
Core Development Platform
coreospackage
Commits
e7981550
Commit
e7981550
authored
6 years ago
by
Ajit Jagtap
Browse files
Options
Downloads
Plain Diff
Merge branch 'GetAttributeBasedHash' into 'master'
changes in Download Helper See merge request
!52
parents
61ddc99a
ce76ad36
Branches
Branches containing commit
1 merge request
!52
changes in Download Helper
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
downloadhelper/downloadHelper.go
+29
-0
downloadhelper/downloadHelper.go
with
29 additions
and
0 deletions
downloadhelper/downloadHelper.go
+
29
−
0
View file @
e7981550
...
...
@@ -117,6 +117,12 @@ func DownloadFile(sourcePath, destinationPath, jwtToken string, retryCnt int) (b
logginghelper
.
LogError
(
"Error while closing response : "
,
closeErr
)
}
logginghelper
.
LogDebug
(
"DownloadFile : Download Successful"
)
timeStampChangeError
:=
changeFileTimes
(
resp
,
destinationPath
)
if
timeStampChangeError
!=
nil
{
logginghelper
.
LogError
(
"Error while changing timestamp for file : "
,
destinationPath
,
" : "
,
timeStampChangeError
)
}
DeleteBackup
(
destinationPath
)
logginghelper
.
LogDebug
(
"OUT : DownloadFile"
)
return
true
,
nil
...
...
@@ -197,3 +203,26 @@ func DeleteBackup(filePath string) error {
logginghelper
.
LogDebug
(
"OUT : DeleteBackup"
)
return
nil
}
func
changeFileTimes
(
resp
*
grab
.
Response
,
destination
string
)
error
{
logginghelper
.
LogDebug
(
"IN : ChangeFileTimes"
)
timeHeader
:=
resp
.
HTTPResponse
.
Header
.
Get
(
"Last-Modified"
)
logginghelper
.
LogInfo
(
"Header Time:"
,
timeHeader
)
timeUTC
,
parseError
:=
time
.
Parse
(
"Mon, 02 Jan 2006 15:04:05 GMT"
,
timeHeader
)
if
parseError
!=
nil
{
logginghelper
.
LogError
(
parseError
)
return
parseError
}
localtime
:=
timeUTC
.
Local
()
logginghelper
.
LogInfo
(
"Local Time:"
,
localtime
)
changeError
:=
os
.
Chtimes
(
destination
,
localtime
,
localtime
)
if
changeError
!=
nil
{
logginghelper
.
LogError
(
changeError
)
return
changeError
}
logginghelper
.
LogDebug
(
"OUT : ChangeFileTimes"
)
return
nil
}
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets