Fixed usability issues
* Fixed bug with automatic creation of the directory for repo * Added requirements * Updated README with installation instructions Change-Id: Iac9c08d4fdf1113858a685f7413560325abdefbb
This commit is contained in:
parent
2ef8444a6f
commit
1bd75987b0
39
README.md
39
README.md
|
@ -1,2 +1,39 @@
|
|||
# fuel-external-git
|
||||
# Nailgun API Extension with External Git Server
|
||||
### About
|
||||
Nailgun extension that generates deployment data based on configuration files published in external git repository
|
||||
### Requirements
|
||||
Deployed Fuel 9.0 (Mitaka) Master Node
|
||||
|
||||
### Installation
|
||||
Execute following commands on Fuel Master node
|
||||
```
|
||||
# git clone https://github.com/dukov/fuel-external-git
|
||||
# cd fuel-external-git
|
||||
# pip install -r requirements.txt
|
||||
# python setup.py install
|
||||
# nailgun_syncdb
|
||||
# service nailgun reload
|
||||
```
|
||||
|
||||
### API
|
||||
* GET /clusters/git-repos
|
||||
* Returns list of configured git repos for all clusters/environments
|
||||
* Example ```curl -H "X-Auth-Token: $(fuel token)" http://localhost:8000/api/v1/clusters/git-repos```
|
||||
* POST /clusters/git-repos
|
||||
* Create new repo for particular cluster
|
||||
* input data schema:
|
||||
```"$schema": "http://json-schema.org/draft-04/schema#",
|
||||
"title": "Cluster",
|
||||
"description": "Serialized Cluster object",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {"type": "number"},
|
||||
"repo_name": {"type": "string"},
|
||||
"env_id": {"type": "number"},
|
||||
"git_url": {"type": "string"},
|
||||
"ref": {"type": "string"},
|
||||
"user_key": {"type": "string"}```
|
||||
* Example ```curl -X POST -H "X-Auth-Token: $(fuel token)" http://localhost:8000/api/v1/clusters/git-repos -d '{"user_key": "", "git_url": "https://github.com/dukov/openstack-configs", "env_id": 5, "ref": "master", "repo_name": "osconf1"}'```
|
||||
* PUT /clusters/(?P<cluster_id>\d+)/git-repos/(?P<obj_id>\d+)
|
||||
* Updates repo with obj_id info for cluster cluster_id
|
||||
* Example: ```curl -X PUT -H 'X-Auth-Token: $(fuel token)' http://localhost:8000/api/v1/clusters/4/git-repos/2 -d '{"ref": "master"}'```
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
import yaml
|
||||
|
||||
from nailgun.logger import logger
|
||||
|
||||
|
@ -33,6 +34,19 @@ class OpenStackConfigPipeline(BasePipeline):
|
|||
GitRepo.checkout(repo)
|
||||
repo_path = os.path.join(const.REPOS_DIR, repo.repo_name)
|
||||
|
||||
# Read config for overrides
|
||||
# TODO(dukov) We need to ba able to differentiate configs.
|
||||
# Overrides file should contain following mapping
|
||||
# - role:config_file
|
||||
# - node_id:config_file
|
||||
# Config options from files for roles should override global
|
||||
# configs (placed in repo root).
|
||||
# Config options from files for nodes should override global
|
||||
# and roles config oprions
|
||||
overrides_file = os.path.join(repo_path, 'overrides.yaml')
|
||||
if os.path.exists(overrides_file):
|
||||
overrides = yaml.load(open(overrides_file))
|
||||
|
||||
config_files = [conf for conf in os.listdir(repo_path)
|
||||
if conf.endswith('conf')]
|
||||
|
||||
|
|
|
@ -40,6 +40,8 @@ class GitRepo(NailgunObject):
|
|||
|
||||
@classmethod
|
||||
def create(self, data):
|
||||
if not os.path.exists(const.REPOS_DIR):
|
||||
os.mkdir(const.REPOS_DIR)
|
||||
repo_path = os.path.join(const.REPOS_DIR, data['repo_name'])
|
||||
if os.path.exists(repo_path):
|
||||
shutil.rmtree(repo_path)
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
GitPython==2.0.8
|
Loading…
Reference in New Issue