Re: [openstack-dev] [diskimage-builder] disk-image-create from virtualenv not working

2015-07-02 Thread Alec Hothan (ahothan)

Thanks for the tip! after a few trials I finally made it work by
commenting out the following line in /etc/sudoers:

#Defaults 
secure_path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin



  Alec


On 7/2/15, 11:25 AM, Jens Rosenboom j.rosenb...@x-ion.de wrote:

2015-07-02 19:58 GMT+02:00 Alec Hothan (ahothan) ahot...@cisco.com:

 I wonder if anybody else ran into the same issue as it looks like PyYAML
 is required on the native python in order for disk-image-crate to
succeed.
 Installing PyYAML in a virtual environment and running disk-iage-create
 from that venv won't work as one of the script fails to import yaml:


 dib-run-parts Thu Jul 2 09:27:50 PDT 2015 Running
 /tmp/image.ewtpa5DW/hooks/extra-data.d/99-squash-package-install

 ['/tmp/image.ewtpa5DW/hooks/bin', '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages']

 Traceback (most recent call last):
   File
 /tmp/image.ewtpa5DW/hooks/extra-data.d/../bin/package-installs-squash,
 line 26, in module
 import yaml
 ImportError: No module named yaml


 I added a trace to print sys.path in that script and sure enough, it is
 bypassing completely my venv path, it looks like the PATH is not picking
 up the existing PATH from the calling shell.



 from the same shell that ran disk-iage-create above:
 $ pip list | grep YAML
 PyYAML (3.11)

 $ python
 Python 2.7.6 (default, Jun 22 2015, 17:58:13)
 [GCC 4.8.2] on linux2
 Type help, copyright, credits or license for more information.
 import sys
 print sys.path
 ['', '/home/localadmin/kb/lib/python2.7',
 '/home/localadmin/kb/lib/python2.7/plat-x86_64-linux-gnu',
 '/home/localadmin/kb/lib/python2.7/lib-tk',
 '/home/localadmin/kb/lib/python2.7/lib-old',
 '/home/localadmin/kb/lib/python2.7/lib-dynload', '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk',
 '/home/localadmin/kb/local/lib/python2.7/site-packages',
 '/home/localadmin/kb/lib/python2.7/site-packages']


 Is that a known issue/requirement or is there a workaround (other than
 installing pyYAML on the native python?

elements/package-installs/extra-data.d/99-squash-package-install does
a sudo -E package-installs-squash, however at least on Ubuntu the
default seems to be having env_reset defined, causing the environment
variables being cleared and thereby losing information about your
venv. As a workaround you could try to change the env_reset setting in
your /etc/sudoers.

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


[openstack-dev] [diskimage-builder] disk-image-create from virtualenv not working

2015-07-02 Thread Alec Hothan (ahothan)

I wonder if anybody else ran into the same issue as it looks like PyYAML
is required on the native python in order for disk-image-crate to succeed.
Installing PyYAML in a virtual environment and running disk-iage-create
from that venv won't work as one of the script fails to import yaml:


dib-run-parts Thu Jul 2 09:27:50 PDT 2015 Running
/tmp/image.ewtpa5DW/hooks/extra-data.d/99-squash-package-install

['/tmp/image.ewtpa5DW/hooks/bin', '/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk',
'/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload',
'/usr/local/lib/python2.7/dist-packages',
'/usr/lib/python2.7/dist-packages']

Traceback (most recent call last):
  File 
/tmp/image.ewtpa5DW/hooks/extra-data.d/../bin/package-installs-squash,
line 26, in module
import yaml
ImportError: No module named yaml


I added a trace to print sys.path in that script and sure enough, it is
bypassing completely my venv path, it looks like the PATH is not picking
up the existing PATH from the calling shell.



from the same shell that ran disk-iage-create above:
$ pip list | grep YAML
PyYAML (3.11)

$ python
Python 2.7.6 (default, Jun 22 2015, 17:58:13)
[GCC 4.8.2] on linux2
Type help, copyright, credits or license for more information.
 import sys
 print sys.path
['', '/home/localadmin/kb/lib/python2.7',
'/home/localadmin/kb/lib/python2.7/plat-x86_64-linux-gnu',
'/home/localadmin/kb/lib/python2.7/lib-tk',
'/home/localadmin/kb/lib/python2.7/lib-old',
'/home/localadmin/kb/lib/python2.7/lib-dynload', '/usr/lib/python2.7',
'/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk',
'/home/localadmin/kb/local/lib/python2.7/site-packages',
'/home/localadmin/kb/lib/python2.7/site-packages']


Is that a known issue/requirement or is there a workaround (other than
installing pyYAML on the native python?

Thanks

  Alec


__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev


Re: [openstack-dev] [diskimage-builder] disk-image-create from virtualenv not working

2015-07-02 Thread Jens Rosenboom
2015-07-02 19:58 GMT+02:00 Alec Hothan (ahothan) ahot...@cisco.com:

 I wonder if anybody else ran into the same issue as it looks like PyYAML
 is required on the native python in order for disk-image-crate to succeed.
 Installing PyYAML in a virtual environment and running disk-iage-create
 from that venv won't work as one of the script fails to import yaml:


 dib-run-parts Thu Jul 2 09:27:50 PDT 2015 Running
 /tmp/image.ewtpa5DW/hooks/extra-data.d/99-squash-package-install

 ['/tmp/image.ewtpa5DW/hooks/bin', '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk',
 '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload',
 '/usr/local/lib/python2.7/dist-packages',
 '/usr/lib/python2.7/dist-packages']

 Traceback (most recent call last):
   File
 /tmp/image.ewtpa5DW/hooks/extra-data.d/../bin/package-installs-squash,
 line 26, in module
 import yaml
 ImportError: No module named yaml


 I added a trace to print sys.path in that script and sure enough, it is
 bypassing completely my venv path, it looks like the PATH is not picking
 up the existing PATH from the calling shell.



 from the same shell that ran disk-iage-create above:
 $ pip list | grep YAML
 PyYAML (3.11)

 $ python
 Python 2.7.6 (default, Jun 22 2015, 17:58:13)
 [GCC 4.8.2] on linux2
 Type help, copyright, credits or license for more information.
 import sys
 print sys.path
 ['', '/home/localadmin/kb/lib/python2.7',
 '/home/localadmin/kb/lib/python2.7/plat-x86_64-linux-gnu',
 '/home/localadmin/kb/lib/python2.7/lib-tk',
 '/home/localadmin/kb/lib/python2.7/lib-old',
 '/home/localadmin/kb/lib/python2.7/lib-dynload', '/usr/lib/python2.7',
 '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk',
 '/home/localadmin/kb/local/lib/python2.7/site-packages',
 '/home/localadmin/kb/lib/python2.7/site-packages']


 Is that a known issue/requirement or is there a workaround (other than
 installing pyYAML on the native python?

elements/package-installs/extra-data.d/99-squash-package-install does
a sudo -E package-installs-squash, however at least on Ubuntu the
default seems to be having env_reset defined, causing the environment
variables being cleared and thereby losing information about your
venv. As a workaround you could try to change the env_reset setting in
your /etc/sudoers.

__
OpenStack Development Mailing List (not for usage questions)
Unsubscribe: openstack-dev-requ...@lists.openstack.org?subject:unsubscribe
http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-dev