Method: Rubyang::Database::DataTree::Root#commit

Defined in:
lib/rubyang/database/data_tree.rb

#commitObject



861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
# File 'lib/rubyang/database/data_tree.rb', line 861

def commit
  begin
    components = self.edit( "rubyang" ).edit( "component" ).children.map{ |c|
      component = c.key_values.first
      hook = c.edit("hook").value
      file_path = c.edit("file-path").value
      [component, hook, file_path]
    }
    self.root.parent.component_manager.update components
    self.root.parent.component_manager.run "commit"
  rescue => e
    @logger.debug { 'rescue in commit' }
    @logger.debug { e }
  ensure 
    backup = self.to_xml
    @parent.history.push backup
  end
end