Skip to content

Commit

Permalink
Merge branch 'master' into accept-json-file
Browse files Browse the repository at this point in the history
  • Loading branch information
Christina-Kang committed May 10, 2018
2 parents 93a749e + e507825 commit 4108b5b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 20 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ python:
git:
depth: 3
install:
- pip install -e ./src
- pip install -r requirements.txt
- pip install --ignore-installed -e ./src
- pip install --ignore-installed -r requirements.txt
before_script:
- python scripts/check_and_use_custom_sdk.py
script:
Expand Down
6 changes: 1 addition & 5 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,4 @@ python-coveralls
nose2
pylint
vcrpy
mock
jsonpickle
adal
msrestazure
contextlib2
mock
11 changes: 5 additions & 6 deletions src/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def read(fname):

setup(
name='sfctl',
version='4.0.0',
version='5.0.0',
description='Azure Service Fabric command line',
long_description=read('README.rst'),
url='https://github.com/Azure/service-fabric-cli',
Expand All @@ -44,19 +44,18 @@ def read(fname):
],
install_requires=[
'knack==0.1.1',
'msrest==0.4.26',
'msrestazure>=0.4.20',
'msrest>=0.4.26',
'msrestazure',
'requests',
'azure-servicefabric==6.1.2.9',
'jsonpickle',
'adal',
'future',
'msrestazure'
'future'
],
extras_require={
'test': [
'coverage',
'nose2>=0.7.4',
'nose2',
'pylint',
'vcrpy',
'mock',
Expand Down
18 changes: 14 additions & 4 deletions src/sfctl/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,18 @@ def __init__(self, cert=None, ca_cert=None, no_verify=False):
self.ca_cert = ca_cert
self.no_verify = no_verify

def signed_session(self):
def signed_session(self, session=None):
"""Create requests session with any required auth headers
applied.
:rtype: requests.Session.
"""
session = super(ClientCertAuthentication, self).signed_session()

if session:
session = super(ClientCertAuthentication, self).signed_session(session)
else:
session = super(ClientCertAuthentication, self).signed_session()

if self.cert is not None:
session.cert = self.cert
if self.ca_cert is not None:
Expand All @@ -40,14 +45,19 @@ class AdalAuthentication(Authentication):
def __init__(self, no_verify=False):
self.no_verify = no_verify

def signed_session(self):
def signed_session(self, session=None):
"""Create requests session with AAD auth headers
:rtype: requests.Session.
"""

from sfctl.config import (aad_metadata, aad_cache)

session = super(AdalAuthentication, self).signed_session()
if session:
session = super(AdalAuthentication, self).signed_session(session)
else:
session = super(AdalAuthentication, self).signed_session()

if self.no_verify:
session.verify = False

Expand Down
2 changes: 1 addition & 1 deletion src/sfctl/custom_app_type.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def provision_application_type(client, #pylint: disable=too-many-locals,invalid-
no_wait,
application_type_build_path=application_type_build_path)

api_version = "6.1"
api_version = "6.2"

# Construct URLs
url = '/ApplicationTypes/$/Provision'
Expand Down
4 changes: 2 additions & 2 deletions src/sfctl/tests/request_generation_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def paths_generation_helper(self): # pylint: disable=too-many-statements
'application provision --application-type-build-path=test_path',
'POST',
'/ApplicationTypes/$/Provision',
['api-version=6.1', 'timeout=60'],
['api-version=6.2', 'timeout=60'],
('{"Kind": "ImageStorePath", '
'"Async": false, '
'"ApplicationTypeBuildPath": "test_path"}'),
Expand All @@ -208,7 +208,7 @@ def paths_generation_helper(self): # pylint: disable=too-many-statements
'--application-type-version=version',
'POST',
'/ApplicationTypes/$/Provision',
['api-version=6.1', 'timeout=60'],
['api-version=6.2', 'timeout=60'],
('{"Kind": "ExternalStore", '
'"Async": false, '
'"ApplicationPackageDownloadUri": "test_path", '
Expand Down

0 comments on commit 4108b5b

Please sign in to comment.