示例#1
0
 def sign(self):
     """return sign in the form {relpath: (origin layer, SHA256)}
     """
     sigs = {}
     for target in self.tracked:
         rel = target.relpath(self._target.directory)
         sigs[rel] = (self.owner, "dynamic", utils.sign(target))
     return sigs
示例#2
0
 def sign(self):
     """return sign in the form {relpath: (origin layer, SHA256)}
     """
     target = self.target_file
     sig = {}
     if target.exists() and target.isfile():
         sig[self.relpath] = (self.current.url, self.kind, utils.sign(self.target_file))
     return sig
示例#3
0
 def sign(self):
     ""  # suppress inherited doc
     target = self.target_file
     sig = {}
     if target.exists() and target.isfile():
         sig["layer.yaml"] = (self.layer.url, self.kind,
                              utils.sign(self.target_file))
     return sig
示例#4
0
 def sign(self):
     """return sign in the form {relpath: (origin layer, SHA256)}
     """
     target = self.target_file
     sig = {}
     if target.exists() and target.isfile():
         sig[self.relpath] = (self.current.url, self.kind,
                              utils.sign(self.target_file))
     return sig
示例#5
0
 def sign(self):
     """return sign in the form {relpath: (origin layer, SHA256)}
     """
     sigs = {}
     for hook in ["joined", "changed", "broken", "departed"]:
         target = self._target / "hooks" / "{}-relation-{}".format(self.relation_name, hook)
         rel = target.relpath(self._target.directory)
         sigs[rel] = (self.interface.url, "dynamic", utils.sign(target))
     return sigs
示例#6
0
 def sign(self):
     ""  # suppress inherited doc
     target = self.target_file
     sig = {}
     if target.exists() and target.isfile():
         sig["layer.yaml"] = (self.layer.url,
                              self.kind,
                              utils.sign(self.target_file))
     return sig
示例#7
0
 def sign(self):
     ""  # suppress inherited doc
     if self.wrote_sha:
         return {
             self.target_file.relpath(self.target.directory):
             (self.layer.url, "dynamic", utils.sign(self.target_file))
         }
     else:
         return {}
示例#8
0
 def sign(self):
     """
     Sign all hook files generated by this tactic.
     """
     sigs = {}
     for target in self.tracked:
         rel = target.relpath(self._target.directory)
         sigs[rel] = (self.owner, "dynamic", utils.sign(target))
     return sigs
示例#9
0
 def sign(self):
     """return sign in the form {relpath: (origin layer, SHA256)}
     """
     sigs = {}
     for target in self.targets:
         rel = target.relpath(self._target.directory)
         sigs[rel] = (self.owner,
                      "dynamic",
                      utils.sign(target))
     return sigs
示例#10
0
 def sign(self):
     """return sign in the form {relpath: (origin layer, SHA256)}
     """
     sigs = {}
     for tactic in self.previous:
         sigs.update(tactic.sign())
     for d in self.tracked:
         relpath = d.relpath(self.target.directory)
         sigs[relpath] = (self.current.url, "dynamic", utils.sign(d))
     return sigs
示例#11
0
 def sign(self):
     """return sign in the form {relpath: (origin layer, SHA256)}
     """
     sigs = {}
     for hook in ['joined', 'changed', 'broken', 'departed']:
         target = self._target / "hooks" / "{}-relation-{}".format(
             self.relation_name, hook)
         rel = target.relpath(self._target.directory)
         sigs[rel] = (self.interface.url, "dynamic", utils.sign(target))
     return sigs
 def sign(self):
     """ Return signatures for the cloud-on-k8s yaml files were added
     dynamically.
     """
     sigs = {}
     # Sign ownership of all files this layer created or updated.
     for d in self.tracked:
         relpath = d.relpath(self.target.directory)
         sigs[relpath] = (self.layer.url, "dynamic", utils.sign(d))
     return sigs
