summaryrefslogtreecommitdiff
path: root/libpod
diff options
context:
space:
mode:
authorMatthew Heon <matthew.heon@gmail.com>2018-01-06 12:44:33 -0500
committerAtomic Bot <atomic-devel@projectatomic.io>2018-01-08 19:34:21 +0000
commit3d05f100f7be78932242d3d09a88e4a6236a0d3c (patch)
tree357ce1b330fcec96fcc309867a86879e5857b516 /libpod
parent7b08aa78e4ede4c54fda6cd9917bb62e18d0d634 (diff)
downloadpodman-3d05f100f7be78932242d3d09a88e4a6236a0d3c.tar.gz
podman-3d05f100f7be78932242d3d09a88e4a6236a0d3c.tar.bz2
podman-3d05f100f7be78932242d3d09a88e4a6236a0d3c.zip
Save ContainerConfig.User to database
Signed-off-by: Matthew Heon <matthew.heon@gmail.com> Closes: #194 Approved by: rhatdan
Diffstat (limited to 'libpod')
-rw-r--r--libpod/container.go1
-rw-r--r--libpod/sql_state.go7
-rw-r--r--libpod/sql_state_internal.go4
3 files changed, 9 insertions, 3 deletions
diff --git a/libpod/container.go b/libpod/container.go
index 31f84ebb5..66eb4aa2d 100644
--- a/libpod/container.go
+++ b/libpod/container.go
@@ -157,6 +157,7 @@ type ContainerConfig struct {
CreatedTime time.Time `json:"createdTime"`
// User/GID to use within the container
User string `json:"user"`
+
// TODO save log location here and pass into OCI code
// TODO allow overriding of log path
}
diff --git a/libpod/sql_state.go b/libpod/sql_state.go
index ec6818bcf..42fac831b 100644
--- a/libpod/sql_state.go
+++ b/libpod/sql_state.go
@@ -15,7 +15,7 @@ import (
// DBSchema is the current DB schema version
// Increments every time a change is made to the database's tables
-const DBSchema = 5
+const DBSchema = 6
// SQLState is a state implementation backed by a persistent SQLite3 database
type SQLState struct {
@@ -271,7 +271,7 @@ func (s *SQLState) HasContainer(id string) (bool, error) {
func (s *SQLState) AddContainer(ctr *Container) (err error) {
const (
addCtr = `INSERT INTO containers VALUES (
- ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
+ ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
);`
addCtrState = `INSERT INTO containerState VALUES (
?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?
@@ -336,7 +336,8 @@ func (s *SQLState) AddContainer(ctr *Container) (err error) {
timeToSQL(ctr.config.CreatedTime),
ctr.config.RootfsImageID,
ctr.config.RootfsImageName,
- boolToSQL(ctr.config.UseImageConfig))
+ boolToSQL(ctr.config.UseImageConfig),
+ ctr.config.User)
if err != nil {
return errors.Wrapf(err, "error adding static information for container %s to database", ctr.ID())
}
diff --git a/libpod/sql_state_internal.go b/libpod/sql_state_internal.go
index 8513216fa..5904f4254 100644
--- a/libpod/sql_state_internal.go
+++ b/libpod/sql_state_internal.go
@@ -181,6 +181,7 @@ func prepareDB(db *sql.DB) (err error) {
RootfsImageID TEXT NOT NULL,
RootfsImageName TEXT NOT NULL,
UseImageConfig INTEGER NOT NULL,
+ User TEXT NOT NULL,
CHECK (Stdin IN (0, 1)),
CHECK (CreateNetNS IN (0, 1)),
CHECK (UseImageConfig IN (0, 1)),
@@ -290,6 +291,7 @@ func ctrFromScannable(row scannable, runtime *Runtime, specsDir string, lockDir
rootfsImageID string
rootfsImageName string
useImageConfig int
+ user string
state int
configPath string
runDir string
@@ -320,6 +322,7 @@ func ctrFromScannable(row scannable, runtime *Runtime, specsDir string, lockDir
&rootfsImageID,
&rootfsImageName,
&useImageConfig,
+ &user,
&state,
&configPath,
&runDir,
@@ -355,6 +358,7 @@ func ctrFromScannable(row scannable, runtime *Runtime, specsDir string, lockDir
ctr.config.Stdin = boolFromSQL(stdin)
ctr.config.StopSignal = stopSignal
ctr.config.StopTimeout = stopTimeout
+ ctr.config.User = user
ctr.state.State = ContainerState(state)
ctr.state.ConfigPath = configPath