Posts

Showing posts from April, 2016

Apply DNS to all the Linux servers (minions) using SaltStack

Okey, let's say you want to change nameserver preferences of about 25 Linux servers. You can do it one by one or take a breath and try SaltStack.

1. In your salt master, create a folder name dns (/srv/salt/dns)

2. In /srv/salt/dns/ create:

* init.sls:

/etc/resolv.conf:
  file.managed:
    - source: salt://dns/resolv.conf
    - user: root
    - group: root
    - mode: 644
    - template: jinja

/etc/resolvconf/resolv.conf.d/original:
  file.managed:
    - source: salt://dns/original
    - user: root
    - group: root
    - mode: 644
    - template: jinja

* resolv.conf:

# Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
#     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
nameserver my.dns.server1
nameserver my.dns.server2
search my.domain.com

* original:

search my.domain.com
nameserver my.dns.server1
nameserver my.dns.server2

3. Run this salt command:

# salt '*' state.sls dns


MindTouch Core - Fix the Page-Restriction functionality

A couple months ago when I was trying to made a responsive theme for my MindTouch wiki (dekiwiki opensourced version) using BootStrap, I broke the page-restriction functionality for some reasons. In details, It's the "Add to list" button. When I clicked it, the selected user/group did not appear under the "Permission list" list.

After looking into the core for a while, I finally made it work again. Simply as following:

1. Open the special_pagerestrictions.php file (at /path/to/your/dekiwiki/deki/plugins/special_page/special_pagerestrictions/) using nano or any text editor you like

2. Modify this code block with the red line:

var itemSelectHandler = function(sType, aArgs) {
        var oAcInstance = aArgs[0];
        var oData = aArgs[2];  
        if ( oData && oData[0] )
        {
                oAcInstance._elTextbox.value = Deki.$.htmlDecode(oData[1] ? oData[1] : oData[0]);
jQuery("#autoCompInput").val(oAcInstance._elTextbox.value);
        }
};