@takodotid/circuit 0.18.3 → 0.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli/index.js CHANGED
@@ -792,7 +792,8 @@ async function apply(device, _network, plan) {
792
792
  for (const step of plan.steps) {
793
793
  for (const line of step.send) {
794
794
  let answer = await send(channel, substitute(line), 20000, 2000);
795
- if (/[[(]y\/n[\])]|input 'y'/i.test(answer) || CONFIRM.test(line))
795
+ const asks = /[[(]y\/n[\])]|input 'y'/i.test(answer) || CONFIRM.test(line) && !/set successfully/i.test(answer);
796
+ if (asks)
796
797
  answer += await send(channel, "y", 1e4, 1000);
797
798
  if (REFUSED.test(answer))
798
799
  throw new Error(`${step.title}: ${line}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@takodotid/circuit",
3
- "version": "0.18.3",
3
+ "version": "0.18.4",
4
4
  "description": "Declarative, vendor-neutral network configuration: describe each device in TypeScript, and Circuit makes the device match. Alpha.",
5
5
  "keywords": [
6
6
  "network",
@@ -7,7 +7,7 @@ Behaviour that looks like something else. Each one has been hit on a RAX721 runn
7
7
  - `show running-config` stops about halfway with no error unless `terminal page-break disable` is sent first and the read waits several seconds of silence.
8
8
  - A `?` sent by a script is executed. Once it applied an address with a /8 mask.
9
9
  - An access-list cannot change while any service holds it: `ACL 1000 is in use`. Every holder is released first and bound again after. `no ssh2 access-list` needs the list number.
10
- - `portswitch`, `switchport trunk allowed vlan` and `switchport mode` ask for `y` and do nothing without it.
10
+ - `portswitch`, `switchport trunk allowed vlan` and `switchport mode` ask for `y` and do nothing without it, except when they need no confirming: `switchport mode trunk` on a port leaving access mode answers `Set successfully` at once, and a `y` sent after it is refused, `Error input`.
11
11
  - A VLAN is removed with `no vlan <id>`, not `no create vlan`.
12
12
  - The factory account `raisecom` cannot be removed and its service type cannot change. Only its password is ours.
13
13
  - Factory SNMP communities survive hardening, and `private` can write. The render removes both.
@@ -479,7 +479,9 @@ export async function apply(device: Device, _network: readonly Device[], plan: P
479
479
  for (const step of plan.steps) {
480
480
  for (const line of step.send) {
481
481
  let answer = await send(channel, substitute(line), 20_000, 2000);
482
- if (/[[(]y\/n[\])]|input 'y'/i.test(answer) || CONFIRM.test(line)) answer += await send(channel, "y", 10_000, 1000);
482
+ // A confirming line asks for `y` unless the change needs no confirming, when the device sets it at once.
483
+ const asks = /[[(]y\/n[\])]|input 'y'/i.test(answer) || (CONFIRM.test(line) && !/set successfully/i.test(answer));
484
+ if (asks) answer += await send(channel, "y", 10_000, 1000);
483
485
  if (REFUSED.test(answer)) throw new Error(`${step.title}: ${line}\n device said: ${answer.trim().slice(0, 300)}`);
484
486
 
485
487
  const release = RELEASE.exec(line);