Panel: Parser "File" for Eggs is broken

Created on 22 Sep 2020  路  16Comments  路  Source: pterodactyl/panel

DO NOT REPORT ISSUES CONFIGURING: SSL, PHP, APACHE, NGINX, YOUR MACHINE, SSH, SFTP, ETC. ON THIS GITHUB TRACKER.

For assistance installating this software, as well as debugging issues with dependencies, please use our discord server: https://discord.gg/pterodactyl

You MUST complete all of the below information when reporting a bug, failure to do so will result in closure of your issue. PLEASE stop spamming our tracker with "bugs" that are not related to this project.

STOP: READ FIRST, AND THEN DELETE THE ABOVE LINES

Background (please complete the following information):

  • Panel or Daemon: Daemon
  • Version of Panel/Daemon: 1.0RC6
  • Server's OS: Debian 10
  • Your Computer's OS & Browser: Win 10 + Chrome

Describe the bug
A clear and concise description of what the bug is.
Please provide additional information too, depending on what you have issues with:
Panel: php -v (the php version in use).
Daemon: uname -a and docker info (your kernel version and information regarding docker)

To Reproduce
Steps to reproduce the behavior:

  1. Create an Egg and use "file" as Parser for Configuration
  2. Create Server

Expected behavior
A clear and concise description of what you expected to happen. If applicable, add screenshots or a recording to help explain your problem.

The Parser "file" is broken.

Configuration is after Server install

ListenPort = 8087 ListListenHost=  "0.0.0.0" = "0.0.0.0"e/container/TeamSpeak3-Client-linux_amd64/ts3client_linux_amd64"
YoutubeDLPath = "/home/container/youtube-dl/youtube-dl"

Configuration should be:

ListenPort = 8087
ListenHost = "0.0.0.0"
TS3Path = "/opt/sinusbot/TeamSpeak3-Client-linux_amd64/ts3client_linux_amd64"

Configuration in the Egg

{
    "config.ini": {
        "parser": "file",
        "find": {
            "ListenPort=": "ListenPort= {{server.build.default.port}}",
            "ListenHost=": "ListenHost=  \"0.0.0.0\""
        }
    }
}
bug

All 16 comments

a.) fun
b.) use the ini parser for an ini file. The file parser is a last ditch effort to support random file formats.

From what I am seeing though it's just missing a \n at the end of lines.

Have the same issue using the @parkervcp FiveM egg.

@parkervcp could you explain what we need to do? adding \n results in this:

image

Thank you

This is a bug in the daemon. It's not something just putting something in the egg.

This is a bug in the daemon. It's not something just putting something in the egg.

Yeah I understand but just tried your suggestion: :)
From what I am seeing though it's just missing a \n at the end of lines.

Thanks for clearing it up

This is a bug in the daemon. It's not something just putting something in the egg.

Yeah I understand but just tried your suggestion: :)

This was not a suggetion for fixing this Bug ;)

I just have build wings myself so I had the lastest updates but this still doesnt fix the issue @DaneEveritt

image

So it looks like it was taking the /n off every line before not just ones it replaced.

In my Eye's should the whole Parsing Part should be reviewed. "Ini" also don't work as it should

Please open parser specific bugs as a new issue unless there is direct overlap between an issue across multiple parsers. Comments inside bug reports will not be noticed (or remembered) and will not end up getting fixed.

ini uses = this does not. @gOOvER fyi

ini uses = this does not. @gOOvER fyi

i know :)

I'm not familiar with golang but this fixed it for me. Please beautify it x) @DaneEveritt

func (f *ConfigurationFile) parseTextFile(path string) error {
    file, err := os.OpenFile(path, os.O_CREATE|os.O_RDWR, 0644)
    if err != nil {
        return err
    }
    defer file.Close()

    scanner := bufio.NewScanner(file)
    var lines []string

    for scanner.Scan() {
        t := scanner.Text()

        // Iterate over the potential replacements for the line and check if there are
        // any matches.
        var hasreplaced = false;

        for _, replace := range f.Replace {
            if !strings.HasPrefix(t, replace.Match) {
                continue;
            }

            hasreplaced = true
            lines = append(lines, replace.ReplaceWith.String() + "\n");
        }

        if !hasreplaced {
            lines = append(lines, t + "\n");
        }
    }

    if err := scanner.Err(); err != nil {
        return err
    }

    var x = []byte{}

    for i:=0; i<len(lines); i++{
        b := []byte(lines[i])
        for j:=0; j<len(b); j++{
            x = append(x,b[j])
        }
    }

    return ioutil.WriteFile(path, x, 0644)
}

This is still an issue

This
https://raw.githubusercontent.com/parkervcp/eggs/master/gta/fivem/server.cfg

Becomes
https://hastebin.com/ibulavisuw.properties

This is the parser config

{
    "server.cfg": {
        "parser": "file",
        "find": {
            "endpoint_add_tcp": "endpoint_add_tcp \"0.0.0.0:{{server.build.default.port}}\"",
            "endpoint_add_udp": "endpoint_add_udp \"0.0.0.0:{{server.build.default.port}}\"",
            "sv_hostname": "sv_hostname \"{{server.build.env.SERVER_HOSTNAME}}\"",
            "set sv_licenseKey": "set sv_licenseKey {{server.build.env.FIVEM_LICENSE}}",
            "set steam_webApiKey": "set steam_webApiKey {{server.build.env.STEAM_WEBAPIKEY}}",
            "sv_maxclients": "sv_maxclients {{server.build.env.MAX_PLAYERS}}"
        }
    }
}

This is still an issue

This
https://raw.githubusercontent.com/parkervcp/eggs/master/gta/fivem/server.cfg

Becomes
https://hastebin.com/ibulavisuw.properties

This is the parser config

{
    "server.cfg": {
        "parser": "file",
        "find": {
            "endpoint_add_tcp": "endpoint_add_tcp \"0.0.0.0:{{server.build.default.port}}\"",
            "endpoint_add_udp": "endpoint_add_udp \"0.0.0.0:{{server.build.default.port}}\"",
            "sv_hostname": "sv_hostname \"{{server.build.env.SERVER_HOSTNAME}}\"",
            "set sv_licenseKey": "set sv_licenseKey {{server.build.env.FIVEM_LICENSE}}",
            "set steam_webApiKey": "set steam_webApiKey {{server.build.env.STEAM_WEBAPIKEY}}",
            "sv_maxclients": "sv_maxclients {{server.build.env.MAX_PLAYERS}}"
        }
    }
}

Did you try my fix that I posted in my previous comment?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

x390 picture x390  路  4Comments

stijnb1234 picture stijnb1234  路  3Comments

parkervcp picture parkervcp  路  3Comments

TRYTIG picture TRYTIG  路  3Comments

WeatherSquad picture WeatherSquad  路  3Comments