示例#13
0
 def sign(self):
     ""  # suppress inherited doc
     sigs = {}
     # sign the `copyright` file for all levels below us.
     for tactic in self.previous:
         sigs.update(tactic.sign())
     relpath = self.target_file.relpath(self.target.directory)
     sigs[relpath] = (self.layer.url, self.kind,
                      utils.sign(self.target_file))
     return sigs
示例#14
0
 def sign(self):
     """return sign in the form {relpath: (origin layer, SHA256)}
     """
     if self.wrote_sha:
         return {
             self.target_file.relpath(self.target.directory):
             (self.layer.url, "dynamic", utils.sign(self.target_file))
         }
     else:
         return {}
示例#15
0
 def sign(self):
     """
     Sign all hook files generated by this tactic.
     """
     sigs = {}
     for target in self.tracked:
         rel = target.relpath(self._target.directory)
         sigs[rel] = (self.owner,
                      "dynamic",
                      utils.sign(target))
     return sigs
示例#16
0
 def sign(self):
     ""  # suppress inherited doc
     sigs = {}
     # sign the `copyright` file for all levels below us.
     for tactic in self.previous:
         sigs.update(tactic.sign())
     relpath = self.target_file.relpath(self.target.directory)
     sigs[relpath] = (self.layer.url,
                      self.kind,
                      utils.sign(self.target_file))
     return sigs
示例#17
0
 def sign(self):
     """return sign in the form {relpath: (origin layer, SHA256)}
     """
     sigs = {}
     for tactic in self.previous:
         sigs.update(tactic.sign())
     for d in self.tracked:
         relpath = d.relpath(self.target.directory)
         sigs[relpath] = (
             self.layer.url, "dynamic", utils.sign(d))
     return sigs
示例#18
0
 def sign(self):
     ""  # suppress inherited doc
     sigs = {}
     if self.per_layer:
         for tactic in self.previous:
             sigs.update(tactic.sign())
     else:
         sigs['wheelhouse.txt'] = (
             self.layer.url,
             "dynamic",
             utils.sign(self.target.directory / 'wheelhouse.txt'),
         )
     for d in self.tracked:
         if d in self.removed:
             continue
         relpath = d.relpath(self.target.directory)
         pkg_name = safe_name(d.basename().split('-')[0])
         layer_url = self._layer_refs.get(pkg_name, '__pip__')
         sigs[relpath] = (layer_url, "dynamic", utils.sign(d))
     return sigs
示例#19
0
 def sign(self):
     ""  # suppress inherited doc
     sigs = {}
     for tactic in self.previous:
         sigs.update(tactic.sign())
     for d in self.tracked:
         if d in self.removed:
             continue
         relpath = d.relpath(self.target.directory)
         sigs[relpath] = (self.layer.url, "dynamic", utils.sign(d))
     return sigs
示例#20
0
 def sign(self):
     """return sign in the form {relpath: (origin layer, SHA256)}
     """
     sigs = {}
     # sign the `copyright` file for all levels below us.
     for tactic in self.previous:
         sigs.update(tactic.sign())
     relpath = self.target_file.relpath(self.target.directory)
     sigs[relpath] = (self.layer.url, self.kind,
                      utils.sign(self.target_file))
     return sigs
示例#21
0
 def sign(self):
     ""  # suppress inherited doc
     if self.wrote_sha:
         return {
             self.target_file.relpath(self.target.directory): (
                 self.layer.url,
                 "dynamic",
                 utils.sign(self.target_file)
             )
         }
     else:
         return {}
示例#22
0
 def sign(self):
     ""  # suppress inherited doc
     sigs = {}
     for d in self._tracked:
         if d.isdir():
             for entry, sig in utils.walk(d, utils.sign, kind="files"):
                 relpath = entry.relpath(self.target.directory)
                 sigs[relpath] = (self.layer.url, "dynamic", sig)
         elif d.isfile():
             relpath = d.relpath(self.target.directory)
             sigs[relpath] = (self.layer.url, "dynamic", utils.sign(d))
     return sigs
