Menu

#2901 imm: immdump has empty-value attribute dumped

5.18.09
fixed
nobody
None
defect
imm
tools
major
False
2018-08-30
2018-07-26
No

immdump intends to dump only non-empty value object's attributes, all empty-value attributes will not be written to dump file, otherwise the immxml-validate will raise following error:

Traceback (most recent call last):
  File "./immxml-validate", line 523, in <module>
    main(sys.argv[1:])
  File "./immxml-validate", line 504, in main
    doc.post_process_validate()
  File "./immxml-validate", line 412, in post_process_validate
    self.post_validate_object_list()
  File "./immxml-validate", line 275, in post_validate_object_list
    node_value = element.firstChild.nodeValue
AttributeError: 'NoneType' object has no attribute 'nodeValue

But in some cases, above intention is not guranteed. That is when the attribute has <default-value> tag with no value given and the attribute type is either SA_NAME_T or SA_STRING_T, then the dump file will look like, having empty-value attribute dump:

    <object class="TestClass">
        <dn>testClass=1</dn>
        <attr>
              <name>StringAttribute</name>
              <value></value>
        </attr>
    <attr>
          <name>SaNameTAttribute</name>
          <value></value>
    </attr>
    </object>

Steps to reproduce:
1) Import the attached file
2) Create an object immcfg -c TestClass testClass=1
3) Dump the test class immdump -c TestClass > dump.xml
4) Validate the dump file

1 Attachments

Related

Wiki: ChangeLog-5.18.09

Discussion

  • Vu Minh Nguyen

    Vu Minh Nguyen - 2018-07-27

    In IMM SAF spec, at section 4.2.7 SaImmAttrDefinitionT_2, it states:

    attrDefaultValue: contains a value that will automatically be assigned by
    the IMM Service to this attribute if no value is specified when an object containing this attribute is created. A default value shall only be provided for configuration and persistent runtime attributes. Must be set to NULL if there is no default value for this attribute

    Must be set to NULL if there is no default value for this attribute , does it mean attrDefaultValue must be set to NULL if no value is given to <default-value> tags?

    If that understanding is right, we should fix the bug in imm_loader and imm_import?

     
  • Vu Minh Nguyen

    Vu Minh Nguyen - 2018-07-30
    • summary: imm: immdump has empty-value attribute dump --> imm: immdump has empty-value attribute dumped
    • status: assigned --> accepted
     
  • Vu Minh Nguyen

    Vu Minh Nguyen - 2018-07-30
    • status: accepted --> review
     
  • Vu Minh Nguyen

    Vu Minh Nguyen - 2018-08-03
    • status: review --> fixed
    • assigned_to: Vu Minh Nguyen --> nobody
     
  • Vu Minh Nguyen

    Vu Minh Nguyen - 2018-08-03

    commit 59cf8371a385b3dbfa7b73712cc1ebef3ebf95ad (HEAD -> develop, origin/develop, ticket-2901)
    Author: Vu Minh Nguyen vu.m.nguyen@dektech.com.au
    Date: Fri Aug 3 08:43:27 2018 +0700

    imm: set attrDefaultValue to NULL if no default value is given [#2901]
    
    When explicitly having <default-value> tag, but no value is given:
    <default-value></default-value>, set NULL to attrDefaultValue.
    
     

Log in to post a comment.