Пример #1
0
def test_api_url_443(device, device_host, app_domain):

    response = device.login().get(
        'https://{0}/rest/access/access'.format(device_host), verify=False)
    assert response.status_code == 200

    response = device.login().get(
        'https://{0}/rest/access/set_access'.format(device_host),
        verify=False,
        params={
            'upnp_enabled': 'false',
            'external_access': 'false',
            'public_ip': 0,
            'certificate_port': 443,
            'access_port': 443
        })
    assert '"success": true' in response.text
    assert response.status_code == 200

    response = device.login().get(
        'https://{0}/rest/access/access'.format(device_host), verify=False)
    assert response.status_code == 200
    url = get_app_url('platform')

    assert app_domain in url, url
    assert 'https' in url, url
Пример #2
0
    def configure(self):
        self.prepare_storage()
        install_file = join(self.app_data_dir, 'installed')
        if not isfile(install_file):
            self.execute_sql('CREATE DATABASE {0};'.format(DB_NAME))
            self.execute_sql(
                'GRANT ALL PRIVILEGES ON {0}.* TO "{1}"@"localhost" IDENTIFIED BY "{2}";'
                .format(DB_NAME, DB_USER, DB_PASSWORD))
            self.execute_sql('FLUSH PRIVILEGES;')

            app_url = urls.get_app_url(APP_NAME)
            app_domain = urls.get_app_domain_name(APP_NAME)

            self._wp_cli(
                'core install --url={0} --title=Syncloud --admin_user=installer [email protected] --skip-email'
                .format(app_domain))
            self._wp_cli('plugin activate ldap-login-for-intranet-sites')
            self._wp_cli('user delete installer --yes')
            self._wp_cli("option update mo_ldap_local_register_user 1")
            self._wp_cli(
                "option update mo_ldap_local_mapping_memberof_attribute memberOf"
            )
            self._wp_cli("option update mo_ldap_local_new_registration true")
            self._wp_cli("option update mo_ldap_local_enable_admin_wp_login 1")
            self._wp_cli("option update mo_ldap_local_anonymous_bind 0")
            self._wp_cli(
                "option update mo_ldap_local_server_url ldap://localhost")
            self._wp_cli(
                "option update mo_ldap_local_server_dn dc=syncloud,dc=org")
            self._wp_cli(
                "option update mo_ldap_local_server_password syncloud")
            self._wp_cli(
                "option update mo_ldap_local_search_filter '(&(objectClass=*)(cn=?))'"
            )
            self._wp_cli(
                "option update mo_ldap_local_search_base ou=users,dc=syncloud,dc=org"
            )
            self._wp_cli("option update mo_ldap_local_enable_role_mapping 1")
            self._wp_cli("option update mo_ldap_local_enable_login 1")
            self._wp_cli("option update mo_ldap_local_server_url_status VALID")
            self._wp_cli(
                "option update mo_ldap_local_service_account_status VALID")
            self._wp_cli(
                "option update mo_ldap_local_user_mapping_status VALID")
            self._wp_cli(
                "option update mo_ldap_local_mapping_value_default administrator"
            )
            self.on_domain_change()

            fs.touchfile(install_file)

        else:
            self._wp_cli("core update-db")
Пример #3
0
 def __init__(self):
     self.log = logger.get_logger('mail_installer')
     self.app_dir = paths.get_app_dir(APP_NAME)
     self.app_data_dir = paths.get_data_dir(APP_NAME)
     self.app_url = urls.get_app_url(APP_NAME)
     self.app_domain_name = urls.get_app_domain_name(APP_NAME)
     self.platform_data_dir = paths.get_data_dir('platform')
     self.device_domain_name = urls.get_device_domain_name()
     
     self.database_path = '{0}/database'.format(self.app_data_dir)
     self.config_path = join(self.app_data_dir, 'config')
     self.config = Config(self.config_path)
     self.user_config = UserConfig(self.app_data_dir)
Пример #4
0
    def __init__(self):
        if not logger.factory_instance:
            logger.init(logging.DEBUG, True)

        self.log = logger.get_logger('rocketchat')
        self.snap_dir = '/snap/rocketchat/current'
        self.data_dir = '/var/snap/rocketchat/current'
        self.common_dir = '/var/snap/rocketchat/common'
        self.app_url = urls.get_app_url(APP_NAME)
        self.install_file = join(self.common_dir, 'installed')
        self.database_dump = join(self.data_dir, 'database.dump.gzip')
        self.rocketchat_env_file_source = join(self.snap_dir, 'config', 'rocketchat.env')
        self.rocketchat_env_file_target = join(self.data_dir, 'config', 'rocketchat.env')
        self.version_new_file = join(self.snap_dir, 'nodejs', 'rocketchat.version')
        self.version_old_file = join(self.data_dir, 'rocketchat.version')
Пример #5
0
    def __init__(self):
        self.log = logger.get_logger('diaspora')

        self.app_dir = paths.get_app_dir(APP_NAME)
        self.app_data_dir = paths.get_data_dir(APP_NAME)
        self.app_url = urls.get_app_url(APP_NAME)
        self.app_domain_name = urls.get_app_domain_name(APP_NAME)
        self.platform_app_dir = paths.get_app_dir('platform')
        self.platform_data_dir = paths.get_data_dir('platform')
        self.device_domain_name = urls.get_device_domain_name()
        self.rails_env = 'production'
        self.gem_home = '{0}/ruby'.format(self.app_dir)
        self.path = '{0}/ruby/bin:{0}/nodejs/bin:{0}/ImageMagick/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'.format(
            self.app_dir)
        self.ld_library_path = '{0}/ruby/lib:{0}/ImageMagick/lib:{0}/postgresql/lib'.format(
            self.app_dir)
        self.rake_db_cmd = '{0}/bin/update_db'.format(self.app_dir)
        self.diaspora_dir = '{0}/diaspora'.format(self.app_dir)
        self.psql_bin = '{0}/postgresql/bin/psql'.format(self.app_dir)
        self.diaspora_config = '{0}/config/diaspora/diaspora.yml'.format(
            self.app_data_dir)
        self.database_path = '{0}/database'.format(self.app_data_dir)
        self.database_socket = '{0}/.s.PGSQL.{1}'.format(
            self.database_path, PSQL_PORT)
        self.database_path_escaped = self.database_path.replace("/", "%2F")
        self.database_url = "postgresql://*****:*****@{0}:{1}/diaspora?encoding=unicode".format(
            self.database_path_escaped, PSQL_PORT)
        self.diaspora_gemfile = '{0}/Gemfile'.format(self.diaspora_dir)

        environ['RAILS_ENV'] = self.rails_env
        environ['DB'] = DB_TYPE
        environ['GEM_HOME'] = self.gem_home
        environ['PATH'] = self.path
        environ['LD_LIBRARY_PATH'] = self.ld_library_path
        environ['DIASPORA_CONFIG_DIR'] = '{0}/config/diaspora'.format(
            self.app_data_dir)
        environ['DATABASE_URL'] = self.database_url
        environ['BUNDLE_GEMFILE'] = self.diaspora_gemfile
Пример #6
0
def test_api_url(app_domain):
    response = get_app_url('platform')
    assert app_domain in response, response
import sys
from syncloudlib.application.urls import get_app_url

print get_app_url(sys.argv[1])
Пример #8
0
import sys
from syncloudlib.application.urls import get_app_url

print(get_app_url(sys.argv[1]))
Пример #9
0
    def on_domain_change(self):
        app_url = urls.get_app_url(APP_NAME)
        app_domain = urls.get_app_domain_name(APP_NAME)

        self._wp_cli("option update siteurl '{0}'".format(app_url))
        self._wp_cli("option update home '{0}'".format(app_url))