Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove "su -c" from upstart scripts #11523

Merged
merged 1 commit into from
Mar 26, 2014

Conversation

dlanderson
Copy link
Contributor

Starting salt via su should be avoided. The original reason to exec via su was to read in /etc/environment - if this is needed then it should be done by adding ". /etc/environment" to the appropriate defaults file (/etc/default/salt-{minion,master,syndic}.

@ghost
Copy link

ghost commented Mar 25, 2014

Test FAILed.
Refer to this link for build results: http://jenkins.saltstack.com/job/salt-pr-build/2755/

thatch45 added a commit that referenced this pull request Mar 26, 2014
Remove "su -c" from upstart scripts
@thatch45 thatch45 merged commit 28dd3e1 into saltstack:develop Mar 26, 2014
@mgwilliams
Copy link
Contributor

@joehealy @dlanderson @basepi so... this both fixes and breaks http proxy support. By that, I mean this:

  • On Ubuntu Precise, this pull-request will break http proxy support hat already works, until the suggested /etc/default file is added.
  • On Ubuntu Trusty, the su trick doesn't work anyway, but the new upstart does work (when /etc/default/salt-minion is configured).

As discussed in IRC with @basepi and @gravyboat, I think we need to add the following /etc/default/salt-minion file to the packages that use upstart:

. /etc/environment
export http_proxy=$http_proxy
export https_proxy=$https_proxy
export no_proxy=$no_proxy

Make sense to everyone?

@joehealy
Copy link
Contributor

joehealy commented May 8, 2014

Do I do this for 2014.1.4 or wait for helium?

On Fri, May 9, 2014 at 8:17 AM, Matthew Williams
notifications@github.comwrote:

@joehealy https://github.com/joehealy @dlandersonhttps://github.com/dlanderson
@basepi https://github.com/basepi so... this both fixes and breaks http
proxy support. By that, I mean this:

  • On Ubuntu Precise, this pull-request will break http proxy support
    hat already works, until the suggested /etc/default file is added.
  • On Ubuntu Trusty, the su trick doesn't work anyway, but the new
    upstart does work (when /etc/default/salt-minion is configured).

As discussed in IRC with @basepi https://github.com/basepi and
@gravyboat https://github.com/gravyboat, I think we need to add the
following /etc/default/salt-minion file to the packages that use upstart:

. /etc/environmentexport http_proxy=$http_proxyexport https_proxy=$https_proxyexport no_proxy=$no_proxy

Make sense to everyone?


Reply to this email directly or view it on GitHubhttps://github.com//pull/11523#issuecomment-42613274
.

@mgwilliams
Copy link
Contributor

In IRC we discussed cherry-picking this PR as well as adding the /etc/default file. I think this is best, since Trusty LTS was released and it's broken by default now.

@joehealy
Copy link
Contributor

joehealy commented May 8, 2014

I have a couple of concerns with this approach:

  1. I am a little reluctant to provide a /etc/default/salt-minion file as
    part of the package as a "configuration file"

This will lead to the package upgrade merge config file situation if people
change it

  1. I feel that we could/should put . /etc/environment into the upstart
    script directly. Is there a reason not to? Would this achieve the desired
    effect?

  2. Without having tested it, I would prefer the following:

Include . /etc/environment in the upstart file

Check for and if it exists, include /etc/default/salt-minion in the upstart
file

Not provide a /etc/default/salt-minion file in the package

What are your thoughts?

Joe

On Fri, May 9, 2014 at 9:20 AM, Joe Healy joehealy@gmail.com wrote:

Do I do this for 2014.1.4 or wait for helium?

On Fri, May 9, 2014 at 8:17 AM, Matthew Williams <notifications@github.com

wrote:

@joehealy https://github.com/joehealy @dlandersonhttps://github.com/dlanderson
@basepi https://github.com/basepi so... this both fixes and breaks
http proxy support. By that, I mean this:

  • On Ubuntu Precise, this pull-request will break http proxy support
    hat already works, until the suggested /etc/default file is added.
  • On Ubuntu Trusty, the su trick doesn't work anyway, but the new
    upstart does work (when /etc/default/salt-minion is configured).

As discussed in IRC with @basepi https://github.com/basepi and
@gravyboat https://github.com/gravyboat, I think we need to add the
following /etc/default/salt-minion file to the packages that use upstart:

. /etc/environmentexport http_proxy=$http_proxyexport https_proxy=$https_proxyexport no_proxy=$no_proxy

Make sense to everyone?


Reply to this email directly or view it on GitHubhttps://github.com//pull/11523#issuecomment-42613274
.

@joehealy
Copy link
Contributor

joehealy commented May 8, 2014

Part of the reasoning behind not providing a /etc/default/minion file is
that it can be provided by salt quite simply. Yes, it will require a
restart to pick it up, but that should be doable.

Joe

On Fri, May 9, 2014 at 9:26 AM, Joe Healy joehealy@gmail.com wrote:

I have a couple of concerns with this approach:

  1. I am a little reluctant to provide a /etc/default/salt-minion file as
    part of the package as a "configuration file"

This will lead to the package upgrade merge config file situation if
people change it

  1. I feel that we could/should put . /etc/environment into the upstart
    script directly. Is there a reason not to? Would this achieve the desired
    effect?

  2. Without having tested it, I would prefer the following:

Include . /etc/environment in the upstart file

Check for and if it exists, include /etc/default/salt-minion in the
upstart file

Not provide a /etc/default/salt-minion file in the package

What are your thoughts?

Joe

On Fri, May 9, 2014 at 9:20 AM, Joe Healy joehealy@gmail.com wrote:

Do I do this for 2014.1.4 or wait for helium?

On Fri, May 9, 2014 at 8:17 AM, Matthew Williams <
notifications@github.com> wrote:

@joehealy https://github.com/joehealy @dlandersonhttps://github.com/dlanderson
@basepi https://github.com/basepi so... this both fixes and breaks
http proxy support. By that, I mean this:

  • On Ubuntu Precise, this pull-request will break http proxy support
    hat already works, until the suggested /etc/default file is added.
  • On Ubuntu Trusty, the su trick doesn't work anyway, but the new
    upstart does work (when /etc/default/salt-minion is configured).

As discussed in IRC with @basepi https://github.com/basepi and
@gravyboat https://github.com/gravyboat, I think we need to add the
following /etc/default/salt-minion file to the packages that use
upstart:

. /etc/environmentexport http_proxy=$http_proxyexport https_proxy=$https_proxyexport no_proxy=$no_proxy

Make sense to everyone?


Reply to this email directly or view it on GitHubhttps://github.com//pull/11523#issuecomment-42613274
.

@mgwilliams
Copy link
Contributor

I agree with the concern about the /etc/default file. If we embed it in the upstart script, I believe the exports are also necessary, unfortunately. I could not get simply . /etc/environment to work without explicitly exporting the http_proxy vars.

@joehealy
Copy link
Contributor

joehealy commented May 8, 2014

I don't have access to my testing VMs today - I'll compare the various
versions of upstart and su (precise and trusty) tonight.

Joe

On Fri, May 9, 2014 at 9:31 AM, Matthew Williams
notifications@github.comwrote:

I agree with the concern about the /etc/default file. If we embed it in
the upstart script, I believe the exports are also necessary,
unfortunately. I could not get simply . /etc/environment to work without
explicitly exporting the http_proxy vars.


Reply to this email directly or view it on GitHubhttps://github.com//pull/11523#issuecomment-42618875
.

@basepi
Copy link
Contributor

basepi commented May 12, 2014

For the record, this commit is not in any salt release. After talking to @mgwilliams in IRC, I marked it to cherry-pick in the future, but I'll wait pending the decisions from this thread.

@gravyboat
Copy link
Contributor

@joehealy @basepi What ended up happening with this? It seems like it is in 2014.1.4.

@joehealy
Copy link
Contributor

I was sure I had fixed this, though it looks like I have only half done so.

I will update the packages today.

Joe

On Thu, May 29, 2014 at 8:10 AM, Forrest notifications@github.com wrote:

@joehealy https://github.com/joehealy @basepihttps://github.com/basepiWhat ended up happening with this?


Reply to this email directly or view it on GitHubhttps://github.com//pull/11523#issuecomment-44471353
.

@gravyboat
Copy link
Contributor

@joehealy One of my coworkers actually installed 2014.1.4-2 for precise today and received this on a file diff for /etc/default/salt-minion:

*** salt-minion (Y/I/N/O/D/Z) [default=N] ? D
--- /etc/default/salt-minion    2014-05-01 00:10:58.118667127 +0000
+++ /etc/default/salt-minion.dpkg-new   2014-05-15 00:55:38.000000000 +0000
@@ -1,4 +1,9 @@
+# export the http_proxy environment variables
+# see https://github.com/saltstack/salt/pull/11523 for details
+
 . /etc/environment
 export http_proxy=$http_proxy
 export https_proxy=$https_proxy
 export no_proxy=$no_proxy
+
+
(END)

So it seems to me as though part of it was updated at least.

@joehealy
Copy link
Contributor

Had done it for master and syndic, but not the important one...

On Thu, May 29, 2014 at 9:07 AM, Joe Healy joehealy@gmail.com wrote:

I was sure I had fixed this, though it looks like I have only half done so.

I will update the packages today.

Joe

On Thu, May 29, 2014 at 8:10 AM, Forrest notifications@github.com wrote:

@joehealy https://github.com/joehealy @basepihttps://github.com/basepiWhat ended up happening with this?


Reply to this email directly or view it on GitHubhttps://github.com//pull/11523#issuecomment-44471353
.

@joehealy
Copy link
Contributor

Yeah - that was the bit I got - I missed the removing su -c from the
upstart file.

Looking now, I think it may have been an issue with me getting the hang of
git-buildpackage - I think I lost it in a merge.

On Thu, May 29, 2014 at 9:11 AM, Forrest notifications@github.com wrote:

@joehealy https://github.com/joehealy One of my coworkers actually
installed 2014.1.4-2 for precise today and received this on a file diff for
/etc/default/salt-minion:

*** salt-minion (Y/I/N/O/D/Z) [default=N] ? D
--- /etc/default/salt-minion    2014-05-01 00:10:58.118667127 +0000
+++ /etc/default/salt-minion.dpkg-new   2014-05-15 00:55:38.000000000 +0000
@@ -1,4 +1,9 @@
+# export the http_proxy environment variables
+# see #11523 for details
+
. /etc/environment
export http_proxy=$http_proxy
export https_proxy=$https_proxy
export no_proxy=$no_proxy
+
+
(END)

So it seems to me as though part of it was updated at least.


Reply to this email directly or view it on GitHubhttps://github.com//pull/11523#issuecomment-44476437
.

@joehealy
Copy link
Contributor

Fixed in the following package versions:

  • 2014.1.4+ds-2trusty3
  • 2014.1.4+ds-2saucy4
  • 2014.1.4-2precise2
  • 2014.1.4-2lucid2

lucid and precise still building right now.

Thanks for your patience.

Joe

@gravyboat
Copy link
Contributor

@joehealy thanks!

@petarmaric
Copy link

I got bit pretty bad by this pull request today.

In our lab we must use proxies to access the internet.
Our Ubuntu 12.04 salt master server has been keeping up with salt-* Debian packages on a regular basis for the last few months - which means it picked up the version which packaged /etc/default/salt-minion.

However, our freshly salted workers (using salt-minion 2014.1.5) don't have /etc/default/salt-minion.

Because of this the salt-minion on the master server had no problems using pip.installed states, unlike the workers which were having proxy issues:

$ sudo salt '*' cmd.run "env | grep -i proxy" --show-timeout
master:
    no_proxy=localhost,master,salt,127.0.0.0/8,192.168.18.0/24
    https_proxy=https://192.168.18.1:8080/
    http_proxy=http://192.168.18.1:8080/
s200:

It would be nice to document this issue, not unlike #9491, to prevent other people from being bitten by this bug.

To be quite honest, I don't understand why we just don't ship the /etc/default/salt-minion which parses /etc/environment for *_proxy env vars - or even do the /etc/environment parsing within /etc/init/salt-minion.conf directly. Seems like a sane default to me.

References:

@basepi
Copy link
Contributor

basepi commented Jun 26, 2014

@petarmaric I'll preface this with the statement "I know very little about upstart"

Can you clarify what you think the solution is? Is there a workaround that worked for you? Do we need to add the su -c back in? Is it just a documentation issue?

@gravyboat
Copy link
Contributor

@basepi basically we need to add /etc/default/salt-minion to the package to realistically resolve this issue so the proxy values are properly exported BY DEFAULT, instead of requiring users to add it themselves. @petarmaric feel free to correct me if you believe this to be incorrect.

@basepi
Copy link
Contributor

basepi commented Jun 27, 2014

Can one of you create a new issue for this fix? Don't want to lose it in the shuffle.

@petarmaric
Copy link

I think @gravyboat's proposed solution is spot on, creating a new issue now.

@petarmaric
Copy link

Created the issue #13786

@joehealy
Copy link
Contributor

Not sure a new issue is needed for that one - happy to use it if needed. I
could have sworn I did that and have the git commit to prove it [1] :( -
problem looks to be that I forgot to add the file :( :(. Sorry about that.
I'll do a new release tonight.

Joe

[1]
http://anonscm.debian.org/gitweb/?p=pkg-salt/salt.git;a=commit;h=de13b30ff90fb5d922fc0c3556703aff9eb8cd36

On Fri, Jun 27, 2014 at 1:50 PM, petarmaric notifications@github.com
wrote:

I think @gravyboat https://github.com/gravyboat's proposed solution is
spot on, creating a new issue now.


Reply to this email directly or view it on GitHub
#11523 (comment).

@gravyboat
Copy link
Contributor

@joehealy I think this was turning into a discussion regarding the /etc/default/salt-minion file. Is that what you're referencing? Or the su -c option?

@petarmaric
Copy link

@joehealy Please remember #13786 adds ftp_proxy as well.

@joehealy
Copy link
Contributor

@petarmaric, saw that. Thanks.

Re @forrest - yeah - meant to commit the file, but obviously didn't add it.

Joe

On Fri, Jun 27, 2014 at 2:13 PM, petarmaric notifications@github.com
wrote:

@joehealy https://github.com/joehealy Please remember #13786
#13786 adds ftp_proxy as well.


Reply to this email directly or view it on GitHub
#11523 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ZZZ[Done]-back-ported-bf RETIRED The pull request has been back-ported to an older branch.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants