ESGF / esgf-installer

ESGF P2P Node Installer
https://esgf.llnl.gov/
Other
20 stars 21 forks source link

esgf 3.x installer failed in esg_postgres.setup_postgres() #489

Closed muryanto1 closed 6 years ago

muryanto1 commented 6 years ago
Installed:
  postgresql.x86_64 0:8.4.20-8.el6_9                                            
  postgresql-devel.x86_64 0:8.4.20-8.el6_9                                      
  postgresql-server.x86_64 0:8.4.20-8.el6_9                                     

Dependency Installed:
  postgresql-libs.x86_64 0:8.4.20-8.el6_9                                       

Complete!
Could not stream subprocess output
stream_subprocess_output error: [Errno 2] No such file or directory
Traceback (most recent call last):
  File "esg_node.py", line 441, in <module>
    main()
  File "esg_node.py", line 323, in main
    system_component_installation(esg_dist_url, node_type_list)
  File "esg_node.py", line 173, in system_component_installation
    esg_postgres.setup_postgres()
  File "/home/jenkins/repos/esgf-installer/base/esg_postgres.py", line 111, in setup_postgres
    initialize_postgres()
  File "/home/jenkins/repos/esgf-installer/base/esg_postgres.py", line 46, in initialize_postgres
    esg_functions.stream_subprocess_output("service postgresql initdb")
  File "/home/jenkins/repos/esgf-installer/esgf_utilities/esg_functions.py", line 385, in stream_subprocess_output
    process = subprocess.Popen(shlex.split(command_string), stdout=subprocess.PIPE)
  File "/usr/local/conda/envs/esgf-pub/lib/python2.7/subprocess.py", line 394, in __init__
    errread, errwrite)
  File "/usr/local/conda/envs/esgf-pub/lib/python2.7/subprocess.py", line 1047, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory
nathanlcarlson commented 6 years ago

@muryanto1 So the command to be run as a subprocess is:

service postgresql initdb

Running

which service

Returns

/sbin/service

Before the installer is executed I see

[Pipeline] sh
[esgf_3.x_install] Running shell script
+ sudo bash -c 'export TERM=vt100; export PATH=/usr/local/conda/bin:/usr/local/bin:/bin:/usr/bin; cd /home/jenkins/repos/esgf-installer; source /usr/local/conda/bin/activate esgf-pub; python esg_node.py --install --type all'

I think the problem is the $PATH does not include /sbin because of

export PATH=/usr/local/conda/bin:/usr/local/bin:/bin:/usr/bin

above. So the installer cannot find service. Let me know if I am missing something. As a fix either add /sbin to the export or change the export to something like

export PATH="/usr/local/conda/bin:$PATH"

This assumes there is a $PATH which already contains other paths, including /sbin and those you specified in your export, and you are adding /usr/local/conda/bin to it. I am not sure how this will work in Jenkins.