Skip to content

Instantly share code, notes, and snippets.

@bitprophet
Created June 8, 2012 22:12
Show Gist options
  • Save bitprophet/d901bb3fddc71b50b6a8 to your computer and use it in GitHub Desktop.
Save bitprophet/d901bb3fddc71b50b6a8 to your computer and use it in GitHub Desktop.
[08:57] <alekibango> Porkepix: see command lsb_release -i -d -c
[08:57] <Porkepix> alekibango: lsb_release isn't implemented on all distros ;)
[08:58] <alekibango> heh :) maybe it is installable
[08:58] <alekibango> or you can port it :)
[08:58] <alekibango> or ou need to see files like /etc/debian_version
[08:58] <alekibango> yourself
[08:58] <Porkepix> alekibango: yep. But if you don't know the distro.....how do you choose what package manager to use? :)
[08:59] <alekibango> Porkepix: i guess you should try figuring that out and pushing patches to patchwork
[08:59] <alekibango> thats why it is named patchwork, isnt it?
[08:59] <alekibango> :D
[09:00] <Porkepix> alekibango: but I've no particular good idea. I used version/release files into /etc, but I think it exists better way
[09:00] <alekibango> you can check files like /etc/apt
[09:00] <alekibango> and counterparts in rpm based distros
[09:01] <alekibango> checking for existence of yum command etc
[09:01] <Porkepix> Yep, but with this you must prepare anything for each distro. Lot of works and no generic
[09:01] <alekibango> Porkepix: patchwork really will need such thing
[09:01] <Porkepix> The must would be to have a generic command/file that indicate distro's name
[09:02] <alekibango> or generic command to install a package
[09:02] <Porkepix> But if it exists not atm, that's distro's cretors works
[09:02] <Porkepix> work*
[09:02] <alekibango> Porkepix: i mean fabric command
[09:02] <alekibango> method
[09:03] <alekibango> see https://github.com/fabric/patchwork
[09:03] <Porkepix> uname -a give distro's name with lot of other things. But there is not any parameter to have just the distro's name
[09:03] <Porkepix> I saw it, bitprophet showed me that
[09:04] <alekibango> i do not have distro name in uname -a
[09:04] <alekibango> on my debian sid
[09:05] <alekibango> uname -o gives 'GNU/Linux'
[09:05] <alekibango> (debian sid)
[09:05] <Porkepix> On CentOS and on debian testing it gives distro name
[09:05] <alekibango> Porkepix: you should rather check files in etc
[09:06] <alekibango> for example having debian_version indicates debian related distro
[09:06] <alekibango> or you can check for fonfig files and binary of the package manager
[09:06] <alekibango> like yum, apt-get/aptitude, /...
[09:07] <alekibango> other projects did solve this by having smart script which will report all sorts of things
[09:08] <alekibango> but fabric needs that on client (fabric) side
[09:08] <alekibango> to really stay independent on server
[09:09] <alekibango> (for example ohai)
[09:10] <alekibango> we should write similar library into fabric (or rather patchwork)
[09:10] <alekibango> bitprophet: do you agree?
[09:11] * alekibango needs to leave.. see you later
[09:12] <Porkepix> alekibango: strange, uname don't give anymore distro's name =d
[09:13] <Porkepix> alekibango: ok, see you
[09:13] <alekibango> Porkepix: it never did :) just sometimes you can guess the name from kernel version
[09:13] <Porkepix> alekibango: bitprophet started a library like that, he show me it, look backlog :P
[09:13] <Porkepix> I should search for link but have not time, must go to work
[09:13] <alekibango> Porkepix: ok, then help him :)
[09:14] <alekibango> this url -- https://github.com/fabric/patchwork/blob/master/patchwork/info.py
[09:14] <alekibango> git clone https://github.com/fabric/patchwork.git
[09:14] <alekibango> :)
[09:15] <Porkepix> hehe, you searched it fast :p
[09:15] <alekibango> i wil contribute debian part if it will be needed
[09:16] <alekibango> see you later
[09:16] <Porkepix> I've only debian and centos under the hand personally
[09:16] <Porkepix> eventually ubuntu
[09:16] <alekibango> Porkepix: then just add sentinel
[09:16] <alekibango> debian -- /etc/debian_version
[09:16] <alekibango> and you are ready to go
[09:16] <alekibango> its one liner
[09:16] <alekibango> :)
[09:16] <alekibango> and centos might be similar
[09:16] <Porkepix> centos is similar to fedora and redhat
[09:17] <Porkepix> he have system_release, redhat_release and centos_release files
[09:18] <alekibango> Porkepix: so it will not be hard to write the patch
[09:18] <alekibango> make github account, clone the fabric
[09:18] <alekibango> patch it, ask for merge
[09:18] <alekibango> its easy
[09:18] <alekibango> :D
[09:18] * alekibango afks now really
[09:18] <Porkepix> alekibango: but should do anything about 3 files
[09:18] <Porkepix> me too, must go work ><'
[09:19] <alekibango> Porkepix: i can contribute the patch if its hard to you :)) later
[09:39] <Porkepix> re :p
[09:45] <ninkotech> re (alekibango @ work)
[09:46] <Porkepix> ninkotech: oh you use 2 nicks :p
[09:46] <ninkotech> Porkepix: should i write debian detection into patchwork file?
[09:46] <ninkotech> its 2 minutes for me
[09:47] <Porkepix> ninkotech: I'm not totally familiar with github right now, when it's for a contribution to free software.
[09:47] <Porkepix> A'm not againt explanation about how to do it :p
[09:47] <Porkepix> I'm*
[09:48] <ninkotech> Porkepix: ok, i will try doing debian, you will do the centos one ok?
[09:48] <ninkotech> so i will tell you each step
[09:48] <ninkotech> 1) get account :)
[09:48] <Porkepix> I've one and I already use github for my own projects
[09:48] <ninkotech> ok
[09:48] <Porkepix> But I never used it for other's projects to contribute
[09:49] <ninkotech> get to https://github.com/fabric/patchwork
[09:49] <ninkotech> on top right, find button 'Fork'
[09:49] <ninkotech> my fork is https://github.com/alekibango/patchwork.git
[09:50] <ninkotech> where is git address, click [ssh]
[09:50] <ninkotech> you will get address like git@github.com:alekibango/patchwork.git
[09:50] <ninkotech> clone that one
[09:51] <ninkotech> i did: git clone git@github.com:alekibango/patchwork.git mypatchwork
[09:51] <Porkepix> ninkotech: but git:// link is readonly while https or ssh are read+write
[09:51] <Porkepix> normal ?
[09:52] <ninkotech> use ssh one
[09:52] <ninkotech> i think you already have ssh key defined, right?
[09:52] <ninkotech> ssh is better than https :)
[09:52] <Porkepix> yeah
[09:53] <Porkepix> Why the git one is read only ?
[09:53] <ninkotech> its not secure
[09:53] <ninkotech> so it is public, but you cant write into it
[09:53] <ninkotech> its efficient though
[09:53] <Porkepix> Ok
[09:53] <Porkepix> Clone done
[09:54] <ninkotech> now fix the code :)
[09:55] <ninkotech> hmm our patches will be in conflict :)
[09:55] <Porkepix> What file should I choose ? There is centos-release, redhat-release who is a symlink to centos-release and system-release, symlink to centos-release too
[09:55] <ninkotech> use centos-release
[09:55] <ninkotech> the most specific one
[09:55] <ninkotech> ha, there is a problem - we might need to improve the code to search for centos first
[09:55] <ninkotech> so we should use ordered dictionary
[09:56] <Porkepix> btw I think I can add redhat-release who should be in RHEL ? redhat-release should be here for compatibility issues I guess ?
[09:56] <ninkotech> it is not redhat
[09:56] <ninkotech> its centos
[09:56] <ninkotech> its redhat family, but not redhat distro
[09:56] <ninkotech> now we need to find out the distro first
[09:56] <Porkepix> Yeah but I mean, RHEL should have redhat-release file ?
[09:56] <ninkotech> right
[09:56] <Porkepix> And just him
[09:56] <ninkotech> thats why we need to check for clones first
[09:56] <ninkotech> simar for debian clones
[09:56] <ninkotech> many have /etc/debian_version
[09:57] <ninkotech> similar*
[09:57] <Porkepix> Ok
[09:57] <Porkepix> True
[09:57] <Porkepix> ubuntu should have debian_release I think :p
[09:57] <ninkotech> :)
[09:57] <Porkepix> debian_version*
[09:57] <ninkotech> Porkepix: anyway,for now you can care just about your centos
[09:57] <ninkotech> it will evolve
[09:58] <ninkotech> i think the algorithm needs some fix
[09:58] <ninkotech> like checking for 'all sentinel files' - not just first
[09:58] <Porkepix> Ah, I was thinking you'll be it now :p
[09:58] <Porkepix> do it*
[09:58] <ninkotech> Porkepix: rather first you do your part
[09:58] <ninkotech> i will merge your changes
[09:59] <ninkotech> and do mine, ok?
[09:59] <Porkepix> Ok
[09:59] <Porkepix> Just centos or RHEL too ?
[09:59] <ninkotech> Porkepix: you can try doing both
[09:59] <ninkotech> i hope prophet will like our changes
[09:59] <ninkotech> :D
[10:00] <ninkotech> Porkepix: but do it fast, my boss will come in soon..
[10:00] <ninkotech> will have loong meeting
[10:01] <ninkotech> Porkepix: after changes. think twice about commit message
[10:02] <Porkepix> ninkotech: If you want we can see that after ?
[10:02] <ninkotech> ??
[10:03] <ninkotech> we all will see it
[10:03] <ninkotech> so, you commit -- like git commit -a
[10:03] <ninkotech> and git push # to send it to your account on github
[10:03] <ninkotech> then open againt web page of that
[10:04] <ninkotech> and make pull request
[10:04] <ninkotech> thats all you should do
[10:05] <ninkotech> if accepted, it will become merged to main code
[10:05] <ninkotech> including your name and commit message
[10:05] <Porkepix> ninkotech: sorry, anyone from my internship was here, I must do two things at the same time
[10:06] <ninkotech> np, i wrote all steps, so you can do if i will have the same problem here
[10:06] <ninkotech> :D
[10:06] <Porkepix> ninkotech: two question first : why files for any distros are tuples ? And should I put redhat ? I guess file is redhat-release, but I've not RHEL under the hand to see it
[10:07] <ninkotech> if you do not have such distro, you can leave that on rhel users to commit theirs patch :)
[10:07] <ninkotech> you do not need it -> so not not worry about it :)
[10:07] <ninkotech> that way the free software/opensource is driven by needs of users
[10:07] <Porkepix> YEah but I supposd it was that file, that was to help :p
[10:07] <Porkepix> but ok :p
[10:08] <Porkepix> And why tuples for files ?
[10:11] <ninkotech> it all should be tupples, not a dictionary
[10:11] <ninkotech> there could be more files to detect something
[10:11] <ninkotech> i guess we should change that to 'have all listed files'
[10:11] <ninkotech> to be the distro
[10:12] <ninkotech> problem is with files like /etc/debian_version
[10:12] <ninkotech> and /etc/redhat_version
[10:12] <ninkotech> which is also on derived distros
[10:13] <ninkotech> Porkepix: how would you check for difference between centos and redhat and fedora?
[10:14] <ninkotech> i think it should be list (ordered) or sentinel files, not dictionary
[10:14] <ninkotech> like:
[10:14] <ninkotech> sentinel_files = [
[10:15] <ninkotech> ['fedora', ['fedora-release',]
[10:15] <Porkepix> ninkotech: pull requests done. To check difference : fedora-release, centos-release and redhat-release. You check this with an order or you check that there is the file and NOT the others
[10:15] <ninkotech> ]
[10:15] <Porkepix> Or you read the file contents
[10:15] <ninkotech> reading files is always slower
[10:15] <Porkepix> All distros should have a system-release file ;o
[10:15] <ninkotech> heh
[10:15] <ninkotech> i wish
[10:16] <Oct> hello
[10:16] <ninkotech> Porkepix: what is your url?
[10:16] <Oct> when fabric abort, i'm left without traceback
[10:16] <Oct> is there something to do to get it ?
[10:16] <Porkepix> ninkotech: https://github.com/clement-lefevre/patchwork
[10:16] <ninkotech> Oct: can you show us the source and the output?
[10:17] <ninkotech> (pastebin.com)
[10:17] <Oct> what source ?
[10:17] <Porkepix> ninkotech: I don't know how to choose which one to use. I've a github profile with my nick and one with my realname for my internship =d
[10:17] <ninkotech> i mean, i can only guess from your description
[10:17] <Oct> ok
[10:18] <Oct> http://privatepaste.com/d489281f31
[10:18] <Oct> I'm refering to the "fatal error: Needed to prompt..."
[10:18] <Oct> I have no information what is the origin of this issue
[10:18] <ninkotech> Oct: i believe you can guess the issue if you will carefuly read what it says
[10:18] <Oct> nope
[10:19] <ninkotech> abort-on-prompts -- set this to false
[10:19] <ninkotech> False
[10:19] <ninkotech> and you will get prompt
[10:19] <ninkotech> to solve some problem with git
[10:19] <Oct> I don't know what command triggered a prompt
[10:19] <ninkotech> task 'pull_master'
[10:19] <ninkotech> you can test the code from pull_master manually on target machine
[10:19] <Oct> I'm on the target machine
[10:20] <Oct> and the code seems to work when I run it by hand
[10:20] <Oct> so there's something weird going on
[10:20] <Oct> I'll printf-debug
[10:21] <Porkepix> ninkotech: btw, after merge and after other updates on main repo, how do I sync my own repo with the main one ?
[10:21] <ninkotech> Oct: problem is you configured (prolly in fabfile.py) abort-on-prompts
[10:23] <ninkotech> Porkepix: ha, i forgot how i did it last time... you can merge from it or you can clone the main code again, its not a big problem
[10:23] <ninkotech> you can delete your code after merge
[10:23] <Porkepix> ninkotech: there is probably better way to do it ?
[10:24] <ninkotech> if you will write continually, there might be some better tricks, but for causual patch twice a year, this is effective :)
[10:25] <ninkotech> you can merge bitprophet into your fork, and push it again on your account
[10:25] <ninkotech> but that will not do anything valuable
[10:25] <ninkotech> unless you are going to maintain your patch
[10:25] <ninkotech> your fork of the code
[10:25] <ninkotech> and i guess its not effective
[10:26] <ninkotech> so you can just delete your fork
[10:26] <ninkotech> and when the time comes, fork again
[10:27] <ninkotech> Porkepix: and next time make large contributioN!
[10:27] <ninkotech> :)
[10:27] <ninkotech> not just 2 lines
[10:27] <ninkotech> :)
[10:28] <Oct> well, removing the abort on prompt does not explain why I _now_ need a password to log on the server
[10:28] <Oct> looks like something curious is at work with the ssh auth
[10:29] <ninkotech> ah, that seems to be the problem
[10:29] <ninkotech> changed ip. reinstalled server - or simething like that
[10:29] <Oct> nope
[10:29] <Oct> nothing changed, the vm has been running without interruption
[10:29] <Oct> and I'm able to ssh as root without any issue
[10:30] <ninkotech> Oct: ok, i do not know how to solve that... but fabric did similar problems to me when i used localhost
[10:30] <ninkotech> started to use fqdn and it workerd
[10:30] <Porkepix> ninkotech: Ok, I'll see for it :p
[10:30] <Oct> mmm
[10:30] <Oct> paramiko stuff ?
[10:30] <Porkepix> ninkotech: Not too big works for first public commit :p
[10:30] <ninkotech> Oct: i do not really know, ask someone smarter :)
[10:31] <ninkotech> Porkepix: small step for a humankind, big one for a contributor!
[10:31] <Porkepix> ninkotech: btw....I should search how to use patchwork....because I don't know :D
[10:31] <ninkotech> Porkepix: i do not know too, but i will find out soon :)
[10:31] <Porkepix> =p
[10:31] <ninkotech> Porkepix: my first public contribution was 2 lines of code, and it changed me completely
[10:32] <Porkepix> hehe
[10:32] <ninkotech> i stopped being consumer, i become producer
[10:32] <ninkotech> in all areas of life
[10:32] * ninkotech gets back to his work
[10:33] <Porkepix> ninkotech: but in a first time, I'm not fully certain that what I did is ok, so I prefer to ask ;)
[10:36] <ninkotech> Porkepix: thats not that important, important is that you have become contributing member of society :)
[10:36] <ninkotech> love and pain will solve out issues
[10:37] <ninkotech> :D
[11:45] <Porkepix> ninkotech: do you work on fabric's core too ?
[11:58] <ninkotech> Porkepix: no, i am just user :)
[11:58] <ninkotech> causual
[11:59] <ninkotech> but i am now using fabric 100 times a day to deploy and test code :)
[11:59] <ninkotech> it is love, as with python
[11:59] <Porkepix> ninkotech: Ok. Cause I guess I've spotted a new bug, with chained call to cd()
[11:59] <ninkotech> Porkepix: cant look at that right now...
[12:00] <Porkepix> ninkotech: :p
[12:00] <ninkotech> try talking to the prophet :) and make another pull request
[12:00] <ninkotech> :D
[12:00] <ninkotech> maybe even write bug report first
[12:00] <ninkotech> and in commit message tell that its fixing that bug
[12:01] <Porkepix> ninkotech: I've no idea of how cd works and how to fix it ;)
[12:04] <ninkotech> Porkepix: with cd(directory):
[12:04] <ninkotech> run(stuff)
[12:04] <Porkepix> ninkotech: I mean to say internally how it is coded
[12:05] <ninkotech> look how you can write your own container -- there is some howto on web
[12:05] <Porkepix> ninkotech: I used a lot cd() function and guess I found a bug in particular case of usage ;)
[12:05] <ninkotech> it explains a lot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment