Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

rkt fly: add logic to insert environment value #1989

Merged
merged 1 commit into from Jan 21, 2016
Merged

Conversation

il9ue
Copy link
Contributor

@il9ue il9ue commented Jan 16, 2016

Insert environment value by checking related value in Manifest.
Please give any feedback.


env := make([]string, len(envList))
for _, e := range envList {
if _, exists := envList.Get(defaultEnv[0]); !exists {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function Get accepts only the name of the environment variable and not its content.

environment.go:

type EnvironmentVariable struct {
    Name  string `json:"name"`
    Value string `json:"value"`
}

But here, the argument is "PATH=/bin:/sbin:/usr/bin:/usr/local/bin".

@jellonek
Copy link
Contributor

This way You have possibility to insert some values into environ file in time of POD creation, but not in time of entering which is reading already build environ file. This second option is at least needed by any terminal using program (TERM type env variable), so You will have problem with such basic commands like clear (and probably with not-so-simple like screen, tmux - didn't test this) in container after entering into one of POD applications.

@alban alban changed the title add logic to insert environment value rkt fly: add logic to insert environment value Jan 18, 2016
@alban
Copy link
Member

alban commented Jan 18, 2016

In the case of rkt fly, there is no need to care about rkt enter.

@steveej @krnowak Did you have any plans to refactor some part of rkt fly into the main stage1 to avoid code duplication (#1889)? In that case I don't know if this piece of code will stay.

@il9ue il9ue force-pushed the master branch 2 times, most recently from e1e9022 to ef7c89e Compare January 21, 2016 03:40
env := []string{"PATH=/bin:/sbin:/usr/bin:/usr/local/bin"}
defaultEnvPath := []string{"PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"}
envList := p.Manifest.Apps[0].App.Environment
env := make([]string, len(envList))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The length seems to be len(envList)+len(defaultEnvPath)

@alban
Copy link
Member

alban commented Jan 21, 2016

@il9ue Thanks for the update! I added a couple of suggestions.

@il9ue il9ue force-pushed the master branch 2 times, most recently from 90c7e04 to 687b21c Compare January 21, 2016 13:31
@il9ue
Copy link
Contributor Author

il9ue commented Jan 21, 2016

@alban Just updated and applied from suggestions and made changes! Thanks for specific feedback!

@@ -219,7 +219,15 @@ func stage1() int {
}

// TODO: insert environment from manifest
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This TODO can be removed.

@iaguis
Copy link
Member

iaguis commented Jan 21, 2016

LGTM

@iaguis iaguis modified the milestones: v0.16.0, v1.0.0 Jan 21, 2016
iaguis added a commit that referenced this pull request Jan 21, 2016
rkt fly: add logic to insert environment value
@iaguis iaguis merged commit 4bc5c03 into rkt:master Jan 21, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants