internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: cobbler/cobbler

Issue:
import_rsync_whitelist does not include sles-release-* files with --available-as
When I try to import a sles11sp1 repo using --available-as=http://... the import does not find a matching signature.

I believe this is because the import_rsync_whitelist does not contain enough to get the basic import to include the sles-release-*files.  I had to add:
- suse/*

to the end of the SuSE patterns in order to get the sles-release-\* files as well as the kernel-\* files.



Discussion:
Hi, what version of cobbler are you using?
These patterns are already in master...

I just fetched and rebased on e4cb4836e5499b4883ccecd1bdd83912fb241bf9.  I still have the following patch for this issue:

```
@@ -71,6 +71,7 @@
 + boot/x86_64/loader/initrd
 + boot/x86_64/loader/linux
 + suse/
++ suse/*

 #-----------------------------------------------
 # Exclude everything else
```


Resolving patch:
diff --git a/cobbler/action_reposync.py b/cobbler/action_reposync.py
--- a/cobbler/action_reposync.py
+++ b/cobbler/action_reposync.py
@@ -171,6 +171,8 @@ def sync(self, repo):
             return self.apt_sync(repo)
         elif repo.breed == "rsync":
             return self.rsync_sync(repo)
+        elif repo.breed == "wget":
+            return self.wget_sync(repo)
         else:
             utils.die(self.logger,"unable to sync repo (%s), unknown or unsupported repo type (%s)" % (repo.name, repo.breed))
 
@@ -216,6 +218,31 @@ def createrepo_walker(self, repo, dirname, fnames):
 
     # ====================================================================================
 
+    def wget_sync(self, repo):
+
+        """
+        Handle mirroring of directories using wget
+        """
+
+        repo_mirror = repo.mirror
+
+        if repo.rpm_list != "" and repo.rpm_list != []:
+            self.logger.warning("--rpm-list is not supported for wget'd repositories")
+
+        # FIXME: don't hardcode
+        dest_path = os.path.join(self.settings.webdir + "/repo_mirror", repo.name)
+
+        # FIXME: wrapper for subprocess that logs to logger
+        cmd = "wget -N -np -r -l inf -nd -P %s %s" % (dest_path, repo_mirror)
+        rc = utils.subprocess_call(self.logger, cmd)
+
+        if rc != 0:
+            utils.die(self.logger, "cobbler reposync failed")
+        os.path.walk(dest_path, self.createrepo_walker, repo)
+        self.create_local_file(dest_path, repo)
+
+    # ====================================================================================
+
     def rsync_sync(self, repo):
 
         """
diff --git a/cobbler/codes.py b/cobbler/codes.py
--- a/cobbler/codes.py
+++ b/cobbler/codes.py
@@ -21,5 +21,5 @@
 """
 
 VALID_REPO_BREEDS = [
-    "rsync", "rhn", "yum", "apt"
+    "rsync", "rhn", "yum", "apt", "wget"
 ]


Test patch:
Repository: cobbler/cobbler

Issue:
allow to set IPv6 netmask
It is currently not possible to specify an IPv6 netmask for a system interface in cobbler:

cobbler system edit --name=test1.linux-ipv6.be --interface=eth0  --ipv6-address=2001:123:456:789::8:2/112
Returns this error: invalid format for IPv6 IP address (2001:123:456:789::8:2/112)

Please add a parameter to set the IPv6 netmask.



Discussion:

Resolving patch:
diff --git a/cobbler/field_info.py b/cobbler/field_info.py
--- a/cobbler/field_info.py
+++ b/cobbler/field_info.py
@@ -140,6 +140,7 @@
     "*netmask": "Networking",
     "*if_gateway": "Networking",
     "*ipv6_address": "Networking",
+    "*ipv6_prefix": "Networking",
     "*ipv6_secondaries": "Networking",
     "*ipv6_mtu": "Networking",
     "*ipv6_static_routes": "Networking",
diff --git a/cobbler/item_system.py b/cobbler/item_system.py
--- a/cobbler/item_system.py
+++ b/cobbler/item_system.py
@@ -84,6 +84,7 @@
     ["*static_routes", [], 0, "Static Routes", True, "Should be used with --interface", 0, "list"],
     ["*virt_bridge", "", 0, "Virt Bridge", True, "Should be used with --interface", 0, "str"],
     ["*ipv6_address", "", 0, "IPv6 Address", True, "Should be used with --interface", 0, "str"],
+    ["*ipv6_prefix", "", 0, "IPv6 Prefix", True, "Should be used with --interface", 0, "str"],
     ["*ipv6_secondaries", [], 0, "IPv6 Secondaries", True, "Space delimited. Should be used with --interface", 0, "list"],
     ["*ipv6_mtu", "", 0, "IPv6 MTU", True, "Should be used with --interface", 0, "str"],
     ["*ipv6_static_routes", [], 0, "IPv6 Static Routes", True, "Should be used with --interface", 0, "list"],
@@ -184,6 +185,7 @@ def __get_interface(self, name):
                 "dns_name": "",
                 "static_routes": [],
                 "ipv6_address": "",
+                "ipv6_prefix": "",
                 "ipv6_secondaries": [],
                 "ipv6_mtu": "",
                 "ipv6_static_routes": [],
@@ -480,6 +482,14 @@ def set_ipv6_address(self, address, interface):
             return True
         raise CX(_("invalid format for IPv6 IP address (%s)") % address)
 
+    def set_ipv6_prefix(self, prefix, interface):
+        """
+        Assign a IPv6 prefix
+        """
+        intf = self.__get_interface(interface)
+        intf["ipv6_prefix"] = prefix.strip()
+        return True
+
     def set_ipv6_secondaries(self, addresses, interface):
         intf = self.__get_interface(interface)
         data = utils.input_string_or_list(addresses)
@@ -738,6 +748,9 @@ def modify_interface(self, hash):
             if field == "ipv6address":
                 self.set_ipv6_address(value, interface)
 
+            if field == "ipv6prefix":
+                self.set_ipv6_prefix(value, interface)
+
             if field == "ipv6secondaries":
                 self.set_ipv6_secondaries(value, interface)
 


Test patch:
Repository: cobbler/cobbler

Issue:
Missing jQuer-UI graphics per CSS file
cobbler_webui_content/jquery-ui.css contains references to files that are not included/available in the repo.  It appears as if jQuery UI Theme Roller was used to create a theme, but then only the CSS file from that theme was included with Cobbler.  These are the files expected to be in  cobbler_webui_content/images

ui-icons_222222_256x240.png
ui-bg_glass_65_ffffff_1x400.png
ui-bg_glass_75_e6e6e6_1x400.png
ui-bg_glass_75_dadada_1x400.png

These missing files have no impact on functionality or even aesthetic so far as i can tell.  However, it generates Apache2 errors whenever pages such as System -> Edit   are accessed



Discussion:
Confirmed.


Resolving patch:
diff --git a/cobbler/pxegen.py b/cobbler/pxegen.py
--- a/cobbler/pxegen.py
+++ b/cobbler/pxegen.py
@@ -53,8 +53,6 @@ def __init__(self, config, logger):
         self.images = config.images()
         self.templar = templar.Templar(config)
         self.bootloc = utils.tftpboot_location()
-        # FIXME: not used anymore, can remove?
-        self.verbose = False
 
     def copy_bootloaders(self):
         """
diff --git a/cobbler/template_api.py b/cobbler/template_api.py
--- a/cobbler/template_api.py
+++ b/cobbler/template_api.py
@@ -58,12 +58,12 @@
     # general snippet. If none is found, a comment explaining the error is
     # substituted.
     "#def SNIPPET($file)",
-        "#set $snippet = $read_snippet($file)",
-        "#if $snippet",
-            "#include source=$snippet",
-        "#else",
-            "# Error: no snippet data for $file",
-        "#end if",
+    "#set $snippet = $read_snippet($file)",
+    "#if $snippet",
+    "#include source=$snippet",
+    "#else",
+    "# Error: no snippet data for $file",
+    "#end if",
     "#end def",
 ]) + "\n")
 


Test patch:
Repository: cobbler/cobbler

Issue:
Missing jQuer-UI graphics per CSS file
cobbler_webui_content/jquery-ui.css contains references to files that are not included/available in the repo.  It appears as if jQuery UI Theme Roller was used to create a theme, but then only the CSS file from that theme was included with Cobbler.  These are the files expected to be in  cobbler_webui_content/images

ui-icons_222222_256x240.png
ui-bg_glass_65_ffffff_1x400.png
ui-bg_glass_75_e6e6e6_1x400.png
ui-bg_glass_75_dadada_1x400.png

These missing files have no impact on functionality or even aesthetic so far as i can tell.  However, it generates Apache2 errors whenever pages such as System -> Edit   are accessed



Discussion:
Confirmed.


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -177,7 +177,8 @@ def run(self):
         webconfig  = "/etc/httpd/conf.d"
         webroot     = "/var/www/"
 
-    webcontent  = webroot + "cobbler_webui_content/"
+    webcontent = webroot + "cobbler_webui_content/"
+    webimages = webcontent + "/images/"
 
 
     setup(
@@ -224,7 +225,8 @@ def run(self):
             ("%sscripts" % libpath,         ["scripts/*"]),
             ("%s" % libpath,                ["config/distro_signatures.json"]),
             ("web",                         ["web/*.*"]),
-            ("%s" % webcontent,             ["web/content/*.*"]),
+            ("%s" % webcontent,             ["web/content/*"]),
+            ("%s" % webimages,              ["web/content/images/*"]),
             ("web/cobbler_web",             ["web/cobbler_web/*.*"]),
             ("web/cobbler_web/templatetags",["web/cobbler_web/templatetags/*"]),
             ("web/cobbler_web/templates",   ["web/cobbler_web/templates/*"]),


Test patch:
Repository: cobbler/cobbler

Issue:
Missing jQuer-UI graphics per CSS file
cobbler_webui_content/jquery-ui.css contains references to files that are not included/available in the repo.  It appears as if jQuery UI Theme Roller was used to create a theme, but then only the CSS file from that theme was included with Cobbler.  These are the files expected to be in  cobbler_webui_content/images

ui-icons_222222_256x240.png
ui-bg_glass_65_ffffff_1x400.png
ui-bg_glass_75_e6e6e6_1x400.png
ui-bg_glass_75_dadada_1x400.png

These missing files have no impact on functionality or even aesthetic so far as i can tell.  However, it generates Apache2 errors whenever pages such as System -> Edit   are accessed



Discussion:
Confirmed.


Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -543,7 +543,8 @@ def run(self):
         http_user   = "apache"
         defaultpath = "/etc/sysconfig/"
 
-    webcontent  = webroot + "cobbler_webui_content/"
+    webcontent = webroot + "cobbler_webui_content/"
+    webimages = webcontent + "images/"
 
 
     setup(
@@ -617,7 +618,8 @@ def run(self):
             ("%sscripts" % libpath,         glob("scripts/*")),
             ("%s" % libpath,                ["config/distro_signatures.json"]),
             ("share/cobbler/web",           glob("web/*.*")),
-            ("%s" % webcontent,             glob("web/content/*.*")),
+            ("%s" % webcontent,             glob("web/content/*")),
+            ("%s" % webimages,              glob("web/content/images/*")),
             ("share/cobbler/web/cobbler_web",             glob("web/cobbler_web/*.*")),
             ("share/cobbler/web/cobbler_web/templatetags",glob("web/cobbler_web/templatetags/*")),
             ("share/cobbler/web/cobbler_web/templates",   glob("web/cobbler_web/templates/*")),


Test patch:
Repository: cobbler/cobbler

Issue:
Cobbler restrict Kickstart Directory (Security Issue)
hi,

As discussed in mailing lists, it makes sense restricting access to the kickstart directory in cobbler, so local file inclusions other than kickstart files are prohibited.

by specifiying 'Kickstart' value to /etc/passwd or any other crucial system file, local files are exposed by the cobbler web_ui and is a security vulnerability.

this issue has been opened here after discussion with Jorgen Maas.

Thanks,

Dolev Farhi, F5 Networks Inc



Discussion:
Fixed in master, will be in 2.8 release

Awesome!

## 

Dolev Farhi
On May 23, 2014 11:54 PM, "Jörgen Maas" notifications@github.com wrote:

> Fixed in master, will be in 2.8 release
> 
> —
> Reply to this email directly or view it on GitHubhttps://github.com/cobbler/cobbler/issues/939#issuecomment-44059229
> .

We have CVE-2014-3225 bugs filed against the cobbler packages in Fedora/EPEL:

https://bugzilla.redhat.com/show_bug.cgi?id=1095846
https://bugzilla.redhat.com/show_bug.cgi?id=1095845

any chance this could be back-ported to at least 2.6?

Yes, and in my book this warrants new releases in 2.4 and 2.6.
I will get the patches in tomorrow and do the releases.

@opoplawski are you also maintaining cobbler for EPEL5 ???

note to self: one of the patches from alanoe broke cobbler-web for snippets/kickstart edits
fix for that is somewhere in master.

Merged into 2.4 and 2.6, will release tomorrow.

2.4.6 and 2.6.3 have been released.

I appear to be the cobbler maintainer for all Fedora and Fedora EPEL releases.

So, Jimi granted you all rights on the cobbler packages ??

On Sat, Jul 19, 2014 at 12:52 AM, Orion Poplawski notifications@github.com
wrote:

> I appear to be the cobbler maintainer for all Fedora and Fedora EPEL
> releases.
> 
> —
> Reply to this email directly or view it on GitHub
> https://github.com/cobbler/cobbler/issues/939#issuecomment-49488335.

## 

Grtz,
Jörgen Maas

On 07/18/2014 11:12 PM, Jörgen Maas wrote:

> So, Jimi granted you all rights on the cobbler packages ??

No, I've been using my provenpackager powers to maintain it.

## 

Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA, Boulder/CoRA Office             FAX: 303-415-9702
3380 Mitchell Lane                       orion@nwra.com
Boulder, CO 80301                   http://www.nwra.com

Hi all
the problem is still reproducible in version 2.6.3..


Resolving patch:
diff --git a/cobbler/remote.py b/cobbler/remote.py
--- a/cobbler/remote.py
+++ b/cobbler/remote.py
@@ -823,7 +823,11 @@ def modify_item(self,what,object_id,attribute,arg,token):
         # support 1.6 field name exceptions for backwards compat
         attribute = REMAP_COMPAT.get(attribute,attribute)
         method = obj.remote_methods().get(attribute, None)
-        if method == None:
+
+        if what == "system" and attribute == "kickstart":
+            self._validate_ks_template_path(arg)
+
+        if method is None:
             # it's ok, the CLI will send over lots of junk we can't process
             # (like newname or in-place) so just go with it.
             return False


Test patch:
Repository: cobbler/cobbler

Issue:
Cobbler restrict Kickstart Directory (Security Issue)
hi,

As discussed in mailing lists, it makes sense restricting access to the kickstart directory in cobbler, so local file inclusions other than kickstart files are prohibited.

by specifiying 'Kickstart' value to /etc/passwd or any other crucial system file, local files are exposed by the cobbler web_ui and is a security vulnerability.

this issue has been opened here after discussion with Jorgen Maas.

Thanks,

Dolev Farhi, F5 Networks Inc



Discussion:
Fixed in master, will be in 2.8 release

Awesome!

## 

Dolev Farhi
On May 23, 2014 11:54 PM, "Jörgen Maas" notifications@github.com wrote:

> Fixed in master, will be in 2.8 release
> 
> —
> Reply to this email directly or view it on GitHubhttps://github.com/cobbler/cobbler/issues/939#issuecomment-44059229
> .

We have CVE-2014-3225 bugs filed against the cobbler packages in Fedora/EPEL:

https://bugzilla.redhat.com/show_bug.cgi?id=1095846
https://bugzilla.redhat.com/show_bug.cgi?id=1095845

any chance this could be back-ported to at least 2.6?

Yes, and in my book this warrants new releases in 2.4 and 2.6.
I will get the patches in tomorrow and do the releases.

@opoplawski are you also maintaining cobbler for EPEL5 ???

note to self: one of the patches from alanoe broke cobbler-web for snippets/kickstart edits
fix for that is somewhere in master.

Merged into 2.4 and 2.6, will release tomorrow.

2.4.6 and 2.6.3 have been released.

I appear to be the cobbler maintainer for all Fedora and Fedora EPEL releases.

So, Jimi granted you all rights on the cobbler packages ??

On Sat, Jul 19, 2014 at 12:52 AM, Orion Poplawski notifications@github.com
wrote:

> I appear to be the cobbler maintainer for all Fedora and Fedora EPEL
> releases.
> 
> —
> Reply to this email directly or view it on GitHub
> https://github.com/cobbler/cobbler/issues/939#issuecomment-49488335.

## 

Grtz,
Jörgen Maas

On 07/18/2014 11:12 PM, Jörgen Maas wrote:

> So, Jimi granted you all rights on the cobbler packages ??

No, I've been using my provenpackager powers to maintain it.

## 

Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA, Boulder/CoRA Office             FAX: 303-415-9702
3380 Mitchell Lane                       orion@nwra.com
Boulder, CO 80301                   http://www.nwra.com

Hi all
the problem is still reproducible in version 2.6.3..


Resolving patch:
diff --git a/cobbler/remote.py b/cobbler/remote.py
--- a/cobbler/remote.py
+++ b/cobbler/remote.py
@@ -871,6 +871,10 @@ def modify_item(self, what, object_id, attribute, arg, token):
         obj = self.__get_object(object_id)
         self.check_access(token, "modify_%s" % what, obj, attribute)
         method = obj.remote_methods().get(attribute, None)
+
+        if what == "system" and attribute == "kickstart":
+            self._validate_ks_template_path(arg)
+
         if method is None:
             # it's ok, the CLI will send over lots of junk we can't process
             # (like newname or in-place) so just go with it.


Test patch:
Repository: cobbler/cobbler

Issue:
build_reporting fails if empty string in ignorelist
The default configuration in the ubuntu 12.04 cobbler 2.6.5 package has the following in `/etc/settings`:

```
build_reporting_ignorelist = [""]
```

The code that reads this value is in `install_post_report.py`, and the condition that determines whether to send a build report email is:

```
for prefix in settings.build_reporting_ignorelist:
  if name.lower().startswith(prefix) == True:
    sendmail = False
```

With the default configuration, this check always succeeds, and **mail is not sent**.

Fix the issue by modifying the condition to:

```
  if prefix != '' and name.lower().startswith(prefix):
```



Discussion:

Resolving patch:
diff --git a/cobbler/modules/install_post_report.py b/cobbler/modules/install_post_report.py
--- a/cobbler/modules/install_post_report.py
+++ b/cobbler/modules/install_post_report.py
@@ -91,7 +91,7 @@ def run(api, args, logger):
 
     sendmail = True
     for prefix in settings.build_reporting_ignorelist:
-        if name.lower().startswith(prefix) == True:
+        if prefix != '' and name.lower().startswith(prefix):
             sendmail = False
 
     if sendmail == True:


Test patch:
Repository: cobbler/cobbler

Issue:
build_reporting fails if empty string in ignorelist
The default configuration in the ubuntu 12.04 cobbler 2.6.5 package has the following in `/etc/settings`:

```
build_reporting_ignorelist = [""]
```

The code that reads this value is in `install_post_report.py`, and the condition that determines whether to send a build report email is:

```
for prefix in settings.build_reporting_ignorelist:
  if name.lower().startswith(prefix) == True:
    sendmail = False
```

With the default configuration, this check always succeeds, and **mail is not sent**.

Fix the issue by modifying the condition to:

```
  if prefix != '' and name.lower().startswith(prefix):
```



Discussion:

Resolving patch:
diff --git a/cobbler/modules/install_post_report.py b/cobbler/modules/install_post_report.py
--- a/cobbler/modules/install_post_report.py
+++ b/cobbler/modules/install_post_report.py
@@ -86,7 +86,7 @@ def run(api, args, logger):
 
     sendmail = True
     for prefix in settings.build_reporting_ignorelist:
-        if name.lower().startswith(prefix):
+        if prefix != '' and name.lower().startswith(prefix):
             sendmail = False
 
     if sendmail:


Test patch:
Repository: cobbler/cobbler

Issue:
cobbler check outputs incorrect warnings in CentOS 7
Errors found:

2 : Unknown distribution type, cannot check for running service cobblerd
(...)
4 : Apache (httpd) is not installed and/or in path
5 : debmirror package is not installed, it will be required to manage
debian deployments and repositories

imho 5 is valid, as debmirror is not available in CentOS7 repositories. However, 2 and 4 are wrong (Apache web server is installed in default path)



Discussion:
Works for me in master.
Problem does exist in 2.6. Simple patch coming up.


Resolving patch:
diff --git a/cobbler/action_check.py b/cobbler/action_check.py
--- a/cobbler/action_check.py
+++ b/cobbler/action_check.py
@@ -123,6 +123,7 @@ def check_service(self, status, which, notes=""):
            "red hat enterprise linux server",
            "fedora",
            "centos",
+           "centos linux",
            "scientific linux",
            "suse",
            "opensuse"
@@ -171,6 +172,7 @@ def check_yum(self,status):
                "red hat enterprise linux server",
                "fedora",
                "centos",
+               "centos linux",
                "scientific linux",
                "suse",
                "opensuse"
@@ -259,6 +261,7 @@ def check_httpd(self,status):
            "red hat enterprise linux server",
            "fedora",
            "centos",
+           "centos linux",
            "scientific linux"
        ):
            rc = utils.subprocess_get(self.logger,"httpd -v")


Test patch:
Repository: cobbler/cobbler

Issue:
Cobbler import doesnt work with relative paths
```
[root@centos-7-amd64 data]# cobbler import --name=sles-12.1-x86_64 --path=./iso
task started: 2016-01-22_140455_import
task started (id=Media import, time=Fri Jan 22 14:04:55 2016)
Exception occured: <class 'cobbler.cexceptions.CX'>
Exception value: 'Command failed'
Exception Info:
  File "/usr/lib/python2.7/site-packages/cobbler/remote.py", line 82, in run
    rc = self._run(self)
   File "/usr/lib/python2.7/site-packages/cobbler/remote.py", line 226, in runner
    self.logger
   File "/usr/lib/python2.7/site-packages/cobbler/api.py", line 876, in import_tree
    utils.run_this(rsync_cmd, (spacer, mirror_url, path), self.logger)
   File "/usr/lib/python2.7/site-packages/cobbler/utils.py", line 889, in run_this
    die(logger,"Command failed")
   File "/usr/lib/python2.7/site-packages/cobbler/utils.py", line 114, in die
    raise CX(msg)

!!! TASK FAILED !!!
```



Discussion:

Resolving patch:
diff --git a/cobbler/cli.py b/cobbler/cli.py
--- a/cobbler/cli.py
+++ b/cobbler/cli.py
@@ -512,6 +512,9 @@ def direct_command(self, action_name):
             self.parser.add_option("--kickstart",    dest="kickstart_file", help="assign this kickstart file")
             self.parser.add_option("--rsync-flags",  dest="rsync_flags",    help="pass additional flags to rsync")
             (options, args) = self.parser.parse_args()
+            if options.path:
+                # convert relative path to absolute path
+                options.path = os.path.abspath(options.path)
             task_id = self.start_task("import",options)
         elif action_name == "reposync":
             self.parser.add_option("--only",           dest="only",             help="update only this repository name")


Test patch: