Clement Verna’s Notes¶
Python¶
Python Trick and Tips¶
Get a dict keys in a for loop
a = {'a': 1, 'b': 2, 'c': 3}
for key in a:
print(key)
the keys a, b and c will be printed.
Run a single test with nose
nosetests name_of_the_module.py:Nameoftheclass.nameofthetest
Get Color in a container shell
docker exec -it -e TERM=xterm name_of_container /bin/bash
Usefull debugger ipdb
$ dnf install python2-ipdb
Dedugger to check –> pdb++
Expend PYTHONPATH to add working dir
$ export PYTHONPATH="$(pwd):${PYTHONPATH}"
Fedora¶
Fedora notes¶
Disk usage
$ du -shxc /*
-s = summarize
-h = human readable
-x = one file system
-c = grant total
Koji scratch build
$ koji build --scratch f27 package.srpm
Curl download of file
$ curl -o name_of_the_file https://url_of _the_file
Build a srpm with mock
$ mock -v -r fedora-27-x86_64 SPRM/my.sprm
RPM get version of an rpm
$ rpm -q --qf "%{version}\n" python3
journalctl follow a service logs
$ journalctl -lfu name_of_the_service
NEOVIM¶
Using cscope with for Python. First need to install the pycscope project https://github.com/portante/pycscope. Then generate the cscope output file
$ cd source_code_dir
$ pycscope -R
This generate a cscope.out file. Inside vim run the following command to add the cscope file to the db
:cs add cscope.out
Then use the cs command to search the symbols
find = Query cscope. All cscope query options are available
except option #5 ("Change this grep pattern").
USAGE = cs find {querytype} {name}
{querytype} corresponds to the actual cscope line
interface numbers as well as default nvi commands:
0 or s: Find this C symbol
1 or g: Find this definition
2 or d: Find functions called by this function
3 or c: Find functions calling this function
4 or t: Find this text string
6 or e: Find this egrep pattern
7 or f: Find this file
8 or i: Find files #including this file
9 or a: Find places where this symbol is assigned a value
OSBS notes¶
Fedora’s Openshift Build System¶
Upstream¶
Development Environment
Documentation¶
Deployment¶
Fedora Infrastructure ansible:
- osbs cluster playbook
- osbs atomic-reactor role
- osbs-client role
- osbs-common
- osbs-namespace
- osbs-on-openshift
- ansible-ansible-openshift-ansible role
Fedora Infrastructure SOP:
Packages¶
Misc¶
Rebuild of container buildroot
$ docker build -t buildroot --rm --no-cache /etc/osbs/buildroot
Update packages on target using ansible
$ ansible $target -m package -a "name=koji-containerbuild state=latest"
Check for build running in openshift
$ oc login
$ oc status
$ oc -n osbs-fedora describe build <my-build>
Get builds for a namespace
$ oc -n namespace get build
Cancel a build
$ oc -n namespace cancel-build <my-build>
Clean old builds
$ oc adm prune builds --keep-complete=2 --keep-failed=1 --keep-younger-than=24h0m0s --orphans --confirm
Docker insecure-registry : To add the insecure registry need to edit the /etc/sysconfig/docker and modify the OPTIONS parameter