MCPcopy
hub / github.com/apache/caldera / store

Method store

app/objects/c_ability.py:97–120  ·  view source on GitHub ↗
(self, ram)

Source from the content-addressed store, hash-verified

95 raise AttributeError(item)
96
97 def store(self, ram):
98 existing = self.retrieve(ram['abilities'], self.unique)
99 if not existing:
100 name_match = [x for x in ram['abilities'] if x.name == self.name]
101 if name_match:
102 self.name = self.name + " (2)"
103 logging.debug(f"Collision in ability name detected for {self.ability_id} and {name_match[0].ability_id} "
104 f"({name_match[0].name}). Modifying name of the second ability to {self.name}...")
105 ram['abilities'].append(self)
106 return self.retrieve(ram['abilities'], self.unique)
107 existing.update('tactic', self.tactic)
108 existing.update('technique_name', self.technique_name)
109 existing.update('technique_id', self.technique_id)
110 existing.update('name', self.name)
111 existing.update('description', self.description)
112 existing.update('_executor_map', self._executor_map)
113 existing.update('privilege', self.privilege)
114 existing.update('repeatable', self.repeatable)
115 existing.update('buckets', self.buckets)
116 existing.update('tags', self.tags)
117 existing.update('singleton', self.singleton)
118 existing.update('plugin', self.plugin)
119 existing.update('delete_payload', self.delete_payload)
120 return existing
121
122 async def which_plugin(self):
123 return self.plugin

Callers

nothing calls this directly

Calls 2

retrieveMethod · 0.80
updateMethod · 0.80

Tested by

no test coverage detected