if not m_pub_exists:
                    # the minion has not received any masters pubkey yet, write
                    # the newly received pubkey to minion_master.pub
                    with salt.utils.files.fopen(m_pub_fn, 'wb+') as fp_:
                        fp_.write(salt.utils.stringutils.to_bytes(payload['pub_key']))