From 6a9c04959032561b93d65b32cf6c5715ccf58e4e Mon Sep 17 00:00:00 2001 From: Antonio Terceiro Date: Thu, 17 Sep 2015 13:28:49 -0300 Subject: [PATCH] colab: retrieve and store noosfero api token --- cookbooks/colab/recipes/default.rb | 4 ++++ cookbooks/colab/templates/noosfero.py.erb | 2 ++ 2 files changed, 6 insertions(+), 0 deletions(-) diff --git a/cookbooks/colab/recipes/default.rb b/cookbooks/colab/recipes/default.rb index 281e6a4..f6e66c1 100644 --- a/cookbooks/colab/recipes/default.rb +++ b/cookbooks/colab/recipes/default.rb @@ -148,6 +148,10 @@ template '/etc/colab/plugins.d/noosfero.py' do group 'colab' mode 0640 notifies :restart, 'service[colab]' + get_private_token = lambda do + `psql --tuples-only --host database --user colab -c "select private_token from users where login = 'admin-noosfero'" noosfero`.strip + end + variables(:get_private_token => get_private_token) end template '/etc/colab/plugins.d/spb.py' do diff --git a/cookbooks/colab/templates/noosfero.py.erb b/cookbooks/colab/templates/noosfero.py.erb index 3c6cd69..1300178 100644 --- a/cookbooks/colab/templates/noosfero.py.erb +++ b/cookbooks/colab/templates/noosfero.py.erb @@ -10,6 +10,8 @@ verbose_name = 'Noosfero Plugin' upstream = 'http://<%= node['peers']['social'] %>:80/social/' +private_token = '<%= @get_private_token.call %>' + urls = { 'include': 'colab_noosfero.urls', 'namespace': 'noosfero', # TODO: do not allow to change namespace -- libgit2 0.21.2