Code Duplication    Length = 15-18 lines in 2 locations

org_fedora_oscap/ks/oscap.py 1 location

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

org_fedora_oscap/common.py 1 location

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