Skip to content

fixing issues with passing env var to salt-minion,master,syndic - #5937

Closed
elyast wants to merge 1 commit into
saltstack:developfrom
elyast:develop
Closed

elyast wants to merge 1 commit into
saltstack:developfrom
elyast:develop

Conversation

@elyast

@elyast elyast commented Jul 4, 2013

Copy link
Copy Markdown

Hi guys I have a problem with env variables (set in /etc/environment) as they are not passed when running salt-minion as a service (ubuntu)
I found that this post http://serverfault.com/questions/128605/have-upstart-read-environment-from-etc-environment-for-a-service and basically they advice to use exec su -c in upstart scripts, which pointed me to https://github.com/saltstack/salt/blob/develop/pkg/salt-minion.service and I think in this script there should be exec su -c salt-minion (at least I have tested that one with:
salt '*' cmd.exec_code python 'import os; print os.environ' (and /etc/environment variables are passed)
any comments appreciated

@thatch45

thatch45 commented Jul 5, 2013

Copy link
Copy Markdown
Contributor

Thanks for the pull req, I am going to run this by some of our guys more familiar with upstart take a look

@elyast

elyast commented Jul 5, 2013

Copy link
Copy Markdown
Author

You're welcome,
I guess it may not be the best way to fix it, so e.g. would be nice to be able to pass user id which should execute such service and so on, but I would like to indicate it becomes a problem in corporate environment, when http proxy is usual thing.

(corresponding discussion on stackoverflow
http://stackoverflow.com/questions/8902856/upstart-env-stanza-not-setting-environment-variables-like-node-env-for-node-js)

@thatch45

Copy link
Copy Markdown
Contributor

I am going to close this guy out pending a more robust solution

@thatch45 thatch45 closed this Jul 26, 2013
@elyast

elyast commented Sep 21, 2013

Copy link
Copy Markdown
Author

When can we expect more robust solution? If I can help with anything let me know

@galet

galet commented Sep 26, 2013

Copy link
Copy Markdown

We are running behind proxy too with the same problem. Any updates?

@basepi

basepi commented Oct 1, 2013

Copy link
Copy Markdown
Contributor

You're welcome to modify your upstart scripts as was done in this pull req, but as @thatch45 said, we want to find a more robust solution than using su in the long-term.

@elyast

elyast commented Oct 1, 2013

Copy link
Copy Markdown
Author

I was just curious if you did something about that, having separate fork is fine with me.

@basepi

basepi commented Oct 1, 2013

Copy link
Copy Markdown
Contributor

Nope, not yet. We really need to get an issue open so that we don't forget about this......

@galet

galet commented Oct 3, 2013

Copy link
Copy Markdown

I didn't want to modify the upstart directly. My workaround for RHEL based system was to add the env variables to /etc/sysconfig/init which is sourced by /etc/init.d/functions from all init scripts.

@giannello

Copy link
Copy Markdown
Contributor

exact same problem here, but on Ubuntu.
my temporary workaround is to create /etc/default/salt-minion before the minion is installed, exporting http_ and https_proxy.
I tried setting that using a formula included in the highstate, but until salt-minion is restarted the change is not applied, so if the first highstate run tries to install any package, it fails.
Using salt-bootstrap to create that file allowed me to workaround the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants