Skip to content
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

I only get first digit of IP address #6

Open
thug0151 opened this issue Aug 28, 2014 · 4 comments
Open

I only get first digit of IP address #6

thug0151 opened this issue Aug 28, 2014 · 4 comments

Comments

@thug0151
Copy link

Hi, I've followed the tutorial step by step but when I try using the command "Invoke-Junosconfig -ConfigFile config.txt -Devicelist devices.csv" The log says
[08-28-2014 16:53:03] Starting configuration on 1...
[08-28-2014 16:53:03] ERROR: Couldn't establish a connection to 1.
[08-28-2014 16:53:03] Please verify your credentials, and that the device is reachable.

This is how the csv file looks like:
device user password sourceIP
10.1.20.15 root root123 10.1.20.15

Seems like the script only takes the first digit of the row and then obviously cant connect.

Here is output from Power shell when i run the command, I guess divide by zero etc is because there is no connection to calculate for or something.

PS C:\Scripts> Invoke-Junosconfig -ConfigFile config.txt -Devicelist devices.csv
Log file exists. Do you wish to overwrite? [y/n]: y

Starting configuration on a total of devices.
Results will be logged to 'C:\Scripts\junos-config.log'

Attempted to divide by zero.
At C:\windows\system32\windowspowershell\v1.0\Modules\Posh-Junos\Posh-Junos.psm1:131 char:9

  •     $percent = [Math]::Round($current / $totalDevices \* 100)
    
  •     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    • CategoryInfo : NotSpecified: (:) [], RuntimeException
    • FullyQualifiedErrorId : RuntimeException

Write-Progress : Cannot validate argument on parameter 'PercentComplete'. The argument is null, empty, or an element of
the argument collection contains a null value. Supply a collection that does not contain any null values and then try
the command again.
At C:\windows\system32\windowspowershell\v1.0\Modules\Posh-Junos\Posh-Junos.psm1:132 char:139

  • ... ercentComplete $percent
  •                ~~~~~~~~
    
    • CategoryInfo : InvalidData: (:) [Write-Progress], ParameterBindingValidationException
    • FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.PowerShell.Commands.WriteProgressCommand

Configuration complete - 1 configuration errors!
Please check the log file 'C:\Scripts\junos-config.log' to review these errors.
PS C:\Scripts>

scottdware added a commit that referenced this issue Aug 28, 2014
Fixed an issue where the correct device count wasn't being established.
This should work properly, now.
@scottdware
Copy link
Owner

Thanks for bringing this to my attention. I fixed the error message you were getting with this latest commit:

1351db6

Please update when possible.

As for your other issue, I had no problems with just specifying an IP address in the "device" field of my csv file. Are your fields comma-separated? They will need to be if not:

device,user,password,sourceIP
10.1.20.15,root,root123,10.1.20.15

I'll work at specifying other separators as well (feature enhancement) :)

@thug0151
Copy link
Author

Thanks for the fast reply! :)
Found out that excel (2013) format the colums with ; changed it to ,
Now I have the problem with connecting, it says either connection problem or wrong credentials. SSH is working through Putty.

Gets these messeges on the switch from show log messeges. Seems like the program sends a exit directly after its accept password.

Feb 26 09:59:35 sshd[1256]: Accepted password for root from 10.1.20.16 port 62350 ssh2
Feb 26 09:59:35 sshd[1256]: Received disconnect from 10.1.20.16: 11: Connection terminated by the client.
Feb 26 09:59:35 inetd[863]: /usr/sbin/sshd[1256]: exited, status 255

[08-29-2014 8:35:49] Starting configuration on 10.1.20.15...
[08-29-2014 8:36:01] ERROR: Couldn't establish a connection to 10.1.20.15.
[08-29-2014 8:36:01] Please verify your credentials, and that the device is reachable.

2014-08-28 20:22 GMT+02:00 Scott Ware [email protected]:

Thanks for bringing this to my attention. I fixed the error message you
were getting with this latest commit:

1351db6
1351db6

Please update when possible.

As for your other issue, I had no problems with just specifying an IP
address in the "device" field of my csv file. Are your fields
comma-separated? They will need to be if not:

device,user,password,sourceIP
10.1.20.15,root,root123,10.1.20.15

I'll work at specifying other separators as well (feature enhancement) :)


Reply to this email directly or view it on GitHub
#6 (comment).

@scottdware
Copy link
Owner

Hmm, that's odd. I'll dig into it today and see if I can't try to re-create it.

@thug0151
Copy link
Author

Did some debugging writing my own script and it seems like the Invoke-SSHCommand returns the errorcode 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants