本文整理汇总了Python中OSConf.get_apps方法的典型用法代码示例。如果您正苦于以下问题:Python OSConf.get_apps方法的具体用法?Python OSConf.get_apps怎么用?Python OSConf.get_apps使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OSConf
的用法示例。
在下文中一共展示了OSConf.get_apps方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: app_setup
# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_apps [as 别名]
def app_setup(self):
user = OSConf.OSConf()
user.load_conf()
apps_cache = OSConf.get_apps(user)
psql_version = common.cartridge_types['postgresql-9.2']
postgresql_url = apps_cache[self.app_name]['embed'][psql_version]['url']
postgresql_user = apps_cache[self.app_name]['embed'][psql_version]['username']
postgresql_passwd = apps_cache[self.app_name]['embed'][psql_version]['password']
postgresql_dbname = apps_cache[self.app_name]['embed'][psql_version]['database']
postgresql_port = apps_cache[self.app_name]['embed'][psql_version]['port']
app_setup_steps = [
"cp -rv %s/app_template/postgresql/%s/* %s/%s" % ( WORK_DIR, self.test_variant, self.git_repo, self.app_config[self.test_variant]['destination'] ),
"find %s/%s -type f -print | while read file ; do echo 'Editing file: ' $file ; sed -i -e 's/#pgsql_user#/%s/;s/#pgsql_passwd#/%s/;s/#pgsql_dbname#/%s/;s/#pgsql_host#/%s/;s/#pgsql_port#/%s/;s/#str_random1#/%s/;s/#str_random2#/%s/' $file; done" % (self.git_repo, self.app_config[self.test_variant]['destination'], postgresql_user, postgresql_passwd, postgresql_dbname, postgresql_url, postgresql_port, self.random1, self.random2 ),
"cd %s" % (self.git_repo),
"git add %s" % (self.app_config[self.test_variant]['destination'] or '.' ),
"git commit -a -m deployment",
"git push" ]
if self.test_variant in ('ruby', 'ruby-1.9', 'rack'):
app_setup_steps.insert(3, 'bundle install' )
app_setup_steps.insert(4, 'bundle check' )
if self.test_variant == 'nodejs':
app_setup_steps.insert(3, 'rm -f deplist.txt' )#bug if the pg dependency is there...
if self.test_variant in ('python-2.7','python-3.3'):
#app_setup_steps.insert(3, "cp -f %s/../client/data/snapshot_restore_mysql_data/setuppostgresql.py ./setup.py" % (WORK_DIR))
app_setup_steps.insert(3, "sed -i -e \"s/#\s*'psycopg2',/'psycopg2',/g\" setup.py")
( ret_code, ret_output) = commands.getstatusoutput(" && ".join(app_setup_steps))
print ret_output
return ret_code
示例2: verify_proxy_port
# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_apps [as 别名]
def verify_proxy_port(self, app_name):
if (self.proxy_host==None or self.proxy_port==None):
print "ERROR: Unable to capture PROXY_PORT/PROXY_HOST from rhc ctl app -c show-port output"
return 1
cart = OSConf.get_apps()[app_name]['embed'][common.cartridge_types['mysql']]
cmd="echo 'SHOW TABLES' | mysql --host=%s --port=%s --user=%s --password=%s %s "%(self.proxy_host, self.proxy_port, cart['username'], cart['password'], cart['database'])
(status, output) = common.run_remote_cmd(app_name, cmd)
return status
示例3: user_info
# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_apps [as 别名]
def user_info(user_email=None, user_passwd=None, data_source_from_s3=False):
if user_email is None:
(user_email, user_passwd) = get_default_rhlogin()
'''
if data_source_from_s3 == True:
#TODO: What was this s3 good for?
# I WOULD LIKE TO REMOVE TO AVOID CONFUSION
print "Getting user info from s3"
if OSConf.initial_conf() != 0:
return 1
'''
return OSConf.get_apps()
示例4: git_pull_n_update
# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_apps [as 别名]
def git_pull_n_update(app_name):
mongo = OSConf.get_apps()[app_name]['embed'][common.cartridge_types['mongodb']]
cmd='''
cd %s &&
git remote add upstream -m master git://github.com/openshift/jbossas-mongoDB-quickstart.git &&
git pull -s recursive -X theirs upstream master &&
git rm -r .openshift/config/modules &&
export WEBXML='src/main/webapp/WEB-INF/web.xml' &&
sed -i '/<param-name>host/,/init-param/ s/<param-value>.*/<param-value>%s<\/param-value>/' $WEBXML &&
sed -i '/<param-name>port/,/init-param/ s/<param-value>.*/<param-value>%s<\/param-value>/' $WEBXML &&
sed -i '/<param-name>db/,/init-param/ s/<param-value>.*/<param-value>%s<\/param-value>/' $WEBXML &&
sed -i '/<param-name>user/,/init-param/ s/<param-value>.*/<param-value>%s<\/param-value>/' src/main/webapp/WEB-INF/web.xml &&
sed -i '/<param-name>password/,/init-param/ s/<param-value>.*/<param-value>%s<\/param-value>/' src/main/webapp/WEB-INF/web.xml &&
git commit -a -m "Removed modules and updated web.xml for mongoDB" &&
git push
'''%(self.app_name, mongo['url'], mongo['port'], mongo['database'], mongo['username'], mongo['password'])
(status, output) = common.command_getstatusoutput(cmd)
return status
示例5: test_method
# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_apps [as 别名]
def test_method(self):
#
# Step 1
#
self.info("---------------------------------")
self.info("1. Create a JBoss application")
self.info("---------------------------------")
ret_code = common.create_app(self.app_name, common.app_types["jbossas"], clone_repo = True)
self.assert_equal(ret_code, 0, "Application must be created successfully")
#
# Step 2
#
self.info("---------------------------------")
self.info("2. Deploy testing application")
self.info("---------------------------------")
ret_code = self.deploy_jgroups_testing_application("./" + self.app_name)
self.assert_equal(ret_code, 0, "The application must be deployed successfully")
# Waiting for the application to stand up
sleep(30)
#
# Step 3
#
self.info("---------------------------------")
self.info("3. Verify JGroups version number")
self.info("---------------------------------")
user = OSConf.OSConf()
user.load_conf()
app_cache = OSConf.get_apps(user)
app_url = app_cache[self.app_name]['url']
self.assert_true(
int(common.fetch_page(app_url + "/jgroups.jsp")) > 6148,
"JGroups version must be higher than 3.0.4"
)
self.passed(self.summary)
示例6: upload_server
# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_apps [as 别名]
def upload_server(app_name):
mysql = OSConf.get_apps()[app_name]['embed'][common.cartridge_types['mysql']]
try:
f = open('%s/server.js'%app_name,'w')
f.write('''#!/bin/env node
// OpenShift sample Node application
var express = require('express');
var fs = require('fs');
var mysql = require('mysql');
var client = mysql.createClient({
user:'%s',
password :'%s'
});
client.host ='%s';
client.port = %s;
client.database = '%s';
// Local cache for static content [fixed and loaded at startup]
var zcache = { 'index.html': '' };
zcache['index.html'] = fs.readFileSync('./index.html'); // Cache index.html
// Create "express" server.
var app = express.createServer();
/* ===================================================================== */
/* Setup route handlers. */
/* ===================================================================== */
// Handler for GET /health
app.get('/health', function(req, res){
res.send('1');
});
// Handler for GET /asciimo
app.get('/asciimo', function(req, res){
var link="https://a248.e.akamai.net/assets.github.com/img/d84f00f173afcf3bc81b4fad855e39838b23d8ff/687474703a2f2f696d6775722e636f6d2f6b6d626a422e706e67";
res.send("<html><body><img src='" + link + "'></body></html>");
});
// Handler for GET /
app.get('/', function(req, res){
res.send(zcache['index.html'], {'Content-Type': 'text/html'});
});
// Handler for GET /data1.js
app.get('/data1.js', function(req, res){
client.query("DROP TABLE IF EXISTS info");
client.query("CREATE TABLE info(id INT PRIMARY KEY, data VARCHAR(20))");
client.query("INSERT INTO info VALUES(1, '#OPENSHIFT_1#')");
//client.end();
res.send('Please visit /show.js to see the data', {'Content-Type': 'text/plain'});
});
// Handler for GET /data2.js
app.get('/data2.js', function(req, res){
client.query("DROP TABLE IF EXISTS info");
client.query("CREATE TABLE info(id INT PRIMARY KEY, data VARCHAR(20))");
client.query("INSERT INTO info VALUES(1, '#OPENSHIFT_2#')");
//client.end();
res.send('Please visit /show.js to see the data', {'Content-Type': 'text/plain'});
});
// Handler for GET /show.js
app.get('/show.js', function(req, res){
client.query(
'SELECT data FROM info',
function selectCb(err, results, fields) {
if (err) {
res.send('Failed to get data from database', {'Content-Type': 'text/plain'});
throw err;
}
else {
res.send(results[0]['data'], {'Content-Type': 'text/plain'});
}
}
);
//client.end();
});
// Get the environment variables we need.
var ipaddr = process.env.OPENSHIFT_INTERNAL_IP;
var port = process.env.OPENSHIFT_INTERNAL_PORT || 8080;
if (typeof ipaddr === "undefined") {
console.warn('No OPENSHIFT_INTERNAL_IP environment variable');
}
// terminator === the termination handler.
function terminator(sig) {
if (typeof sig === "string") {
console.log('%%s: Received %%s - terminating Node server ...',
Date(Date.now()), sig);
process.exit(1);
}
console.log('%%s: Node server stopped.', Date(Date.now()) );
}
// Process on exit and signals.
process.on('exit', function() { terminator(); });
#.........这里部分代码省略.........
示例7: test_method
# 需要导入模块: import OSConf [as 别名]
# 或者: from OSConf import get_apps [as 别名]
def test_method(self):
# This step is needed to create builder machines
if self.get_run_mode() == "DEV":
common.add_gearsize_capability('medium')
#
# Step 1
#
self.info("1. create jenkins server app")
ret_code = common.create_app("jenkins",
common.app_types["jenkins"],
clone_repo = False)
self.assert_equal(ret_code, 0, "Jenkis app must be created successfully")
#
# Step 2
#
self.info("2. go to jenkins config page check the builder size")
app_cache = OSConf.get_apps()
self.jenkins_url = app_cache['jenkins']['url']
self.jenkins_username = app_cache['jenkins']['username']
self.jenkins_password = app_cache['jenkins']['password']
sleep(120)
jenkins_config_output = self.get_jenkins_page("configure")
# Waiting for Jenkins to stand up
str2find='<select name="defaultBuilderSize"><option selected="true" value="small">Small</option><option value="medium">Medium</option></select>'
self.assert_true(
jenkins_config_output.find(str2find) != -1,
"Drop-down list 'Default Builder Size' must contain options 'Small' and 'Medium' (small as default)")
#
# Step 3
#
self.info("3. create a small gear size app with jenkins enabled")
ret_code = common.create_app(self.app_name_small, common.app_types["php"])
self.assert_equal(ret_code, 0, "App must be created successfully")
ret_code = common.embed(self.app_name_small,
"add-" + common.cartridge_types["jenkins"])
self.assert_equal(ret_code, 0, "Jenkins client must be embed successfully")
#
# Step 4
#
self.info('4.go to jenkins console and check the application builder size in configure job page')
jenkins_config_output = self.get_jenkins_page("job/%s-build/configure" % self.app_name_small)
str2find='<select name="builderSize"><option selected="true" value="small">Small</option>'
self.assert_true(
jenkins_config_output.find(str2find) != -1,
"Drop-down list 'Default Builder Size' must contain options 'Small' and 'Medium'"
)
#'<select name="builderSize"><option selected="true" value="small">Small </option><option value="medium">Medium</option></select>'
#
# Step 5
#
self.info("5.do some change and push the changes")
self.assert_true(
self.deploy_new_file("./" + self.app_name_small).find("SUCCESS") != -1,
"Deployment must be successful"
)
#
# Step 6
#
if self.get_run_mode() == "DEV":
self.info("6.create a medium gear size app with jenkins enabled")
common.change_node_profile("medium")
ret_code = common.create_app(self.app_name_medium,
common.app_types["jbossas"],
gear_size = "medium")
self.assert_equal(ret_code, 0, "App must be created successfully")
ret_code = common.embed(self.app_name_medium,
"add-" + common.cartridge_types["jenkins"])
self.assert_equal(ret_code, 0, "Jenkins client must be embed successfully")
#
# Step 7
#
self.info("7. go to jenkins console and check the application builder size in configure job page ")
jenkins_config_output = self.get_jenkins_page("job/%s-build/configure" % self.app_name_medium)
str2find='<option selected="true" value="medium">Medium</option>'
self.assert_true(
jenkins_config_output.find(str2find) != -1,
"Drop-down list 'Default Builder Size' doesn't contain 'Medium' as default")
#
# Step 8
#
self.info("8.do some change and push the changes")
self.assert_true(
self.deploy_new_file("./" + self.app_name_medium).find("SUCCESS") != -1,
"Deployment must be successful")
return self.passed(self.summary)