Skip to content
This repository has been archived by the owner on Jun 18, 2019. It is now read-only.

'Malformed version number string 2.7.15+' ubuntu18.04 #146

Open
ITJamie opened this issue Jun 17, 2019 · 3 comments
Open

'Malformed version number string 2.7.15+' ubuntu18.04 #146

ITJamie opened this issue Jun 17, 2019 · 3 comments

Comments

@ITJamie
Copy link

ITJamie commented Jun 17, 2019

Kitchen Ouput

Theres some mention of this here too: https://answers.launchpad.net/ubuntu/+question/681357

` * python_runtime_pip[2] action install[2019-06-17T09:43:50+00:00] INFO: Processing python_runtime_pip[2] action install (/tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/python_providers/base.rb line 118)

       ================================================================================
       Error executing action `install` on resource 'python_runtime_pip[2]'
       ================================================================================

       ArgumentError
       -------------
       Malformed version number string 2.7.15+

       Cookbook Trace:
       ---------------
       /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime_pip.rb:121:in `bootstrap_pip'
       /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime_pip.rb:90:in `action_install'
       /tmp/kitchen/cache/cookbooks/poise/files/halite_gem/poise/helpers/notifying_block.rb:69:in `notifying_block'
       /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/python_providers/base.rb:50:in `action_install'

       Resource Declaration:
       ---------------------
       # In /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/python_providers/base.rb

       118:         python_runtime_pip new_resource.name do
       119:           parent new_resource
       120:           # If the version is `true`, don't pass it at all.
       121:           version pip_version if pip_version.is_a?(String)
       122:           get_pip_url pip_url
       123:         end
       124:       end
       125:

       Compiled Resource:
       ------------------
       # Declared in /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/python_providers/base.rb:118:in `install_pip'

       python_runtime_pip("2") do
         action [:install]
         default_guard_interpreter :default
         declared_type :python_runtime_pip
         cookbook_name "poise-python"
         parent python_runtime[2]
         get_pip_url "https://bootstrap.pypa.io/get-pip.py"
       end

       System Info:
       ------------
       chef_version=14.13.11
       platform=ubuntu
       platform_version=18.04
       ruby=ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]
       program_name=/opt/chef/bin/chef-client
       executable=/opt/chef/bin/chef-client

   [2019-06-17T09:43:50+00:00] INFO: Running queued delayed notifications before re-raising exception

     ================================================================================
     Error executing action `install` on resource 'python_runtime[2]'
     ================================================================================

     ArgumentError
     -------------
     python_runtime_pip[2] (/tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/python_providers/base.rb line 118) had an error: ArgumentError: Malformed version number string 2.7.15+

     Cookbook Trace:
     ---------------
     /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime_pip.rb:121:in `bootstrap_pip'
     /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/resources/python_runtime_pip.rb:90:in `action_install'
     /tmp/kitchen/cache/cookbooks/poise/files/halite_gem/poise/helpers/notifying_block.rb:69:in `notifying_block'
     /tmp/kitchen/cache/cookbooks/poise-python/files/halite_gem/poise_python/python_providers/base.rb:50:in `action_install'

     Resource Declaration:
     ---------------------
     # In /tmp/kitchen/cache/cookbooks/poise-python/recipes/default.rb

      20: python_runtime '2' if node['poise-python']['install_python2']

     Compiled Resource:
     ------------------
     # Declared in /tmp/kitchen/cache/cookbooks/poise-python/recipes/default.rb:20:in `from_file'

     python_runtime("2") do
       action [:install]
       updated true
       default_guard_interpreter :default
       subresources [python_package[requests], python_package[simplejson], python_runtime_pip[2], python_package[setuptools], python_package[wheel], python_package[virtualenv]]
       declared_type :python_runtime
       cookbook_name "poise-python"
       recipe_name "default"
       get_pip_url "https://bootstrap.pypa.io/get-pip.py"
       pip_version true
       setuptools_version true
       version "2"
       virtualenv_version true
       wheel_version true
     end

     System Info:
     ------------
     chef_version=14.13.11
     platform=ubuntu
     platform_version=18.04
     ruby=ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux]
     program_name=/opt/chef/bin/chef-client
     executable=/opt/chef/bin/chef-client`
@ITJamie ITJamie changed the title 'Malformed version number string 2.7.15+' ubuntu18 'Malformed version number string 2.7.15+' ubuntu18.04 Jun 17, 2019
@DeWaRs1206
Copy link

After some investigation, looks like the problem come from:

root@full-full:~# python --version
Python 2.7.15+

the '+' at the end of the version break the cookbook.

Something like

            python_version = (python_version_cmd.stdout + python_version_cmd.stderr)[/Python (\S+)/, 1]
            python_version = python_version.gsub('+','')

in lib/resources/python_runtime_pip.rb should probably solve the issue, but I'm not able to test this because of this halite stuff I'm not sure to understand.

@DeWaRs1206
Copy link

So I have been able to test the code above and this is solving the issue.

@ITJamie
Copy link
Author

ITJamie commented Jun 18, 2019

PR #147 created that will strip additional unexpected characters

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants