Skip to main content

Posts

Showing posts from 2015

artifactory cfengine cache repository

Industrial Linux administration I manage a bunch of servers, more or less 1000 VMs, running either Debian (lenny,wheezy, jessie) or CentOS (5,6,7). In order to handle this, I use CFEngine. I mostly: Create the VM Add CFEngine repository (apt or yum) Install CFEngine (via apt or yum) Bootstrap  CFEngine State of the nation I performed the same steps for all VM I installed for the last 3 years. The main problem I face is the fragmentation of the agents versions: some old installations are still with CFEngine 3.5.x and the latests are on 3.8. This is not a bearable situation: I need to align versions. Methods and attempts My attempts to upgrade CFEngine from CFEngine did not pass tests, mostly because promising version from within CFEngine will remove the package (the running process) and leave the system in an anormal state. I tried several other ways to do it and specifically for the case of CFEngine package, I will manage it with a script that I'm going to lau

Jira workflow for new projects

Associated workflow creation I'm a Jira Cloud user and begining from some version 6, I noticed that when I create a project, it automatically creates a Workflow and Issue Scheme that is prepended by the project key and which is a copy of the default scheme. I always had to make a cleanup after creating a project. Default workflow for new projects I also miss a feature that would allow me to make a custom workflow (and globally custom project setting) the default for new projects I create. Solution: Create with shared configuration While searching, I noticed that with Jira Cloud which is version 7.1.0 at the time I write, there is a link at the bottom of the "Create project" wizard: "Create with shared configuration" will allow me to select the project I want the new one to share configuration with. The new created project will use the same configuration as the project I select There will be no creation of Workflow and Issue Scheme that

dpkg set-selections package database

When trying to reproduce installed packages from one Debian (or Ubuntu) to another, the built-in solution is to Get the installed packages on the one hosts and store a dump to a file Copy that dump to the second host Set the packages listed in the dump to be installed Run the installation This is respectively achieved with $ dpkg --get-selections > /tmp/installed-software $ scp 172.16.16.35:/tmp/installed-software /tmp/ # dpkg --set-selections < /tmp/installed-software # apt-get -u dselect-upgrade But on step 3, I often run into a "dpkg: warning: package not in database at line X:". Thanks to  Ray Davies , the solution is to install "dselect" first: # apt-get install dselect Then perform again step 3 then step 4.

jira datepicker date format

When using Jira, I often make use of date fields: In "due date" In Version "start" and "release" date In many other fields I mostly get helped by the date picker to fill that date field. But if the form expects one format and the datepicker fills with another format, you run into a bad format error. There are two places where date format must be set in a coherent way : /secure/admin/AdvancedApplicationProperties.jspa: jira.date.picker.java.format : d/MM/yy jira.date.picker.javascript.format : %e/%b/%y /secure/admin/LookAndFeel!default.jspa: Day/Month/Year Format: d/MM/yy

vmware workstation 12 unable to load libvmwareui.so

Using VMWare Workstation on ArchLinux, it suddenly refused to launch. when inspecting the logs, which BTW are in /tmp/vmware-<id>, I see: 2015-12-11T17:41:54.442+03:00| appLoader| I125: Log for appLoader pid=1727 version=12.0.1 build=build-3160714 option=Release 2015-12-11T17:41:54.442+03:00| appLoader| I125: The process is 64-bit. 2015-12-11T17:41:54.442+03:00| appLoader| I125: Host codepage=UTF-8 encoding=UTF-8 2015-12-11T17:41:54.442+03:00| appLoader| I125: Host is unknown 2015-12-11T17:41:54.448+03:00| appLoader| W115: HostinfoReadDistroFile: Cannot work with empty file. 2015-12-11T17:41:54.448+03:00| appLoader| W115: HostinfoOSData: Error: no distro file found 2015-12-11T17:41:54.448+03:00| appLoader| I125: Invocation: "/usr/lib/vmware/bin/vmware-modconfig --launcher=/usr/bin/vmware-modconfig --appname=VMware Workstation --icon=vmware-workstation" 2015-12-11T17:41:54.448+03:00| appLoader| I125: Calling: "/usr/lib/vmware/bin/vmware-modconfig --launche

VMWare Workstation scripts

VMWare Workstation scripts to ease my life I currently use VMWare workstation as a daily basis in order to virtualize. As DevopS and writing CFEngine promises, I often need to star from a virgin old OS and test upgrade and configuration deployment. I wrote several simple scripts to ease my work:  https://bitbucket.org/rakotomandimby/vmware-workstation-scripts/src

command line mail with accent

Send characters like é è à in a command line mail I run CentOS 6, and made my first try with the "bsd-mailx" "mail" command line. #!/bin/bash export LANG=fr_FR.UTF-8 export LC_ALL=fr_FR.UTF-8 echo "Tâches du $( date +"%a %d %b %Y" -d "+1days" )" | mail -s "$( date +"%a %d %b %Y" -d "+1days" )" toto@rktmb.org When current month is "August", "Août" in French, it is just the big mess: characters are not encoded! I tried with mail -a "Content-Type: text/plain; charset=UTF-8" But it displayed right for the body, the subject was screwed yet Then I switched to "mailx": # yum remove bsd-mailx # yum install mailx I tried with mail -S sendcharsets=utf-8,iso-8859-1 And this works!

antlr java parser tree tokens

Use antlr to get a tree view of a Java piece of code Let this loop be (save it under ~/workdir/LoopOne.java): class LoopOne { public static void main(String[] args) { float x = Float.parseFloat(args[0]); while ( 0 - x <= 0){ x = x - 1; } } } If you want to get it parsed, you can use Antlr ( http://www.antlr.org/ ) cd ~/workdir curl -O http://www.antlr.org/download/antlr-4.5-complete.jar curl -O https://raw.githubusercontent.com/antlr/grammars-v4/master/java8/Java8.g4 In ".bashrc": export CLASSPATH=".:/home/mrakotomandimby/workdir/antlr-4.5-complete.jar:$CLASSPATH" alias antlr4='java -Xmx500M -cp ".:/home/mrakotomandimby/workdir/antlr-4.5-complete.jar:$CLASSPATH" org.antlr.v4.Tool' alias grun='java org.antlr.v4.runtime.misc.TestRig' antlr4 Java8.g4 javac LoopOne.java Java8*.java grun Java8 compilationUnit -tree LoopOne.java grun Java8 compilationUnit -gui LoopOne.java

archlinux lxc debian centos container

Create Debian8 and CentOS7 LXC containers on Archlinux host Using LXC to create Debian 8 and CentOS 7 containers require to play with AUR. In order to ease the work: # pacman -S base-devel In   /etc/pacman.conf [archlinuxfr] SigLevel = Never Server = http://repo.archlinux.fr/$arch # pacman -S lxc   arch-install-scripts netctl # pacman -S yaourt $ yaourt -S debootstrap yum This last command will pull several packages from AUR then expect some long time compiling I dont really know why, but I had to reboot to have everything working smoothly. Create a CentOS7 container # export CONTAINER_NAME=c7-00 # lxc-create  -t centos --name ${CONTAINER_NAME} -- --release 7 --arch x86_64 \                --repo YOU_CUSTOM_REPO Then edit the configuration: # nano -w /var/lib/lxc/${CONTAINER_NAME}/config Mine looks like this lxc.rootfs = /var/lib/lxc/c7-00/rootfs lxc.include = /usr/share/lxc/config/centos.common.conf lxc.arch = x86_64 lxc.utsname

archlinux switch to bridge network

Switch from normal networking to bridged Just after installation, you need to run networking on a traditional way in order to make initial setup (some needed packages like SSH, netctl,...) "Traditional networking" is here to use the "ethN" or "enoZZZZZ" interface and assign an IP to that interface. But if you want to switch to bridged one, you need to disable that traditional setting and activate the bridged one. Traditional setting Interface name: eth0 Address assignation: static /etc/systemd/network/wired.network [Match] Name=eth0 [Network]  DNS=192.168.128.108 [Address] Address=192.168.129.148/23 [Route] Gateway=192.168.128.108 Start "systemd-networkd.service" # systemctl start systemd-networkd To enable it at boot, # systemctl enable systemd-networkd Switch to bridged setting # pacman -S netctl /etc/netctl/lxcbridge Description="LXC bridge" Interface=br0 Connection=bridge Bi

docker network centos debian

Docker Network configuration on Debian 8 and CentOS 7 My configuration is to run a full VM and then launch several containers on it. Tha VM can be a CentOS or a Debian. As of writing, current versions are Debian 8 and CentOS 7 Debian 8 You can decide what subnet you want the containers work in. Default is "172.17.0.0/16", and the "docker0" belongs to that range. By setting up the "--bip" option in "/etc/default/docker" you can force "docker0" range: DOCKER_OPTS=" --bip=172.17.250.1/24 " CentOS 7 CentOS has a slightly different configuration layout. By setting up the "--bip" option in "/etc/sysconfig/docker-network" you can force "docker0" range: DOCKER_NETWORK_OPTIONS=" --bip=172.17.250.1/24 "

docker discovery usefull commands

Some usefull commands and settings when using docker # docker login Will create a .dockercfg file which is reusable on other hosts Usefull if you choosed a PITA username and password, like I did. # docker pull xxx # docker --name zzz run xxx:yyy Can be chortened as # docker run --name zzz [...] xxx:yyy It will pull for you. If the container zzz ever stopped # docker start zzz Show the full parameters of a container # docker inspect zzz You'll see it's a JSON file, and if you just want to print some parameters: # docker inspect --format '{{.NetworkSettings.IPAddress}}' zzz

debian packaging basic environment

When packaging with Debian, this is the minimal set of package that shoudl be installed   # apt-get install build-essential devscripts debhelper dh-make git subversion  Go to the source directory   $ mk-build-deps This will generate a "<package-name>-build-deps_1.0_amd64.deb" file Move that file one directory up   $ mv "<package-name>-build-deps_1.0_amd64.deb" ../ as root:   # dpkg -i /home/mrakotomandimby/<package-name>-build-deps_1.0_amd64.deb This will output an error (dont worry) But continue with   # apt-get install -f

Archlinux db sig failed

Powerpill rsync lead to errors Switching to powerpill lead me to get these errors: rsync: link_stat "/archlinux/core/os/x86_64/core.db.sig" (in pub) failed: No such file or directory (2) rsync: link_stat "/archlinux/extra/os/x86_64/extra.db.sig" (in pub) failed: No such file or directory (2) rsync: link_stat "/archlinux/community/os/x86_64/community.db.sig" (in pub) failed: No such file or directory (2) rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1637) [generator=3.1.1] Then my install and upgrade fails. In order to get rid of these, in "pacman.conf": SigLevel= PackageRequired LocalFileSigLevel = Optional This solution was found in https://bbs.archlinux.org/viewtopic.php?id=153818

centos7 install postgresql

Using stock CentOS repositories Installing PostgreSQL on CentOS7 can be done two ways: From the PostgreSQL repositories From the official CentOS repositories The later will be described in this document Installation [root@localhost ~]#yum install -y postgresql postgresql-server postgresql-libs postgresql-contrib Initialization [root@localhost ~]# postgresql-setup initdb Make sure it starts at boot [root@localhost ~]# systemctl enable postgresql Start the service [root@localhost ~]# systemctl start postgresql Switch to the service user [root@localhost ~]# su - postgres MAke sure you access locally -bash-4.2$ psql postgres=# User and database creation -bash-4.2$ createuser --interactive --pwprompt jira -bash-4.2$ createdb --owner=jira jira Switch to the Jira user [root@localhost ~]# su - jira [jira@localhost ~]$ psql --username=jira --password psql (9.2.10) Type "help" for help. jira=# If you want to access PostgreSQL without being "jira&q

arhclinux list aur packages

List AUR installed packages yaourt -Qm local/chromium-pepper-flash 1:17.0.0.169-3 local/firefox-nightly 41.0a1.20150526-1 local/freshplayerplugin 0.2.4-1 local/gdk-pixbuf 0.22.0-12 local/glib 1.2.10-12 local/gnome-colors-icon-theme 5.5.1-2 local/gnome-colors-icon-theme-extras 5.5.1-2 local/gnome-themes-extras 2.22.0-3 local/google-chrome 43.0.2357.81-1 local/gtk 1.2.10-15 local/gtk-theme-numix-ocean 2.0.2-2 local/hal 0.5.14-22 local/hal-info 0.20091130-2 local/itcl3 3.4.1-1 local/libpurple-meanwhile 2.10.11-1 local/libxfcegui4 4.10.0-5 local/meanwhile 1.0.2-8 local/package-query 1.5-2 local/pdsh 2.29-2 local/prips 0.9.9-1 local/tcptraceroute 1.5beta7-8 local/thunar-shares-plugin 0.2.0.git-2 local/ttf-office-2007-fonts 1.0-2 local/ttf-win7-fonts 7.1-8 local/ubuntu-font-family-console 0.80-0 local/vmware-systemd-services 0.1-2 (vmware) local/xfce-theme-murrine-unity 20110416-4 local/xfce4-quicklauncher-plugin 1.9.4-10 (xfce4-goodies) local/yaourt 1.5-1

Python self keyword not mandatory

A long time ago I subscribed to the Python language mailing list, and today I discovered in a discussion that "self" is not mandatory. https://docs.python.org/2/tutorial/classes.html#random-remarks states: Often, the first argument of a method is called self. This is nothing more than a convention: the name self has absolutely no special meaning to Python. Note, however, that by not following the convention your code may be less readable to other Python programmers, and it is also conceivable that a class browser program might be written that relies upon such a convention.  It might obvious for some, but for me it is worth of note.

Get UUID from VM and ESX

Sometimes one wants to get the relation between a VM from the ESX inventory and from the system. From ESX:   # esxcli vm process list   vm-inventory-name   ...   UUID: 56 4d 7c f7 f7 a6 a3 b1-fb 71 cd 3b 3c 34 65 0a From Linux command line   $ sudo dmidecode | grep UUID   UUID: 564D7CF7-F7A6-A3B1-FB71-CD3B3C34650A This is the relation and it's up to the user to reformat all these outputs.