I'd like to pass multiple arguments like so:
@bot test vpn PeerIP: x.x.x.x, optional arguments: Peersubnet y.y.y.y ClCSubnet z.z.z.z
Right now when passing multiple arguments I get the error:
Computer says nooo. See logs for details: test_vpn() missing 2 required positional arguments: 'PeerSubnet' and 'ClcSubnet'
code: Computer says nooo. See logs for details: test_vpn() missing 2 required positional arguments: 'PeerSubnet' and 'ClcSubnet'
I'm a step further, now I'm having issues passing multiple arguments INTO powershell, PS is looking for named parameters.
New code:
@arg_botcmd('--dc', dest='DataCenter', type=str)
@arg_botcmd('--peerIp', dest='PeerPublicIp', type=str)
@arg_botcmd('--peerSubnet', dest='PeerSubnet', type=str)
@arg_botcmd('--ClcSubnet', dest='ClcSubnet', type=str)
def test_vpn(self, args, DataCenter=None, PeerPublicIp=None, PeerSubnet=None, ClcSubnet=None):
output = subprocess.check_output([
"C:\\WINDOWS\\system32\\WindowsPowerShell\\v1.0\\powershell.exe",
". \"C:\\Program Files\\Toolbox\\PowerShell Modules\\Juniper\\./Juniper.psm1\";",
"Test-juniperS2SVPN",
DataCenter,
PeerPublicIp,
PeerSubnet,
ClcSubnet,])
return "```\n{output}\n```".format(output=output.decode("utf-8"))
New error:
Computer says nooo. See logs for details: Command '['C:\WINDOWS\system32\WindowsPowerShell\v1.0\powershell.exe', '. "C:\Program Files\Toolbox\PowerShell Modules\Juniper./Juniper.psm1";', 'Test-juniperS2SVPN', 'il1', '209.15.24.204', '172.16.57.0/24', '10.90.32.12/30']' returned non-zero exit status 1.