Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
tosca-definitions-dch
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages & Registries
Packages & Registries
Package Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SustainLife
tosca-definitions-dch
Commits
d25f0f2a
Commit
d25f0f2a
authored
Jul 06, 2019
by
Philip Schildkamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix large file transfer
parent
b018cebc
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
3 deletions
+20
-3
artifacttemplates/http%3A%2F%2Fopentosca.org%2Fartifacttemplates/DockerContainer-IA-Manage/files/org_opentosca_nodetypes_DockerContainer_IA_Manage.war
...les/org_opentosca_nodetypes_DockerContainer_IA_Manage.war
+0
-0
artifacttemplates/http%3A%2F%2Fopentosca.org%2Fartifacttemplates/DockerContainer-IA-Manage/source/src/main/java/org/opentosca/nodetypes/org_opentosca_nodetypes_DockerContainer_IA_Manage.java
...es/org_opentosca_nodetypes_DockerContainer_IA_Manage.java
+20
-3
No files found.
artifacttemplates/http%3A%2F%2Fopentosca.org%2Fartifacttemplates/DockerContainer-IA-Manage/files/org_opentosca_nodetypes_DockerContainer_IA_Manage.war
View file @
d25f0f2a
No preview for this file type
artifacttemplates/http%3A%2F%2Fopentosca.org%2Fartifacttemplates/DockerContainer-IA-Manage/source/src/main/java/org/opentosca/nodetypes/org_opentosca_nodetypes_DockerContainer_IA_Manage.java
View file @
d25f0f2a
package
org.opentosca.nodetypes
;
import
java.io.ByteArrayInputStream
;
import
java.io.ByteArrayOutputStream
;
import
java.io.File
;
import
java.io.IOException
;
...
...
@@ -127,7 +128,7 @@ public class org_opentosca_nodetypes_DockerContainer_IA_Manage extends AbstractI
String
whichSudo
=
executeCommand
(
container
,
"which sudo"
);
if
(
whichSudo
==
null
||
whichSudo
.
isEmpty
())
{
executeCommand
(
container
,
"apt-get update && apt-get -
yq
install sudo"
);
executeCommand
(
container
,
"apt-get update && apt-get -
qy
install sudo"
);
}
}
...
...
@@ -143,8 +144,24 @@ public class org_opentosca_nodetypes_DockerContainer_IA_Manage extends AbstractI
}
private
void
uploadFile
(
Container
container
,
String
fileContent
,
String
targetPath
)
throws
Exception
{
String
base64
=
new
String
(
Base64
.
getEncoder
().
encode
(
fileContent
.
getBytes
()));
executeCommand
(
container
,
"echo '"
+
base64
+
"' | base64 --decode > "
+
targetPath
);
System
.
out
.
println
(
"Uploading file to: '"
+
targetPath
+
"'"
);
Shell
shell
=
new
SshByPassword
(
container
.
host
,
container
.
port
,
container
.
user
,
container
.
pass
);
byte
[]
content
=
fileContent
.
getBytes
();
if
(
content
.
length
<
20480
)
{
String
base64
=
new
String
(
Base64
.
getEncoder
().
encode
(
content
));
shell
.
exec
(
"echo '"
+
base64
+
"' | base64 --decode > "
+
targetPath
,
null
,
null
,
null
);
}
else
{
String
base64
=
null
;
byte
[]
buffer
=
new
byte
[
20480
];
ByteArrayInputStream
stream
=
new
ByteArrayInputStream
(
content
);
while
(
stream
.
read
(
buffer
)
>
0
)
{
base64
=
new
String
(
Base64
.
getEncoder
().
encode
(
buffer
));
shell
.
exec
(
"echo '"
+
base64
+
"' | base64 --decode >> "
+
targetPath
,
null
,
null
,
null
);
buffer
=
new
byte
[
stream
.
available
()
>
20480
?
20480
:
stream
.
available
()];
}
}
}
private
void
waitForAvailability
(
Container
container
)
throws
InterruptedException
,
IOException
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment