Skip to content

Sample was failing if wsdl file location is passed as ../samples/vsph… #18

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions samples/vsphere/sso/external_psc_sso_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ def options(self):
self.args = self.argparser.parse_args()

def setup(self):
self.lswsdl = self.args.lswsdl
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about following?
self.lswsdl = self.args.lswsdl
if self.lswsdl:
self.lswsdl = os.path.abspath(self.lswsdl)
else:
self.lswsdl = os.path.join(
os.path.dirname(os.path.abspath(file)),

Copy link
Contributor Author

@pgbidkar pgbidkar Apr 14, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree.. Second IF condition was to check if lswsdl is None always. I think else is more effective.
But since lswsdl is instance variable, skipping self.lswsdl = self.args.lswsdl, adding check on arg passed

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @pgbidkar Looks good. You can remove the () on if. Also please squash the commits.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Tianhao. Done the changes, squashed all commits and rebased.

Please let me know if more changes required

if not self.lswsdl:
if self.args.lswsdl:
self.lswsdl = os.path.abspath(self.args.lswsdl)
else:
self.lswsdl = os.path.join(
os.path.dirname(os.path.abspath(__file__)),
'wsdl',
Expand Down Expand Up @@ -113,7 +114,6 @@ def run(self):

# Convert wsdl path to url
self.lswsdl = parse.urljoin('file:', request.pathname2url(self.lswsdl))

lookupservicehelper = LookupServiceHelper(wsdl_url=self.lswsdl,
soap_url=self.lsurl,
skip_verification=self.skip_verification)
Expand Down