def initial_contact( self, enable_ssh=True, time_zone=None, keyboard=None, install_on_server=None, filename=None, as_base64=False, ): """ Allows to save the initial contact for for the specified node :param bool enable_ssh: flag to know if we allow the ssh daemon on the specified node :param str time_zone: optional time zone to set on the specified node :param str keyboard: optional keyboard to set on the specified node :param bool install_on_server: optional flag to know if the generated configuration needs to be installed on SMC Install server (POS is needed) :param str filename: filename to save initial_contact to :param bool as_base64: return the initial config in base 64 format. Useful for cloud based engine deployments as userdata :raises NodeCommandFailed: IOError handling initial configuration data :return: initial contact text information :rtype: str """ result = self.make_request( NodeCommandFailed, method="create", raw_result=True, resource="initial_contact", params={"enable_ssh": enable_ssh}, ) if result.content: if as_base64: result.content = b64encode(result.content) if filename: try: save_to_file(filename, result.content) except IOError as e: raise NodeCommandFailed( "Error occurred when attempting to save initial " "contact to file: {}".format(e)) return result.content
def get(cls, user_dn): """ Get a user or group from a specific LDAP domain or internal user group. When specifying the user DN, specify in fully qualified DN syntax and provide the 'domain=' field specifying the name of the External LDAP domain: `cn=domain users,cn=users,dc=lepages,dc=local,domain=myldapdomain` For example:: InternalUserGroup.get('cn=testgroup,dc=stonegate,domain=InternalDomain') :param str user_dn: user DN to find :rtype: UserElement """ encoded_dn = b64encode(user_dn) element = ElementFactory(href='{}/{}'.format(cls.href, encoded_dn), raise_exc=UserElementNotFound) return element
def initial_contact(self, enable_ssh=True, time_zone=None, keyboard=None, install_on_server=None, filename=None, as_base64=False): """ Allows to save the initial contact for for the specified node :param bool enable_ssh: flag to know if we allow the ssh daemon on the specified node :param str time_zone: optional time zone to set on the specified node :param str keyboard: optional keyboard to set on the specified node :param bool install_on_server: optional flag to know if the generated configuration needs to be installed on SMC Install server (POS is needed) :param str filename: filename to save initial_contact to :param bool as_base64: return the initial config in base 64 format. Useful for cloud based engine deployments as userdata :raises NodeCommandFailed: IOError handling initial configuration data :return: initial contact text information :rtype: str """ result = self.make_request( NodeCommandFailed, method='create', raw_result=True, resource='initial_contact', params={'enable_ssh': enable_ssh}) if result.content: if as_base64: result.content = b64encode(result.content) if filename: try: save_to_file(filename, result.content) except IOError as e: raise NodeCommandFailed( 'Error occurred when attempting to save initial ' 'contact to file: {}'.format(e)) return result.content