def do(self, args=[]): completed = InstallCommand.do(self,args) if 'check' not in args and 'fix' not in args: MySQLCommand().do(['reset_root_pass']) admin_mail = inputs.get_input_string(t("What is the admin mail?"), CONF_MAP('mail','admin_mail')) smtp_server = inputs.get_input_string(t("What is the smtp server to use?"), CONF_MAP('mail','smtp_server')) CONFIG.mod('mail','admin_mail', admin_mail) CONFIG.mod('mail','smtp_server', smtp_server) CONFIG.save()
def ask_create_mysql(self, mandatory=False): #mysql user name max length = 16 #mysql schema name max length = 64 mysql_user = self.conf.get('mysql','user') mysql_pass = self.conf.get('mysql','pass') mysql_schema = self.conf.get('mysql','schema') mysql_apply = False if mandatory or inputs.get_input_yesno(t("Do you want to create a MySQL user?")): self.ask_mysql_cred() mysql_apply = True prefix = 'mysql_' #username max_length = 16 default = inputs.gen_id(length=(max_length-len(prefix)),prefix=prefix) if mysql_user is None else mysql_user username = "" while len(username) == 0 or len(username) > max_length or \ (mysql.user_exists(username) and not inputs.get_input_yesno(t("The user '%s' exists. Continue?") % username)): username = inputs.get_input_string("What is the username?", default) if len(username) == 0 or len(username) > max_length: print t("The username length must be less than %s") % max_length mysql_user = username #password max_length = 64 default = inputs.gen_password(allowed_chars=inputs.PASS_CHARS_MYSQL) if mysql_pass is None else mysql_pass password = "" while len(password) == 0 or len(password) > max_length: password = inputs.get_input_string("What is the password?", default) if len(password) == 0 or len(password) > max_length: print t("The password length must be less than %s") % max_length mysql_pass = password if inputs.get_input_yesno(t("Do you want to create a MySQL schema?")): self.ask_mysql_cred() mysql_apply = True prefix = 'schema_' max_length = 64 default = inputs.gen_id(prefix=prefix) if mysql_schema is None else mysql_schema schema = "" while len(schema) == 0 or len(schema) > max_length or \ (mysql.schema_exists(schema) and not inputs.get_input_yesno(t("The schema '%s' exists. Continue?") % schema)): schema = inputs.get_input_string("What is the schema name?", default) if len(schema) == 0 or len(schema) > max_length: print t("The schema name length must be less than %s") % max_length mysql_schema = schema self.conf.mod('mysql','user', mysql_user) self.conf.mod('mysql','pass', mysql_pass) self.conf.mod('mysql','schema', mysql_schema) self.conf.mod('mysql','mysql_apply', mysql_apply)
def ask_dev_name(self): site_name = self.conf.get('main','site_name') site_dev_name = self.conf.get('main','site_dev_name') site_dev_name = site_dev_name if site_dev_name else "dev." + site_name q = t("What is the dev name for that site?") site_dev_name = inputs.get_input_string(q, site_dev_name) self.conf.set('main', 'site_dev_name', site_dev_name) return site_dev_name
def do(self, args=[]): completed = InstallCommand.do(self,args) if inputs.get_input_yesno(t("Do you want to configure centrify/ldap now?")): if inputs.get_input_yesno(t("Will this machine use Active Directory?")): domain_name = inputs.get_input_string(t("What is the domain name?"), CONF_MAP('ldap','domain')) domain_controller = inputs.get_input_string(t("What is the address of the domain controller?"), CONF_MAP('ldap','dc')) domain_read_user = inputs.get_input_string(t("What is the ldap reader username?"), CONF_MAP('ldap','ldap_reader')) domain_read_pass = inputs.get_password(t("What is the ldap reader password?"),validate=False) domain_default_ou = inputs.get_input_string(t("What is the ldap default OU for uwsa?"), CONF_MAP('ldap','uwsa_ou')) CONFIG.mod('ldap','enabled', True) CONFIG.mod('ldap','domain', domain_name) CONFIG.mod('ldap','dc', domain_controller) CONFIG.mod('ldap','ldap_reader', domain_read_user) CONFIG.mod('ldap','ldap_reader_pass', domain_read_pass) CONFIG.mod('ldap','uwsa_ou', domain_default_ou) if not CONF_MAP('centrify', 'joined') and inputs.get_input_yesno(t("Do you want to join the Active Directory now?")): domain_admin_user = inputs.get_input_string(t("What is the domain admin username?")) domain_admin_pass = inputs.get_password(t("What is the domain admin password?"),confirm=False, validate=False) cmd_list = [ {'command' : 'adjoin -w --force --user %s --password %s %s' % (domain_admin_user, domain_admin_pass, domain_name), 'anonymous' : 'adjoin -w --force --user %s --password XXXXXXXXXXXXX %s' % (domain_admin_user, domain_name), 'success_code' : [0,8], }, 'service centrifydc start', ] completed, pinfo = core.exec_cmd_list(cmd_list) L.info(pinfo['stdout']) if not completed: raise Exception(t("Error in installation!"), self.NAME) CONFIG.mod('centrify','joined', "True" ) CONFIG.save() return completed
def ask_create_ug(self, prompt, default=None): default = inputs.gen_username() if default is None else default val = inputs.get_input_string(prompt, default) return val
def ask_domain_admin(self): if self.domain_admin_user is None or self.domain_admin_user is None: self.domain_admin_user = inputs.get_input_string(t("What is the domain admin username?")) self.domain_admin_pass = inputs.get_password(t("What is the domain admin password?"), confirm=False, validate=False) ldap.DOMAIN_USER = self.domain_admin_user ldap.DOMAIN_PASS = self.domain_admin_pass
def ask_client_mail(self, old): mail = inputs.get_input_string(t("What is the client email?"),old) return mail
def ask_client_name(self, old): name = inputs.get_input_string(t("What is the client full name?"),old) return name
def ask_site_name(self, site_name): q = t("What is the name of the site?") site_name = inputs.get_input_string(q, site_name) return site_name
def ask_alias_name(self): aliases = self.conf.get('main','site_alias') q = t("What are aliases for that site? (comma separated)") aliases = inputs.get_input_string(q, aliases) return aliases