Skip to content
This repository was archived by the owner on May 13, 2022. It is now read-only.

Commit 20dbf31

Browse files
committed
move some hardcoded values to a config file
1 parent 27c6d7a commit 20dbf31

File tree

4 files changed

+14
-4
lines changed

4 files changed

+14
-4
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
config.sh
2+
config.ini
23
.ssh
34
*.pyc
45
composer.phar

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ sudo apt-get install zip python-pip python-dev
1919
sudo pip install python-novaclient
2020
```
2121
* Create an ssh key pair for jenkins; add the public key to openstack, with a key name of: jenkins
22+
* Copy config-dist.ini to config.ini and edit
2223
* As the jenkins user, checkout this repo to `/var/lib/jenkins/moodle-ci`
2324
* Download Selenium's standalone server (version: $SELENIUM_VERSION) and stick it in `/var/lib/jenkins/moodle-ci/` too
2425
* `cp config-dist.sh config.sh` and fill in creds

config-dist.ini

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[openstack]
2+
imagename="youcloudimagesnapshotname"
3+
flavor="c1.c4r4"
4+
sshkeyname="openstacksshkeyname"

openstack.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@
33
from novaclient import client
44
import novaclient.exceptions
55
from credentials import get_nova_creds
6+
import ConfigParser
67

78
class cloudslave:
89
def __init__(self, name):
10+
# read the config
11+
config = ConfigParser.ConfigParser()
12+
config.read(os.path.join(os.path.dirname(os.path.realpath(__file__)), 'config.ini'))
13+
914
self.name = name
10-
self.imagename = "jenkins-tests"
11-
self.flavorname = "c1.c4r4"
12-
#self.flavorname = "c1.c8r8"
13-
self.sshkeyname = "jenkins"
15+
self.imagename = config.get('openstack', 'imagename')
16+
self.flavorname = config.get('openstack', 'flavor')
17+
self.sshkeyname = config.get('openstack', 'sshkeyname')
1418

1519
def spinup(self):
1620
# initialise novaclient instance

0 commit comments

Comments
 (0)