Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
endpoint = client_endpoint()
if not endpoint:
raise CLIError('Connection endpoint not found. '
'Before running sfctl commands, connect to a cluster using '
'the "sfctl cluster select" command. '
'If you are seeing this message on Linux after already selecting a cluster, '
'you may need to run the command with sudo.')
no_verify = no_verify_setting()
if security_type() == 'aad':
auth = AdalAuthentication(no_verify)
else:
cert = cert_info()
ca_cert = ca_cert_info()
auth = ClientCertAuthentication(cert, ca_cert, no_verify)
client = ServiceFabricClientAPIs(auth, base_url=endpoint)
# client.config.retry_policy has type msrest.pipeline.ClientRetryPolicy
client.config.retry_policy.total = False
client.config.retry_policy.policy.total = False
# msrest defines ClientRetryPolicy in pipline.py.
# ClientRetryPolicy.__init__ defines values for status_forcelist
# which is passed to urllib3.util.retry.Retry
client.config.retry_policy.policy.status_forcelist = None
return client
import requests
path = _normalize_path(path)
if compressed_location is not None:
compressed_location = _normalize_path(compressed_location)
abspath = validate_app_path(path)
basename = os.path.basename(abspath)
endpoint = client_endpoint()
cert = cert_info()
ca_cert = True
if no_verify_setting():
ca_cert = False
elif ca_cert_info():
ca_cert = ca_cert_info()
if all([no_verify_setting(), ca_cert_info()]):
raise CLIError('Cannot specify both CA cert info and no verify')
if not compress and (keep_compressed or compressed_location is not None):
raise CLIError('--keep-compressed and --compressed-location options are only applicable '
'if the --compress option is set')
compressed_pkg_location = None
created_dir_path = None
if compress:
parent_folder = os.path.dirname(path)
file_or_folder_name = os.path.basename(path)
path = _normalize_path(path)
if compressed_location is not None:
compressed_location = _normalize_path(compressed_location)
abspath = validate_app_path(path)
basename = os.path.basename(abspath)
endpoint = client_endpoint()
cert = cert_info()
ca_cert = True
if no_verify_setting():
ca_cert = False
elif ca_cert_info():
ca_cert = ca_cert_info()
if all([no_verify_setting(), ca_cert_info()]):
raise CLIError('Cannot specify both CA cert info and no verify')
if not compress and (keep_compressed or compressed_location is not None):
raise CLIError('--keep-compressed and --compressed-location options are only applicable '
'if the --compress option is set')
compressed_pkg_location = None
created_dir_path = None
if compress:
parent_folder = os.path.dirname(path)
file_or_folder_name = os.path.basename(path)
compressed_pkg_location = os.path.join(parent_folder, 'sfctl_compressed_temp')