Commit 5d06038fedd00e4384468c82bbd721306124de24

Authored by Luan
1 parent 8e485448

adding fabric function to change solr schema on vagrant user

Showing 1 changed file with 12 additions and 2 deletions   Show diff stats
fabfile.py
1 1  
2   -
3 2 from fabric.operations import put
4 3 from fabric.api import run, sudo, env
5 4 from fabric.contrib.files import exists
6 5 from fabric.decorators import with_settings
7   -from fabric.context_managers import prefix, cd
  6 +from fabric.context_managers import prefix, cd, settings
8 7  
9 8 env.user = 'colab' # key depends on env
10 9 env.use_shell = False
... ... @@ -100,6 +99,17 @@ def rebuild_index(age=None):
100 99  
101 100  
102 101 @with_settings(user='vagrant')
  102 +def build_solr_schema():
  103 + with cd('/vagrant/src/'), prefix(WORKON_COLAB):
  104 + run('python manage.py build_solr_schema -f /tmp/schema.xml')
  105 +
  106 + with settings(user='colab'):
  107 + run('cp /tmp/schema.xml ~/apache-solr-3.6.2/example/solr/conf/schema.xml')
  108 +
  109 + sudo('supervisorctl restart solr')
  110 +
  111 +
  112 +@with_settings(user='vagrant')
103 113 def runserver(update_requirements=False):
104 114 env_created = mkvirtualenv()
105 115  
... ...