Ad Widget

Collapse

Move item to subtemplate

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • StephenKing
    Junior Member
    • Sep 2011
    • 19

    #1

    Move item to subtemplate

    Hi,

    I have templates for "Generic Linux system", "Virtualized Linux" and "Physical Linux".

    The generic template is a common ancestor for both sub-templates. I now want to move some items from the generic to the physical template, as I recognized that it doesn't make sense for virtual servers.

    When I try to modify the Item and change the host, I get

    ERROR: Cannot update item
    An item with the Key [vm.memory.size[available]] already exists for host [Physical Linux System]. The key must be unique.
    Of course, this happens, because of the Physical one already has this item inherited from the parent template.

    As the templates are already used for several hosts, I'd like to avoid deleting them to not loose history and triggers (and I'm curious, how to achieve this for bigger restructuring in the future).

    Is there a way around?

    Thanks
    Steffen
  • arli
    Member
    • Jan 2008
    • 71

    #2
    I'm actually wondering about the same kind of situation - I have 3 years of history I don't want to lose and since our template architechture needs to be updated, some items have to be moved from one template to another.
    I can think of only one risky way at the moment. It is to change the values determine template belonging directly in database
    But ofcourse there could be a more civilized way to move an item.

    Comment

    • arli
      Member
      • Jan 2008
      • 71

      #3
      Well I tried that and seems to work just fine - at least passed the initial smoke test:

      First verified:
      SELECT * FROM items WHERE hostid='<my new template id>';

      And then updated:
      UPDATE items SET hostid='<my new template id>' WHERE hostid='<my old template id>';

      ... actually was a bit more sophisticated, since I wanted to move only some items.

      REMEMBER - I don't take any responsibility if you mess up your database while editing it, so You'll do it on your own risk, make a backup first and ofcourse start in the test environment!

      Comment

      • dakol
        Member
        • Jan 2008
        • 50

        #4
        Originally posted by arli
        I'm actually wondering about the same kind of situation - I have 3 years of history I don't want to lose and since our template architechture needs to be updated, some items have to be moved from one template to another.
        I can think of only one risky way at the moment. It is to change the values determine template belonging directly in database
        But ofcourse there could be a more civilized way to move an item.
        unlink templates (NOT unlink and clear)
        => item will be attached to the hosts instead of template

        link template
        => items will be reattached to the template(s) base on key_ value

        Comment

        • arli
          Member
          • Jan 2008
          • 71

          #5
          Originally posted by dakol
          link template
          => items will be reattached to the template(s) base on key_ value
          What exactly do you mean by "link template" - go through all the hosts and copy items to new template? I don't see any options like you described.

          Comment

          • dakol
            Member
            • Jan 2008
            • 50

            #6
            Originally posted by arli
            What exactly do you mean by "link template" - go through all the hosts and copy items to new template? I don't see any options like you described.

            1) unlink "Generic Linux system" from "Virtualized Linux"

            2) add items in ""Virtualized Linux" (key_= XXX)

            3) remove item in "Generic Linux system" (key_ = XXX⁾

            4) link "Generic Linux system" to "Virtualized Linux"

            Comment

            Working...