Code Duplication    Length = 15-18 lines in 2 locations

org_fedora_oscap/ks/oscap.py 1 location

@@ 290-307 (lines=18) @@
287
    def content_defined(self):
288
        return self.content_url or self.content_type == "scap-security-guide"
289
290
    @property
291
    def content_name(self):
292
        if self.content_type == "scap-security-guide":
293
            raise ValueError("Using scap-security-guide, no single content file")
294
295
        rest = "/anonymous_content"
296
        for prefix in SUPPORTED_URL_PREFIXES:
297
            if self.content_url.startswith(prefix):
298
                rest = self.content_url[len(prefix):]
299
                break
300
301
        parts = rest.rsplit("/", 1)
302
        if len(parts) != 2:
303
            msg = "Unsupported url '%s' in the %s addon" % (self.content_url,
304
                                                            self.name)
305
            raise KickstartValueError(msg)
306
307
        return parts[1]
308
309
    @property
310
    def raw_preinst_content_path(self):

org_fedora_oscap/common.py 1 location

@@ 540-554 (lines=15) @@
537
    return os.path.exists(get_ssg_path(root))
538
539
540
def get_content_name(data):
541
    if data.content_type == "scap-security-guide":
542
        raise ValueError("Using scap-security-guide, no single content file")
543
544
    rest = "/anonymous_content"
545
    for prefix in SUPPORTED_URL_PREFIXES:
546
        if data.content_url.startswith(prefix):
547
            rest = data.content_url[len(prefix):]
548
            break
549
550
    parts = rest.rsplit("/", 1)
551
    if len(parts) != 2:
552
        raise ValueError("Unsupported url '%s'" % data.content_url)
553
554
    return parts[1]
555
556
557
def get_raw_preinst_content_path(data):