msticpy/config/compound_ctrls.py
def _set_kv_secret(self, btn):
        """Try to store the current value to key vault."""
        del btn
        if not self.setting_path:
            self.set_status("No setting path to create KV secret name.")
            return
        sec_value = None
        if self.rb_store_type.value == STORE_TEXT:
            sec_value = self.txt_val.value
        elif self.rb_store_type.value == STORE_ENV_VAR:
            sec_value = os.environ.get(self.txt_val.value.strip())
        else:
            return
        if not sec_value:
            self.set_status("No secret value to store.")
            return
        kv_client = self.kv_client
        if _KEYVAULT:
            result, status, kv_client = _set_kv_secret_value(
                setting_path=self.setting_path,
                item_name=self.name,
                value=sec_value,
                kv_client=kv_client,
            )
        else:
            self.set_status("Azure keyvault support is not installed.")
            return
        if result:
            self.set_status(status)
            self.kv_client = kv_client
            self.rb_store_type.value = STORE_KEYVAULT
            self.txt_val.value = ""
            self.cb_kv_def.value = True
        else:
            self.set_status("Error saving secret: status")
Try to store the current value to key vault.
Try to store the current value to key vault.
Try to store the current value to key vault .
def _set_kv_secret(self, btn):
        del btn
        if not self.setting_path:
            self.set_status("No setting path to create KV secret name.")
            return
        sec_value = None
        if self.rb_store_type.value == STORE_TEXT:
            sec_value = self.txt_val.value
        elif self.rb_store_type.value == STORE_ENV_VAR:
            sec_value = os.environ.get(self.txt_val.value.strip())
        else:
            return
        if not sec_value:
            self.set_status("No secret value to store.")
            return
        kv_client = self.kv_client
        if _KEYVAULT:
            result, status, kv_client = _set_kv_secret_value(
                setting_path=self.setting_path,
                item_name=self.name,
                value=sec_value,
                kv_client=kv_client,
            )
        else:
            self.set_status("Azure keyvault support is not installed.")
            return
        if result:
            self.set_status(status)
            self.kv_client = kv_client
            self.rb_store_type.value = STORE_KEYVAULT
            self.txt_val.value = ""
            self.cb_kv_def.value = True
        else:
            self.set_status("Error saving secret: status")
def _set_kv_secret ( self , btn ) : del btn if not self . setting_path : self . set_status ( "No setting path to create KV secret name." ) return sec_value = None if self . rb_store_type . value == STORE_TEXT : sec_value = self . txt_val . value elif self . rb_store_type . value == STORE_ENV_VAR : sec_value = os . environ . get ( self . txt_val . value . strip ( ) ) else : return if not sec_value : self . set_status ( "No secret value to store." ) return kv_client = self . kv_client if _KEYVAULT : result , status , kv_client = _set_kv_secret_value ( setting_path = self . setting_path , item_name = self . name , value = sec_value , kv_client = kv_client , ) else : self . set_status ( "Azure keyvault support is not installed." ) return if result : self . set_status ( status ) self . kv_client = kv_client self . rb_store_type . value = STORE_KEYVAULT self . txt_val . value = "" self . cb_kv_def . value = True else : self . set_status ( "Error saving secret: status" )
Try to store the current value to key vault.
Try to store the current value to key vault .
"""Try to store the current value to key vault."""
self
btn