GithubHelp home page GithubHelp logo

Comments (6)

conor-owens avatar conor-owens commented on June 12, 2024 1

I tried adding this to /python_action_wrapper.py to read the contents of /etc/environment:
(ref: http://stackoverflow.com/questions/5971312/how-to-set-environment-variables-in-python)

import re
import os

LOG = logging.getLogger(__name__)

def _set_env_from_etc_environment(envFilePath):
    print('--packs.py:setEnvFromEnvFile --1-----------------------------------------------.')
    SetEnvPattern = re.compile("^(.*)(=)(.*)$", re.MULTILINE)
    SetEnvFile = open(envFilePath, "r")
    SetEnvText = SetEnvFile.read()
    SetEnvMatchList = re.findall(SetEnvPattern, SetEnvText)

    for SetEnvMatch in SetEnvMatchList:
        VarName=SetEnvMatch[0]
        VarValue=SetEnvMatch[2]
        print "-- %s=%s ------"%(VarName,VarValue)
        os.environ[VarName]=VarValue

_set_env_from_etc_environment("/etc/environment")`

I also had to add 0.0.0.0 to the NO_PROXY:

NO_PROXY=localhost,127.0.0.1,0.0.0.0

This allows the command st2 run packs.install packs=st2 to succeed:

action.ref: packs.install
parameters:
  packs:
  - st2
status: succeeded
start_timestamp: 2016-12-16T00:13:29.299066Z
end_timestamp: 2016-12-16T00:13:47.164410Z
+--------------------------+------------------------+---------------------------+-------------------------+-------------------------------+
| id                       | status                 | task                      | action                  | start_timestamp               |
+--------------------------+------------------------+---------------------------+-------------------------+-------------------------------+
| 5REDACTED----------90b8c | succeeded (7s elapsed) | download pack             | packs.download          | Fri, 16 Dec 2016 00:13:29 UTC |
| 5REDACTED----------90b8c | succeeded (1s elapsed) | make a prerun             | packs.virtualenv_prerun | Fri, 16 Dec 2016 00:13:37 UTC |
| 5REDACTED----------90b8c | succeeded (5s elapsed) | install pack dependencies | packs.setup_virtualenv  | Fri, 16 Dec 2016 00:13:38 UTC |
| 5REDACTED----------90b8c | succeeded (3s elapsed) | register pack             | packs.load              | Fri, 16 Dec 2016 00:13:43 UTC |
+--------------------------+------------------------+---------------------------+-------------------------+-------------------------------+

from st2docs.

conor-owens avatar conor-owens commented on June 12, 2024 1

Also needed the sudo git config --global http.proxy http://proxy.somecorp.net:8080 for the git clones

from st2docs.

LindsayHill avatar LindsayHill commented on June 12, 2024 1

Closing this now that #3137 has been resolved, and updated docs published

from st2docs.

LindsayHill avatar LindsayHill commented on June 12, 2024

@sidkrishna could you take a look at this one when you get a chance? I'm not sure if the code changes are needed, or just the docs about setting environment variables.

from st2docs.

conor-owens avatar conor-owens commented on June 12, 2024

I saw this issue too. Centos7 and Stackstorm 2.1.0. More info: https://gist.github.com/conor-owens/21d2b291251c9f89ecef579de9fb5221

Seems the various environment variables are not preserved when running the packs.py so the requests doesn't find or use the HTTPS_PROXY environment variable. In my environment sudo -v includes:
"Environment variables to preserve:
ftp_proxy
FTP_PROXY
no_proxy
http_proxy
https_proxy
NO_PROXY
HTTP_PROXY
HTTPS_PROXY"

from st2docs.

Mierdin avatar Mierdin commented on June 12, 2024

Please note #388, that contains a more suitable workaround for st2 pack install that doesn't require any Python changes and also allows pack dependencies to install as well. Note also that it doesn't address st2 pack search at all, only pack installation.

I would like to keep this issue open, as we are going to be pursuing a more permanent solution to this problem in a future release.

from st2docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.