Software Development Kit (SDK) and API Discussions

Python SDK Issue: Couldn't find end of Start Tag netapp

salalonde
4,503 Views

I get the following problem when trying to use the SDK with Python (2.7, 3.3, or 3.4). If I intentionally put bad credentials I get authentication failure, so I think it is getting to the Netapp.

 

python apitest.py -s <myfiler> admin <mypassword> system-get-version

 

OUTPUT:
<results status="failed" errno="13001" reason="Couldn't find end of Start Tag netapp "></results>

 

Any ideas?

2 REPLIES 2

IST
4,271 Views

Had same problem with Perl, turned out that my Linux distribution had some bad characters on the first line of /etc/issue, a dirty quick solution was to delete that first line so I got a hit on a text-string.

 

Problem is in the SDK (Perl in this case, guess it is the same in Python.

 

In NaServer.pm:

 

sub get_platform_info .....

 

if ($osType eq 'linux') {
if (-e "/etc/SuSE-release") {
chomp($osName = `head -n 1 /etc/SuSE-release`);
} else {
choIn mp($osName = `head -n 1 /etc/issue`);
}
if ($osName =~ m/(.*?) \(.*?\)/) {
$osName = $1;
}
chomp($processor = `uname -p`);
$osInfo = $osName . " " . $processor;
}

 

As you see, it does a head -n 1 /etc/issue.

 

Of course, you might have a completly diffrent problem, but it is worth looking into.

 

You can add set_debug_style("NA_PRINT_DONT_PARSE") (don't know the Python syntax here, but should be similar) to your code and get some verbose debug.

 

salalonde
4,268 Views

Thanks!!!

 

Your reply got me pointed in the right direction and I managed to find a workaround. My employer has a large security blurb in /etc/issue and I guess the API doesn't like it. Rather than changing /etc/issue, I updated the code a bit so it would be able to find my OS. For the benefit of anyone else who finds this, in NaServer.py I changed:

 

if os.path.isfile("/etc/SuSE-release"):

    pipe = os.popen('head -n 1 /etc/SuSE-release')

else:

    pipe = os.popen("head -n 1 /etc/issue")

 

 

to:

 

if os.path.isfile("/etc/SuSE-release"):

    pipe = os.popen('head -n 1 /etc/SuSE-release')

elif os.path.isfile("/etc/redhat-release"):

    pipe = os.popen('head -n 1 /etc/redhat-release')

else:

    pipe = os.popen("head -n 1 /etc/issue")

 

 

Thanks again. This has been driving me crazy for a long time.

Public