Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
0dac3e12
Commit
0dac3e12
authored
Nov 12, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #16969 from smarterclayton/fix_secret_in_container
Auto commit by PR queue bot
parents
56ff9061
8c1d8204
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
writer.go
pkg/util/io/writer.go
+6
-3
No files found.
pkg/util/io/writer.go
View file @
0dac3e12
...
...
@@ -17,6 +17,7 @@ limitations under the License.
package
io
import
(
"bytes"
"fmt"
"io/ioutil"
"os"
...
...
@@ -49,6 +50,7 @@ func (writer *StdWriter) WriteFile(filename string, data []byte, perm os.FileMod
type
NsenterWriter
struct
{
}
// TODO: should take a writer, not []byte
func
(
writer
*
NsenterWriter
)
WriteFile
(
filename
string
,
data
[]
byte
,
perm
os
.
FileMode
)
error
{
cmd
:=
"nsenter"
base_args
:=
[]
string
{
...
...
@@ -56,10 +58,11 @@ func (writer *NsenterWriter) WriteFile(filename string, data []byte, perm os.Fil
"--"
,
}
echo_args
:=
append
(
base_args
,
"sh"
,
"-c"
,
fmt
.
Sprintf
(
"echo %q | cat > %s"
,
data
,
filename
))
echo_args
:=
append
(
base_args
,
"sh"
,
"-c"
,
fmt
.
Sprintf
(
"cat > %s"
,
filename
))
glog
.
V
(
5
)
.
Infof
(
"Command to write data to file: %v %v"
,
cmd
,
echo_args
)
outputBytes
,
err
:=
exec
.
Command
(
cmd
,
echo_args
...
)
.
CombinedOutput
()
command
:=
exec
.
Command
(
cmd
,
echo_args
...
)
command
.
Stdin
=
bytes
.
NewBuffer
(
data
)
outputBytes
,
err
:=
command
.
CombinedOutput
()
if
err
!=
nil
{
glog
.
Errorf
(
"Output from writing to %q: %v"
,
filename
,
string
(
outputBytes
))
return
err
...
...
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