def install_config(self): home_folder = join('/home', USER_NAME) linux.useradd(USER_NAME, home_folder=home_folder) storage.init_storage(APP_NAME, USER_NAME) templates_path = join(self.app_dir, 'config') variables = { 'app_dir': self.app_dir, 'common_dir': self.common_dir, 'data_dir': self.data_dir, 'db_psql_port': PSQL_PORT, 'database_dir': self.db.database_dir, 'config_dir': self.config_dir, 'domain': urls.get_app_domain_name(APP_NAME) } gen.generate_files(templates_path, self.config_dir, variables) fs.makepath(self.nextcloud_config_path) fs.makepath(join(self.common_dir, 'log')) fs.makepath(join(self.common_dir, 'nginx')) fs.makepath(self.extra_apps_dir) self.fix_permissions()
def prepare_storage(self): storage.init_storage(APP_NAME, USER_NAME) storage_dir = storage.get_storage_dir(APP_NAME) tmp_dir = join(storage_dir, 'tmp') fs.makepath(tmp_dir) fs.chownpath(tmp_dir, USER_NAME) uploads_dir = join(storage_dir, 'uploads') fs.makepath(uploads_dir) fs.chownpath(uploads_dir, USER_NAME)
def configure(self): self.prepare_storage() app_storage_dir = storage.init_storage(APP_NAME, USER_NAME) if self.installed(): self.upgrade() else: self.initialize(app_storage_dir) self.occ.run('ldap:set-config s01 ldapEmailAttribute mail') self.occ.run( 'config:system:set apps_paths 1 path --value="{0}"'.format( self.extra_apps_dir)) self.occ.run('config:system:set dbhost --value="{0}"'.format( self.db.database_host)) # migrate to systemd cron units self.cron.remove() self.cron.create() self.oc_config.set_value('memcache.local', "'\\OC\\Memcache\\APCu'") self.oc_config.set_value('loglevel', '2') self.oc_config.set_value('logfile', join(self.common_dir, LOG_PATH)) real_app_storage_dir = realpath(app_storage_dir) self.oc_config.set_value('datadirectory', real_app_storage_dir) # oc_config.set_value('integrity.check.disabled', 'true') self.oc_config.set_value('mail_smtpmode', 'smtp') self.oc_config.set_value('mail_smtphost', 'localhost:25') # oc_config.set_value('mail_smtpsecure', '') self.oc_config.set_value('mail_smtpauth', 'false') # oc_config.set_value('mail_smtpname', '') # oc_config.set_value('mail_smtppassword', '') self.on_domain_change() self.fix_permissions()
def _install(self): self.log.info('configure install') password = uuid.uuid4().hex response = requests.post("{0}/users.register".format(REST_URL), json={ "username": "******", "email": "*****@*****.**", "pass": password, "name": "installer"}) result = json.loads(response.text) if not result['success']: self.log.info('response: {0}'.format(response.text.encode("utf-8"))) raise Exception('cannot create install account') self.log.info('install account has been created') response = requests.post("{0}/login".format(REST_URL), json={"username": "******", "password": password}) result = json.loads(response.text) if not result['status'] == 'success': self.log.error(response.text.encode("utf-8")) self.log.info(result['status']) raise Exception('unable to login under install user') auth_token = result['data']['authToken'] user_id = result['data']['userId'] self.log.info('install account token extracted') self.update_setting('LDAP_Enable', True, auth_token, user_id) #v4 self.update_setting('LDAP_Server_Type', '', auth_token, user_id) self.update_setting('LDAP_Host', 'localhost', auth_token, user_id) self.update_setting('LDAP_BaseDN', 'dc=syncloud,dc=org', auth_token, user_id) self.update_setting('LDAP_Authentication', True, auth_token, user_id) self.update_setting('LDAP_Authentication_UserDN', 'dc=syncloud,dc=org', auth_token, user_id) self.update_setting('LDAP_Authentication_Password', 'syncloud', auth_token, user_id) self.update_setting('LDAP_User_Search_Filter', '(objectclass=inetOrgPerson)', auth_token, user_id) self.update_setting('LDAP_User_Search_Field', 'cn', auth_token, user_id) self.update_setting('LDAP_Username_Field', 'cn', auth_token, user_id) self.update_setting('Accounts_RegistrationForm', 'Disabled', auth_token, user_id) #v4 self.update_setting('Accounts_TwoFactorAuthentication_Enabled', False, auth_token, user_id) self.update_setting('Show_Setup_Wizard', 'completed', auth_token, user_id) self.update_setting('FileUpload_Storage_Type', 'FileSystem', auth_token, user_id) app_storage_dir = storage.init_storage(APP_NAME, USER_NAME) self.update_setting('FileUpload_FileSystemPath', app_storage_dir, auth_token, user_id) response = requests.post("{0}/users.delete".format(REST_URL), headers={"X-Auth-Token": auth_token, "X-User-Id": user_id}, json={"userId": user_id}) result = json.loads(response.text) if not result['success']: self.log.error(response.text.encode("utf-8")) raise Exception('unable to delete install user') with open(self.install_file, 'w') as f: f.write('installed\n')
def prepare_storage(self): app_storage_dir = storage.init_storage(APP_NAME, USER_NAME) ocdata = join(app_storage_dir, '.ocdata') fs.touchfile(ocdata) check_output('chown {0}. {1}'.format(USER_NAME, ocdata), shell=True) check_output('chmod 770 {0}'.format(app_storage_dir), shell=True) tmp_storage_path = join(app_storage_dir, 'tmp') fs.makepath(tmp_storage_path) fs.chownpath(tmp_storage_path, USER_NAME) real_app_storage_dir = realpath(app_storage_dir) self.oc_config.set_value('datadirectory', real_app_storage_dir)
def install_config(self): home_folder = join('/home', USER_NAME) linux.useradd(USER_NAME, home_folder=home_folder) fs.makepath(join(self.app_data_dir, 'log')) fs.makepath(join(self.app_data_dir, 'nginx')) fs.makepath(join(self.app_data_dir, 'temp')) storage.init_storage(APP_NAME, USER_NAME) templates_path = join(self.app_dir, 'config.templates') config_path = join(self.app_data_dir, 'config') variables = { 'app': APP_NAME, 'app_dir': self.app_dir, 'app_data_dir': self.app_data_dir } gen.generate_files(templates_path, config_path, variables)
def install(self): home_folder = join('/home', USER_NAME) linux.useradd(USER_NAME, home_folder=home_folder) storage.init_storage(APP_NAME, USER_NAME) templates_path = join(self.app_dir, 'config') config_path = join(self.app_data_dir, 'config') variables = { 'app_dir': self.app_dir, 'app_data_dir': self.app_data_dir, 'syncthing_port': SYNCTHING_PORT } gen.generate_files(templates_path, config_path, variables) fs.makepath(join(self.app_data_dir, 'log')) fs.makepath(join(self.app_data_dir, 'nginx')) fs.chownpath(self.app_data_dir, USER_NAME, recursive=True)
def install_config(self): home_folder = join(self.common_dir, USER_NAME) linux.useradd(USER_NAME, home_folder=home_folder) fs.makepath(join(self.common_dir, 'log')) fs.makepath(join(self.common_dir, 'nginx')) fs.makepath(join(self.snap_data_dir, 'data')) storage.init_storage(APP_NAME, USER_NAME) templates_path = join(self.app_dir, 'config.templates') config_path = join(self.snap_data_dir, 'config') variables = { 'app': APP_NAME, 'app_dir': self.app_dir, 'common_dir': self.common_dir, 'snap_data': self.snap_data_dir } gen.generate_files(templates_path, config_path, variables) fs.chownpath(self.snap_data_dir, USER_NAME, recursive=True) fs.chownpath(self.common_dir, USER_NAME, recursive=True)
def install_config(self): home_folder = join('/home', USER_NAME) linux.useradd(USER_NAME, home_folder=home_folder) fs.makepath(join(self.snap_common, 'log')) fs.makepath(join(self.snap_common, 'nginx')) fs.makepath(join(self.snap_common, 'db')) if os.path.lexists(self.prefix_delegation_link): os.remove(self.prefix_delegation_link) os.symlink(self.prefix_delegation_bin, self.prefix_delegation_link) storage.init_storage(APP_NAME, USER_NAME) templates_path = join(self.app_dir, 'config') variables = { 'app': APP_NAME, 'app_dir': self.app_dir, 'snap_data': self.snap_data, 'snap_common': self.snap_common, 'device_domain_name': self.device_domain_name } gen.generate_files(templates_path, self.config_path, variables)
def prepare_storage(self): self.log.info("prepare_storage") storage.init_storage(APP_NAME, USER_NAME)
def prepare_storage(self): app_storage_dir = storage.init_storage(APP_NAME, USER_NAME)
def current_disk_link(device): link = init_storage('platform', 'root') dir = device.run_ssh("realpath {}".format(link)) return dir
def prepare_storage(self): app_storage_dir = storage.init_storage(APP_NAME, USER_NAME) tmp_storage_path = join(app_storage_dir, 'tmp') fs.makepath(tmp_storage_path) fs.chownpath(tmp_storage_path, USER_NAME)
import sys, os from syncloudlib.application.storage import init_storage print os.path.realpath(init_storage(sys.argv[1], sys.argv[2]))