Giter VIP home page Giter VIP logo

haiconf's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

haiconf's Issues

Add custom build flags

A multiple of things are handled in distro specific ways. For example, Debian and RHEL use different way of managing services

As such we need to support these distributions. But instead of trying to guess which distribution we use at runtime, we could simply use build specific flag so we can provide distribution specific builds (Debian, RHEL, etc).

Documentation about build tags is available at http://golang.org/pkg/go/build/.

We can start by using the debian tag as it is the distribution haiconf is primiraly built for.

Add a Cron primitive

First shot of the prototype:

Cron({
    Command = "/path/to/ntpdate",
    Ensure = "present",

    Env = {
        PATH = "/foo/bin",
        MAILTO = "foo",
        SHELL = "/bin/zsh",
    },

    Schedule = {
        -- yearly / monthly / weekly / daily / hourly
        Predefined = "yearly",

        -- alternatively :
        WeekDay  = "*",
        Month    = "*",
        MonthDay = "*",
        Hour     = "*",
        Minute   = "*",
    },

    Owner="root",
})

Command corresponds to the command to run
Ensure : either present (the crontab entry must be there) or absent (the crontab entry must be removed)

Env: a map of the environment variables that must be used for the crontab entry. This directly maps to the system's env variables.

Schedule: a map of different possibilities to handle the crontab entry. Either as a Predefined setting or manually by using WeekDay, Month, MonthDay, Hour, Minute such as:

* * * * *  command to execute
┬ ┬ ┬ ┬ ┬
│ │ │ │ │
│ │ │ │ │
│ │ │ │ └───── WeekDay (0 - 6, 0 = sunday)
│ │ │ └────────── Month (1 - 12)
│ │ └─────────────── MonthDay (1 - 31)
│ └──────────────────── Hour (0 - 23, 0 = midnight)
└───────────────────────── Minute (0 - 59)

Owner corresponds to the user who will store the crontab entry. Equivalent to crontab -u. Owner is mandatory.

Add a Group primitive

Initial prototype

Group({
    Name="group1",
    Ensure="present",
})

Group creates a system group Name if Ensure is set to Present or removes it of Ensure is set to absent.

Add an Exec primitive

First shot of a prototype:

Exec({
    Command = "/usr/bin/foo",
    ExecutionDir = "/home/someuser",
    RunAs = "root",
    LogOutput="/path/to/logfile.log",

    Env = {
        PATH     = "$PATH:/usr/bin/foo",
        ENV_VAR2 = "foo-bar",
    }

    -- in seconds
    TimeOut=30
})

The Command specified will be run from ExecutionDir by user defined in RunAs using extra Env variables if specified and output will be logged to LogOutput if specified. If the file defined in LogOutput already exists the captured output is appended to the existing file.

If the command is still running after TimeOut seconds, the command will be stopped. The default TimeOut is defined to 5 seconds, which is more than enough for a normal command.

We will not implement retries as it is for very specific use case and this can be easily implement in a loop in lua.

In case the Exec primitive is not enough/adapted users could eventually use os.execute() available in lua: http://www.lua.org/manual/5.2/manual.html#pdf-os.execute

Add a User Primitive

The prototype is

User({
    Name="foo",
    Password="sEcr3t",
    Ensure="present",
    PrimaryGroup="group1",
    SecondaryGroups={"group2", "group3", "groupN"},
})

User creates (if Ensure it set to present) or removes (if Ensure is set to absent) a user defined by Name and Password. If the user is created, it can be assigned to a mandatory PrimaryGroup and optionaly SecondaryGroups.

Tar error on file names containing multibyte chars

Lua code to reproduce the problem:

TarGz({
    Source = "/etc/",
    Dest = "/tmp/etc.tar.gz",
})

Obtained output:

Archiving /etc/ to /tmp/etc.tar.gz
2013/12/14 05:48:28 archive/tar: header field too long

The problematic file is

 /etc/ssl/certs/TÜBİTAK_UEKAE_Kök_Sertifika_Hizmet_Sağlayıcısı_-_Sürüm_3.pem

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.