???????????????????????????? ??????????????/????????????????? ............/............... .........................../... ????????????????????????????? >>>>>>>>>>>>>/>>>>>>>>>>>>>>>>> ÿØÿà JFIF    ÿÛ „  ( %!1!%)+//.383,7(-.+  -%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ     ÿÄ J    ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ   ÿÄ *  !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú "SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5 ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e ríV ?> ......................................... ............................................................................. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>/>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ???????????????????????????? ??????????????/????????????????? ............/............... .........................../... ????????????????????????????? >>>>>>>>>>>>>/>>>>>>>>>>>>>>>>> ÿØÿà JFIF    ÿÛ „  ( %!1!%)+//.383,7(-.+  -%%-////---/-.+/--+------/------/--0+--/-/-----.-----ÿÀ  ¥2" ÿÄ     ÿÄ J    ! 1AQ"aq2‘#BR‚¡ÁÑ3br’¢±Âð$CSƒ²á4c“%DsÓñÿÄ   ÿÄ *  !1AQa‘"2q3±ð#b¡ÿÚ   ? ¼QxJQaÍuò¸Zö Úü8,ÐÚú "SSn<rçù–´âE—^ªBÖ9À\†¸ÔÁT­ÃÛ5 ëd´³Í#Ý;Þ38œî ¶H£M:wÎ3…³…âpÔF&‚FK¸9„â4àGEõªfÿ ‘ñ(ßw­pŽF|È¥ù®häðÍѶ¹‘[ÒinÙW¶ùñY˜Q{›K"išÒ[Ú8žë\F¹@-?v"ÔU”,ìöžkÿ {I‡£šÍ?e ríV ?> ......................................... ............................................................................. <<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>/>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< >>>>>>>>>>>>>>>>>>>>>>>>>>>>>> """ Novell ASAM Runner ================== .. versionadded:: 2015.8.0 Runner to interact with Novell ASAM Fan-Out Driver :codeauthor: Nitin Madhok To use this runner, set up the Novell Fan-Out Driver URL, username and password in the master configuration at ``/etc/salt/master`` or ``/etc/salt/master.d/asam.conf``: .. code-block:: yaml asam: prov1.domain.com username: "testuser" password: "verybadpass" verify_ssl: true prov2.domain.com username: "testuser" password: "verybadpass" verify_ssl: true .. note:: Optionally, ``protocol`` and ``port`` can be specified if the Fan-Out Driver server is not using the defaults. Default is ``protocol: https`` and ``port: 3451``. """ import logging HAS_LIBS = False try: import html.parser import requests HAS_LIBS = True # pylint: disable=abstract-method class ASAMHTMLParser(html.parser.HTMLParser): # fix issue #30477 def __init__(self): html.parser.HTMLParser.__init__(self) self.data = [] def handle_starttag(self, tag, attrs): if tag != "a": return for attr in attrs: if attr[0] != "href": return self.data.append(attr[1]) # pylint: enable=abstract-method except ImportError: pass log = logging.getLogger(__name__) def __virtual__(): """ Check for ASAM Fan-Out driver configuration in master config file or directory and load runner only if it is specified """ if not HAS_LIBS: return False if _get_asam_configuration() is False: return False return True def _get_asam_configuration(driver_url=""): """ Return the configuration read from the master configuration file or directory """ asam_config = __opts__["asam"] if "asam" in __opts__ else None if asam_config: try: for asam_server, service_config in asam_config.items(): username = service_config.get("username", None) password = service_config.get("password", None) protocol = service_config.get("protocol", "https") port = service_config.get("port", 3451) verify_ssl = service_config.get("verify_ssl") if verify_ssl is None: verify_ssl = True if not username or not password: log.error( "Username or Password has not been specified in the " "master configuration for %s", asam_server, ) return False ret = { "platform_edit_url": "{}://{}:{}/config/PlatformEdit.html".format( protocol, asam_server, port ), "platform_config_url": ( "{}://{}:{}/config/PlatformConfig.html".format( protocol, asam_server, port ) ), "platformset_edit_url": ( "{}://{}:{}/config/PlatformSetEdit.html".format( protocol, asam_server, port ) ), "platformset_config_url": ( "{}://{}:{}/config/PlatformSetConfig.html".format( protocol, asam_server, port ) ), "username": username, "password": password, "verify_ssl": verify_ssl, } if (not driver_url) or (driver_url == asam_server): return ret except Exception as exc: # pylint: disable=broad-except log.error("Exception encountered: %s", exc) return False if driver_url: log.error( "Configuration for %s has not been specified in the master " "configuration", driver_url, ) return False return False def _make_post_request(url, data, auth, verify=True): r = requests.post(url, data=data, auth=auth, verify=verify, timeout=120) if r.status_code != requests.codes.ok: r.raise_for_status() else: return r.text.split("\n") def _parse_html_content(html_content): parser = ASAMHTMLParser() for line in html_content: if line.startswith("