示例#23
0
 def sign(self):
     """return sign in the form {relpath: (origin layer, SHA256)}
     """
     sigs = {}
     # sign the `copyright` file for all levels below us.
     for tactic in self.previous:
         sigs.update(tactic.sign())
     relpath = self.target_file.relpath(self.target.directory)
     sigs[relpath] = (self.layer.url,
                      self.kind,
                      utils.sign(self.target_file))
     return sigs
示例#24
0
 def sign(self):
     ""  # suppress inherited doc
     sigs = {}
     for tactic in self.previous:
         sigs.update(tactic.sign())
     for d in self.tracked:
         if d in self.removed:
             continue
         relpath = d.relpath(self.target.directory)
         sigs[relpath] = (
             self.layer.url, "dynamic", utils.sign(d))
     return sigs
示例#25
0
    def sign(self):
        """
        Return signature in the form ``{relpath: (origin layer, SHA256)}``

        Can be overridden by a subclass, but the default implementation will
        usually be fine.
        """
        target = self.target_file
        sig = {}
        if target.exists() and target.isfile():
            sig[self.relpath] = (self.layer.url, self.kind,
                                 utils.sign(self.target_file))
        return sig
示例#26
0
 def sign(self):
     """return sign in the form {relpath: (origin layer, SHA256)}
     """
     sigs = {}
     for d in self._tracked:
         if d.isdir():
             for entry, sig in utils.walk(d, utils.sign, kind="files"):
                 relpath = entry.relpath(self.target.directory)
                 sigs[relpath] = (self.current.url, "dynamic", sig)
         elif d.isfile():
             relpath = d.relpath(self.target.directory)
             sigs[relpath] = (self.current.url, "dynamic", utils.sign(d))
     return sigs
示例#27
0
 def sign(self):
     """return sign in the form {relpath: (origin layer, SHA256)}
     """
     if self.wrote_sha:
         return {
             self.target_file.relpath(self.target.directory): (
                 self.layer.url,
                 "dynamic",
                 utils.sign(self.target_file)
             )
         }
     else:
         return {}
示例#28
0
 def sign(self):
     """return sign in the form {relpath: (origin layer, SHA256)}
     """
     sigs = {}
     for d in self._tracked:
         if d.isdir():
             for entry, sig in utils.walk(d, utils.sign, kind="files"):
                 relpath = entry.relpath(self.target.directory)
                 sigs[relpath] = (self.current.url, "dynamic", sig)
         elif d.isfile():
             relpath = d.relpath(self.target.directory)
             sigs[relpath] = (self.current.url, "dynamic", utils.sign(d))
     return sigs
示例#29
0
 def sign(self):
     ""  # suppress inherited doc
     sigs = {}
     for d in self._tracked:
         if d.isdir():
             for entry, sig in utils.walk(d,
                                          utils.sign, kind="files"):
                 relpath = entry.relpath(self.target.directory)
                 sigs[relpath] = (self.layer.url, "dynamic", sig)
         elif d.isfile():
             relpath = d.relpath(self.target.directory)
             sigs[relpath] = (
                 self.layer.url, "dynamic", utils.sign(d))
     return sigs
示例#30
0
    def sign(self):
        """
        Return signature in the form ``{relpath: (origin layer, SHA256)}``

        Can be overridden by a subclass, but the default implementation will
        usually be fine.
        """
        target = self.target_file
        sig = {}
        if target.exists() and target.isfile():
            sig[self.relpath] = (self.layer.url,
                                 self.kind,
                                 utils.sign(self.target_file))
        return sig
示例#31
0
    def sign(self):
        """return sign in the form {relpath: (origin layer, SHA256)}

        This is how the report of changed files is created.
        """
        sigs = {}
        # recursively have all previous layers sign their files, depth-first
        for tactic in self.previous:
            sigs.update(tactic.sign())
        # sign ownership of all files this layer created or updated
        for d in self.tracked:
            relpath = d.relpath(self.target.directory)
            sigs[relpath] = (self.layer.url, "dynamic", utils.sign(d))
        return sigs