removing advanced mode -- now all commands may be run, regardless of advanced mode status, new config files will not have advanced mode written to them

This commit is contained in:
Aaron Blankstein
2017-06-29 14:40:40 -04:00
parent cc47aeb3f4
commit 978945866c
3 changed files with 1 additions and 38 deletions

View File

@@ -89,7 +89,7 @@ from rpc import local_api_connect, local_api_status
import rpc as local_rpc
import config
from .config import configure_zonefile, set_advanced_mode, configure, get_utxo_provider_client, get_tx_broadcaster
from .config import configure_zonefile, configure, get_utxo_provider_client, get_tx_broadcaster
from .constants import (
CONFIG_PATH, CONFIG_DIR,
FIRST_BLOCK_MAINNET, NAME_UPDATE,
@@ -833,7 +833,6 @@ def get_server_info(config_path=CONFIG_PATH, get_local_info=False):
result = {}
result['cli_version'] = VERSION
result['advanced_mode'] = conf['advanced_mode']
if 'error' in resp:
result['server_alive'] = False
@@ -2023,22 +2022,6 @@ def cli_get_public_key(args, config_path=CONFIG_PATH, proxy=None):
return {'public_key': zfpubkey}
def cli_set_advanced_mode(args, config_path=CONFIG_PATH):
"""
command: set_advanced_mode
help: Enable advanced commands
arg: status (str) 'On or Off.'
"""
status = str(args.status).lower()
if status not in ['on', 'off']:
return {'error': 'Invalid option; please use "on" or "off"'}
set_advanced_mode((status == 'on'), config_path=config_path)
return {'status': True}
def cli_list_accounts( args, proxy=None, config_path=CONFIG_PATH ):
"""
command: list_accounts advanced

View File

@@ -465,8 +465,6 @@ def run_cli(argv=None, config_path=CONFIG_PATH):
if len(sys.argv) <= 1 or sys.argv[1] != 'setup_wallet':
exit_with_error("Wallet is in legacy format. Please unlock and migrate it with `blockstack setup_wallet`.")
advanced_mode = conf['blockstack-client'].get('advanced_mode', False)
parser = BlockstackArgumentParser(
description='Blockstack cli version {}'.format(config.VERSION)
)
@@ -479,10 +477,6 @@ def run_cli(argv=None, config_path=CONFIG_PATH):
all_methods = parse_methods(all_method_names)
build_method_subparsers(subparsers, all_methods)
if not advanced_mode:
# remove advanced methods
all_methods = filter( lambda m: 'advanced' not in m['pragmas'], all_methods )
# Print default help message, if no argument is given
if len(argv) == 1 or '-h' in argv or '--help' in argv:
parser.print_help()

View File

@@ -609,14 +609,6 @@ def delete_config_section(config_path, section_name):
return True
def set_advanced_mode(status, config_path=CONFIG_PATH):
"""
Enable or disable advanced mode
@status must be a bool
"""
return write_config_field(config_path, 'blockstack-client', 'advanced_mode', str(status))
def get_utxo_provider_client(config_path=CONFIG_PATH, min_confirmations=TX_MIN_CONFIRMATIONS):
"""
Get or instantiate our blockchain UTXO provider's client.
@@ -716,7 +708,6 @@ def read_config_file(config_path=CONFIG_PATH, set_migrate=False):
parser.set('blockstack-client', 'metadata', METADATA_DIRNAME)
parser.set('blockstack-client', 'storage_drivers', BLOCKSTACK_DEFAULT_STORAGE_DRIVERS)
parser.set('blockstack-client', 'storage_drivers_required_write', BLOCKSTACK_REQUIRED_STORAGE_DRIVERS_WRITE)
parser.set('blockstack-client', 'advanced_mode', 'false')
parser.set('blockstack-client', 'api_endpoint_port', str(DEFAULT_API_PORT))
parser.set('blockstack-client', 'api_endpoint_host', DEFAULT_API_HOST)
parser.set('blockstack-client', 'api_endpoint_bind', DEFAULT_API_HOST)
@@ -767,7 +758,6 @@ def read_config_file(config_path=CONFIG_PATH, set_migrate=False):
# these are booleans--convert them
bool_values = {
'blockstack-client': [
'advanced_mode',
'anonymous_statistics',
]
}
@@ -783,10 +773,6 @@ def read_config_file(config_path=CONFIG_PATH, set_migrate=False):
# literal
ret[sec][opt] = parser.get(sec, opt)
# advanced mode is off by default
if 'advanced_mode' not in ret.get('blockstack-client', {}):
ret['blockstack-client']['advanced_mode'] = False
# convert field names
renamed_fields_014_1 = {
'blockstack-client': {