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

Installation fails on Red Hat Server - unassigned variable #3

Open
jstraub-hw opened this issue Jul 14, 2015 · 1 comment
Open

Installation fails on Red Hat Server - unassigned variable #3

jstraub-hw opened this issue Jul 14, 2015 · 1 comment

Comments

@jstraub-hw
Copy link

The installation of the R-Service fails on an HDP 2.2.4 and Ambari 2.0 release.

The script r-service/package/scripts/ambari/ambari_helpers.py threws an exception because the variable repo_dir is used before any value is assigned. The following code partial produces the error:

distribution = platform.linux_distribution()[0].lower()
#TODO: add ubuntu
if distribution in ['centos', 'redhat'] :
    repo_dir = package_dir()+'files/repos/rhel6/'
    os_repo_dir = '/etc/yum.repos.d/'

  for repo in os.listdir(repo_dir):
    if not os.path.isfile(os_repo_dir + repo):
      Execute('cp ' + repo_dir+repo + ' ' + os_repo_dir)

When I try platform.linux_distribution()[0].lower() on my cluster I receive the following value:

Python 2.6.6 (r266:84292, Jan 22 2014, 01:49:05)
>>> import platform
>>> platform.linux_distribution()[0].lower()
'red hat enterprise linux server'
>>>
@oluies
Copy link

oluies commented Feb 29, 2016

Same on ubuntu 14.04

Traceback (most recent call last):
  File "/var/lib/ambari-agent/cache/stacks/HDP/2.3/services/r-service/package/scripts/ambari/client.py", line 20, in <module>
    Client().execute()
  File "/usr/lib/python2.6/site-packages/resource_management/libraries/script/script.py", line 219, in execute
    method(env)
  File "/var/lib/ambari-agent/cache/stacks/HDP/2.3/services/r-service/package/scripts/ambari/client.py", line 7, in install
    helpers.add_repos()
  File "/var/lib/ambari-agent/cache/stacks/HDP/2.3/services/r-service/package/scripts/ambari/ambari_helpers.py", line 13, in add_repos
    for repo in os.listdir(repo_dir):
UnboundLocalError: local variable 'repo_dir' referenced before assignment
>>> import platform
>>> platform.linux_distribution()[0].lower()
'debian'
>>>

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

No branches or pull requests

2 participants