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

Rendering SLS 'base:hadoop.hdfs' failed: Jinja variable No first item, sequence was empty. #20

Open
kitplummer opened this issue Mar 4, 2015 · 12 comments

Comments

@kitplummer
Copy link
Contributor

I'm pretty sure it's my pillar config, but I can't get it. Anybody else see this when trying to use hadoop.hdfs?

hdfs:
  config:
    hdfs-site:
      dfs.datanode.synconclose:
        value: true
      dfs.durable.sync:
        value: true
      dfs.permission:
        value: false
    namenode_http_port: 50070
    namenode_port: 8020
    secondarynamenode_http_port: 50090
  datanode_target: "roles:hadoop_slave"
  namenode_target: "roles:hadoop_master"
@sroegner
Copy link
Member

sroegner commented Mar 4, 2015

What happens if you try to run completely without the pillar block?

@kitplummer
Copy link
Contributor Author

It still happens. I've made a little bit of progress though.

Caveat - I'm trying to get a master and slave working under Vagrant and two
VMs. It boils down to being able to resolve this:

{%- set namenode_host       = salt['mine.get'](namenode_target,
'network.interfaces', expr_form=targeting_method)|first %}

The error is basically saying that first can't return anything because
there isn't anything there at all. I have the role getting set in the
minion config, but I'm not sure how to get the mine_functions stuff to work
in this enviro.

I'm just guessing that because I'm running 'masterless' with a local setup that I'm stuck.

On Wed, Mar 4, 2015 at 4:20 PM, Steffen Roegner [email protected]
wrote:

What happens if you try to run completely without the pillar block?


Reply to this email directly or view it on GitHub
#20 (comment)
.

@sroegner
Copy link
Member

sroegner commented Mar 5, 2015

You might have guessed that what the code is trying to do is to collect the list of hosts that match expression and targeting_method (in your case the default - grains).
I always use a saltmaster - even in vagrant so I cannot speak to the chances of querying salt mine without one. What you could try is change "hadoop:targeting_method" to something like compound and then adapt the targets to that like below:

hadoop:
  targeting_method: compound
hdfs:
  datanode_target: "G@hostname:my_vagrant_datanode"
  namenode_target: "G@hostname:my_vagrant_namenode"
  config:
    hdfs-site:
      dfs.datanode.synconclose:
        value: true
      dfs.durable.sync:
        value: true
      dfs.permission:
        value: false
    namenode_http_port: 50070
    namenode_port: 8020
    secondarynamenode_http_port: 50090

@kitplummer
Copy link
Contributor Author

Ah. That might be better/easier than what I ended up doing:

{%- set namenode_host       = gc.get('namenode_host',
pc.get('namenode_host', salt['mine.get'](namenode_target,
'network.interfaces', expr_form=targeting_method))) %}
{%- set datanode_hosts      = gc.get('datanode_hosts',
pc.get('datanode_hosts', salt['mine.get'](datanode_target,
'network.interfaces', expr_form=targeting_method).keys())) %}

And manually spelling 'em out in the pillar config:

    namenode_host: 192.168.100.100
    datanode_hosts: [192.168.100.200]

On Thu, Mar 5, 2015 at 7:09 AM, Steffen Roegner [email protected]
wrote:

You might have guessed that what the code is trying to do is to collect
the list of hosts that match expression and targeting_method (in your case
the default - grains).
I always use a saltmaster - even in vagrant so I cannot speak to the
chances of querying salt mine without one. What you could try is change
"hadoop:targeting_method" to something like compound and then adapt the
targets to that like below:

hadoop:
targeting_method: compound
hdfs:
datanode_target: "G@hostname:my_vagrant_datanode"
namenode_target: "G@hostname:my_vagrant_namenode"
config:
hdfs-site:
dfs.datanode.synconclose:
value: true
dfs.durable.sync:
value: true
dfs.permission:
value: false
namenode_http_port: 50070
namenode_port: 8020
secondarynamenode_http_port: 50090


Reply to this email directly or view it on GitHub
#20 (comment)
.

@sroegner sroegner closed this as completed Jun 5, 2015
@blbradley
Copy link
Contributor

I'm experiencing this too right out of the box. I have tried with and without the pillar block from the example. Can we call it a bug? Even if it is just a documentation issue.

@blbradley
Copy link
Contributor

FWIW, I'm not using a masterless setup.

@puneetk puneetk reopened this Jun 25, 2015
@sroegner
Copy link
Member

@blbradley Can you share the result of 'salt * grains.get roles' ?

@blbradley
Copy link
Contributor

I have this working now. My minion config did have the roles set but was still getting this. I am not able to reproduce again.

Can this error be put in a troubleshooting section? It's hard to debug because no real contextual info (line number, rendered jinja) is given.

@blbradley
Copy link
Contributor

I'll do it if someone says it's alright.

@puneetk
Copy link
Contributor

puneetk commented Jun 25, 2015

send a pull request with the update

@lextoumbourou
Copy link
Contributor

I ran into the same issue. I had my Pillar conf setup like this:

hdfs:
    namenode_target: "role:hadoop-namenode"
    datanode_target: "role:hadoop-datanode"

excepting the default grain matching to work, but it doesn't seem to? I was getting the Jinja variable No first item, sequence was empty. error.

I changed the Pillar to this:

hadoop:
    targeting_method: compound

 hdfs:
   namenode_target: "G@role:hadoop-namenode"
   datanode_target: "G@role:hadoop-datanode"

and it worked, though I'm not sure if it was the config change or if Salt cleared its cache or something?

@sroegner
Copy link
Member

sroegner commented Jun 1, 2016

@lextoumbourou FWIW: when these problems come up (with the ever same unhelpful error message) I'd try to investigate a bit on the command line trying to figure out what to expect from the salt setup and then maybe change the files. Comparing

salt -C 'G@role:hadoop-namenode' test.ping

with

salt -G 'role:hadoop-namenode' test.ping

should be the equivalent of the two examples you gave. In my experience the targeting depends on both the salt version mix in use and the current state of the cluster - at the same time the jinja code doesn't really allow for error handling. The good news: it usually works pretty reliably once all the pieces are in place.

hth

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

5 participants