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

Server reports AttributeError if definition is not valid YAML #74

Closed
advornic opened this issue Apr 24, 2014 · 0 comments
Closed

Server reports AttributeError if definition is not valid YAML #74

advornic opened this issue Apr 24, 2014 · 0 comments
Assignees
Milestone

Comments

@advornic
Copy link
Contributor

DEBUG: NeighborDB: Match for pattern leaf pattern succeeded                                        
DEBUG: while parsing a block mapping                                                               
  in "", line 2, column 1:                                                                 
    name: leaf definition                                                                          
    ^                                                                                              
expected , but found ''                                           
  in "", line 11, column 2:                                                                
     - name: configure vlan 1                                                                      
     ^                                                                                             
ERROR: 'NoneType' object has no attribute 'get'                                                    
Traceback (most recent call last):                                                                 
  File "build/bdist.linux-x86_64/egg/ztpserver/wsgiapp.py", line 89, in __call__                   
    result = method(request, **request.urlvars)                                                    
  File "build/bdist.linux-x86_64/egg/ztpserver/controller.py", line 141, in create                 
    return self.fsm('required_attributes', request=request, node=node)                             
  File "build/bdist.linux-x86_64/egg/ztpserver/controller.py", line 158, in fsm                    
    (response, next_state) = method(response, **kwargs)                                            
  File "build/bdist.linux-x86_64/egg/ztpserver/controller.py", line 227, in post_node              
    data = ndb.create_node_definition(definition, node)                                            
  File "build/bdist.linux-x86_64/egg/ztpserver/neighbordb.py", line 141, in create_node_definition 
    url = definition.get('definition')                                                             
AttributeError: 'NoneType' object has no attribute 'get'                                           
192.168.0.21 - - [24/Apr/2014 03:50:07] "POST /nodes HTTP/1.1" 500 228                             
 

Would be great to be a bit more explicit about what the problem is in the logs.

Here is the erroneous definition:

--- 
actions: 
  - 
    action: add_config
    attributes: 
      url: "http://192.168.1.220:8787/files/templates/system.template"
    name: "configure system"
  - 
# indentation inconsistent between the two sections
   action: add_config
   attributes: 
     url: "http://192.168.1.220:8787/files/templates/leaf.template"
     variables: 
       ipaddress: allocate('leaf_spine_ip')
       man_ipaddress: allocate('leaf_man_ip')
   name: "configure vlan 1"
name: "leaf definition"
@advornic advornic added this to the Release1.0 milestone Apr 24, 2014
@privateip privateip self-assigned this Apr 24, 2014
@privateip privateip removed this from the Release1.0 milestone May 6, 2014
@advornic advornic added this to the Release1.1 milestone May 13, 2014
@jerearista jerearista added bug and removed enhancement labels Jul 7, 2014
@jerearista jerearista assigned advornic and unassigned privateip Jul 31, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants