def create_portal_site(): r = pcurl.get('https://' + fqdn + ':7443/arcgis/portaladmin/createNewSite?f=json') payload = { 'username': username, 'password': passwd, 'fullname': username, 'email': '*****@*****.**', 'securityQuestionIdx': 1, 'securityQuestionAns': '222', 'contentStore': json.dumps({ 'type': 'fileStore', 'provider': 'FileSystem', 'connectionString': r['contentDirPath'] }), 'f': 'json' } print u'---------------------------------------------------------------------------------------------' print u' 开始创建Portal站点' print u'---------------------------------------------------------------------------------------------' result = pcurl.post( 'https://' + fqdn + ':7443/arcgis/portaladmin/createNewSite', payload) print u'---------------------------------------------------------------------------------------------' print u' Portal站点创建完成' print u'---------------------------------------------------------------------------------------------' print json.dumps(result)
def unfederate(tt): result = pcurl.get( 'https://' + fqdn + ':7443/arcgis/portaladmin/federation/servers?f=json&token=' + tt) print result for server in result['servers']: print u'---------------------------------------------------------------------------------------------' print u' 取消Server联合', server['id'] print u'---------------------------------------------------------------------------------------------' payload = {'token': tt, 'f': 'json'} r = pcurl.post( 'https://' + fqdn + ':7443/arcgis/portaladmin/federation/servers/' + server['id'] + '/unfederate', payload) print json.dumps(r)
def create_server_site(): r = pcurl.get('https://' + fqdn + ':6443/arcgis/admin/createNewSite?f=json') payload = { 'username': username, 'password': passwd, 'configStoreConnection': json.dumps(r['configStoreConnection']), 'directories': json.dumps(r['directories']), 'f': 'json' } print u'---------------------------------------------------------------------------------------------' print u' 开始创建Server站点' print u'---------------------------------------------------------------------------------------------' result = pcurl.post('https://' + fqdn + ':6443/arcgis/admin/createNewSite', payload) print u'---------------------------------------------------------------------------------------------' print u' 开始创建Server站点' print u'---------------------------------------------------------------------------------------------' print json.dumps(result)
def config_server_remove_hosting(tt): result = pcurl.get( 'https://' + fqdn + ':7443/arcgis/portaladmin/federation/servers?f=json&token=' + tt) print result for server in result['servers']: if server['isHosted']: print u'---------------------------------------------------------------------------------------------' print u' 取消Server的托管', server['id'] print u'---------------------------------------------------------------------------------------------' payload = { 'serverRole': 'FEDERATED_SERVER', 'token': tt, 'f': 'json' } r = pcurl.post( 'https://' + fqdn + ':7443/arcgis/portaladmin/federation/servers/' + server['id'] + '/update', payload) print json.dumps(r)
def config_hosting_server(tt): result = pcurl.get( 'https://' + fqdn + ':7443/arcgis/portaladmin/federation/servers?f=json&token=' + tt) print result for server in result['servers']: if not server['isHosted']: print u'---------------------------------------------------------------------------------------------' print u' 开始配置Server为托管服务器', server['id'] print u'---------------------------------------------------------------------------------------------' payload = { 'serverRole': 'HOSTING_SERVER', 'token': tt, 'f': 'json' } r = pcurl.post( 'https://' + fqdn + ':7443/arcgis/portaladmin/federation/servers/' + server['id'] + '/update', payload) print json.dumps(r)
'7199', '7654' ]) elif majorversion == '16': openports_ubuntu([ '1098', '4000-4004', '6006', '6080', '6099', '6443', '2443', '9876', '29080', '29081', '9220', '9320', '7080', '7443', '7005', '7099', '7199', '7654' ]) print u'---------------------------------------------------------------------------------------------' print u' 修改limits文件' print u'---------------------------------------------------------------------------------------------' insert_records([agsuser], '/etc/security/limits.conf', [ agsuser + ' soft nofile 65535', agsuser + ' hard nofile 65535', agsuser + ' soft nproc 25059', agsuser + ' hard nproc 25059' ]) print u'---------------------------------------------------------------------------------------------' print u' 修改/etc/sysctl.conf文件' print u'---------------------------------------------------------------------------------------------' insert_records(['max_map_count', 'swappiness'], '/etc/sysctl.conf', ['vm.max_map_count = 262144', 'vm.swappiness = 1']) os.system('sysctl -p') print u'---------------------------------------------------------------------------------------------' print u' 设置系统时间' print u'---------------------------------------------------------------------------------------------' r = pcurl.get( 'http://www.worldtimeserver.com/handlers/GetData.ashx?action=GCTData') os.system('date +%D -s ' + r['ThisTime'][0:10]) os.system('date +%T -s ' + r['DateTime_24HR'])