oscm - 操作系统配置管理


MIT
跨平台
Python

软件简介

oscm 是个操作系统配置管理工具。

安装

$ python3 setup.py sdist
$ python3 setup.py install

帮助

$ deployment 
Usage: deployment [options] stage projectOptions:
  -h, --help            show this help message and exit
  -r, --revert          revert to revision
  --backup=BACKUP       backup remote to local
  --clean

  stage:
    development | testing | production

  project:.Branch:
    branch management

    -c master|trunk, --checkout=master|trunk
                        checkout branch
    -n branch, --new=branch
                        Create new branch
    -d branch, --delete=branch
                        delete branch
    --release=RELEASE   release version exampe:2014-01-23

  Example: 
    deployment testing www.example.com
    deployment production www.example.com --clean
    deployment testing bbs.example.com --backup=/tmp/backup

  Homepage: http://netkiller.github.com Author: Neo

配置

$ cat etc/testing/example.com.ini 
[www]
;repository=git@192.168.2.1:example.com/www.example.com
repository=https://github.com/oscm/shell.git
source=/tmp/repo
option=--delete --password-file=confure/production/example.com/passwd
exclude=testing/www.example.com.lst
logfile=/tmp/www.example.com
remote=www@192.168.2.15
destination=example.com/www.example.com

[bbs]
repository=https://github.com/oscm/shell.git
remote=www@192.168.2.15
destination=example.com/bbs.example.com

部署项目

$ deployment testing bbs.example.com
receiving incremental file list

sent 82 bytes  received 3228 bytes  601.82 bytes/sec
total size is 243879  speedup is 73.68

恢复

$ deployment testing www.example.com -r master  
$ deployment testing www.example.com -r b1f13fade4c069ff077ce5f26fc3cb1e3c6df902

$ deployment testing www.example.com -r 838cba5
HEAD is now at 838cba5... Merge branch 'master' of https://github.com/oscm/linux
* (detached from 838cba5)
  master
sending incremental file list
.git/
.git/index
        7344 100%    6.34MB/s    0:00:00 (xfer#1, to-check=117/157)

sent 3230 bytes  received 148 bytes  519.69 bytes/sec
total size is 234676  speedup is 69.47

分支管理

展示当前分支

$ deployment branch testing bbs.example.com 
* master

创建分支

$ deployment branch testing bbs.example.com -n development
Switched to a new branch 'development'
$ deployment branch testing bbs.example.com -n testing
Switched to a new branch 'testing'
$ deployment branch testing bbs.example.com -n production
Switched to a new branch 'production'

$ deployment branch testing bbs.example.com 
  development
  master
* production
  testing

检验分支

$ deployment branch testing bbs.example.com -c master
HEAD is now at f9ed461 Update 5.5.8.sh
Switched to branch 'master'

$ deployment branch testing bbs.example.com 
  development
* master
  production
  testing

删除分支

$ deployment branch testing bbs.example.com -d beat
error: Cannot delete the branch 'beat' which you are currently on.

$ deployment branch testing bbs.example.com --delete=beat
error: Cannot delete the branch 'beat' which you are currently on.

$ deployment branch testing bbs.example.com -c master
HEAD is now at f9ed461 Update 5.5.8.sh
Switched to branch 'master'

$ deployment branch testing bbs.example.com --delete=beat
Deleted branch beat (was f9ed461).

$ deployment branch testing bbs.example.com 
* master

版本发布

$ deployment branch testing bbs.example.com --release=10.0-RELEASE
$ git tag 
10.0-RELEASE

备份

$ deployment testing bbs.example.com --backup=/tmp/backup

其他

$ deployment testing bbs.example.com --clean