Skip to content

Commit f50b4ff

Browse files
author
afabiani
committed
- Align "tasks.py" with "geonode-project"
1 parent a28c447 commit f50b4ff

File tree

1 file changed

+44
-19
lines changed

1 file changed

+44
-19
lines changed

tasks.py

+44-19
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,21 @@ def prepare(ctx):
214214
client_secret=os.environ['OAUTH2_CLIENT_SECRET'],
215215
oauth_config=oauth_config
216216
), pty=True)
217+
ctx.run(
218+
'sed -i "s|<userAuthorizationUri>.*</userAuthorizationUri>|<userAuthorizationUri>{new_ext_ip}o/authorize/</userAuthorizationUri>|g" {oauth_config}'.format(
219+
new_ext_ip=os.environ['SITEURL'],
220+
oauth_config=oauth_config
221+
), pty=True)
222+
ctx.run(
223+
'sed -i "s|<redirectUri>.*</redirectUri>|<redirectUri>{new_ext_ip}geoserver/index.html</redirectUri>|g" {oauth_config}'.format(
224+
new_ext_ip=os.environ['SITEURL'],
225+
oauth_config=oauth_config
226+
), pty=True)
227+
ctx.run(
228+
'sed -i "s|<logoutUri>.*</logoutUri>|<logoutUri>{new_ext_ip}account/logout/</logoutUri>|g" {oauth_config}'.format(
229+
new_ext_ip=os.environ['SITEURL'],
230+
oauth_config=oauth_config
231+
), pty=True)
217232

218233

219234
@task
@@ -474,13 +489,23 @@ def _prepare_monitoring_fixture():
474489
print("Public Hostname or IP is {0}".format(pub_ip))
475490
pub_port = _geonode_public_port()
476491
print("Public PORT is {0}".format(pub_port))
477-
# d = str(datetime.datetime.now())
492+
geonode_ip = pub_ip
493+
try:
494+
geonode_ip = socket.gethostbyname('geonode')
495+
except Exception:
496+
pass
497+
geoserver_ip = pub_ip
498+
try:
499+
geoserver_ip = socket.gethostbyname('geoserver')
500+
except Exception:
501+
pass
502+
#d = str(datetime.datetime.now())
478503
d = '1970-01-01 00:00:00'
479504
default_fixture = [
480505
{
481506
"fields": {
482507
"active": True,
483-
"ip": "{0}".format(socket.gethostbyname('geonode')),
508+
"ip": "{0}".format(geonode_ip),
484509
"name": "{0}".format(os.environ['MONITORING_HOST_NAME'])
485510
},
486511
"model": "monitoring.host",
@@ -489,7 +514,7 @@ def _prepare_monitoring_fixture():
489514
{
490515
"fields": {
491516
"active": True,
492-
"ip": "{0}".format(socket.gethostbyname('geoserver')),
517+
"ip": "{0}".format(geoserver_ip),
493518
"name": "geoserver"
494519
},
495520
"model": "monitoring.host",
@@ -564,22 +589,22 @@ def _prepare_admin_fixture(admin_password, admin_email):
564589
mdext_date = d.isoformat()[:23] + "Z"
565590
default_fixture = [
566591
{
567-
"fields": {
568-
"date_joined": mdext_date,
569-
"email": admin_email,
570-
"first_name": "",
571-
"groups": [],
572-
"is_active": True,
573-
"is_staff": True,
574-
"is_superuser": True,
575-
"last_login": mdext_date,
576-
"last_name": "",
577-
"password": make_password(admin_password),
578-
"user_permissions": [],
579-
"username": "admin"
580-
},
581-
"model": "people.Profile",
582-
"pk": 1000
592+
"fields": {
593+
"date_joined": mdext_date,
594+
"email": admin_email,
595+
"first_name": "",
596+
"groups": [],
597+
"is_active": True,
598+
"is_staff": True,
599+
"is_superuser": True,
600+
"last_login": mdext_date,
601+
"last_name": "",
602+
"password": make_password(admin_password),
603+
"user_permissions": [],
604+
"username": "admin"
605+
},
606+
"model": "people.Profile",
607+
"pk": 1000
583608
}
584609
]
585610
with open('/tmp/django_admin_docker.json', 'w') as fixturefile:

0 commit comments

Comments
 (0)