enfcli 5.0.1.pre.alpha → 5.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a26e220747da882404adfd00ec62df4826af3bbf42467f567f4ab992e28249e6
4
- data.tar.gz: ea8cf5f236ee37a1edbe252caaf05322d8ff1a8239b715a4248a8e03ab49babf
3
+ metadata.gz: 46d9c54fa175ea6dbbdbda5468a4c0faf70ab6fbd74838ba883a65c8c5ed3ce4
4
+ data.tar.gz: cde1a3fddf4aad273cdc613b6d99c0228acb7791c2209430774adea2efaf03f3
5
5
  SHA512:
6
- metadata.gz: 76514240b4820643191640197a246afe0ec94cae0d0aaf7f1955bc3028dfb8e1dacba6be3c2727f05d9c0e2b29e25dd6ad98ad3e625c89a79196a06700542a42
7
- data.tar.gz: ec351882693e09839fb6583c3c4f48dfc9a26b076efe2d3db958c3d6cde4e86825bb122fed4979ed4521bfb00eeb3978d1f0b28817ca0d2d4bbfe9614c266e3a
6
+ metadata.gz: 232754cd6c7b8ccf9d1dd92206eac0470419ba3a60368c1aadd905eb2dbdb9930c9b2a8796ec802ee53b0e6d0a15e3f5493488ec60391e24d4315e75821bfb28
7
+ data.tar.gz: 677a9b5e6581b2cc636929f8491874dd514a48046900c0a145a152b8b79115daf7103a110f2fea996b97d0642e90e29512482ef58a1e90fb580335ce6ad14380
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- enfcli (5.0.1.pre.alpha)
4
+ enfcli (5.0.4)
5
5
  clipboard
6
6
  ffi
7
7
  readline
@@ -92,4 +92,4 @@ DEPENDENCIES
92
92
  webmock
93
93
 
94
94
  BUNDLED WITH
95
- 2.1.4
95
+ 2.2.4
@@ -26,7 +26,14 @@ module EnfApi
26
26
 
27
27
  def add_firewall_rule(network, rule)
28
28
  rule_json = EnfApi::to_json(rule)
29
- EnfApi::API.instance.post "/api/xfw/v2/#{network}/rule", rule_json
29
+
30
+ if network
31
+ url = "/api/xfw/v2/#{network}/rule"
32
+ else
33
+ url = "/api/xfw/v2/rule"
34
+ end
35
+
36
+ EnfApi::API.instance.post url, rule_json
30
37
  end
31
38
 
32
39
  def delete_firewall_rules(network, id = nil)
data/lib/enfcli.rb CHANGED
@@ -22,6 +22,7 @@ require "ipaddr"
22
22
  require "clipboard"
23
23
  require "json"
24
24
  require "securerandom"
25
+ require "io/console"
25
26
 
26
27
  require "rubygems/commands/update_command"
27
28
  require "rubygems/commands/search_command"
@@ -111,21 +112,9 @@ module EnfCli
111
112
  end
112
113
 
113
114
  def self.ask_password(prompt = nil)
114
- begin
115
- prompt ||= "Enter Password:"
116
- print prompt
117
- # We hide the entered characters before to ask for the password
118
- system "stty -echo"
119
- password = $stdin.gets.chomp
120
- system "stty echo"
121
- puts ""
122
- return password
123
- rescue NoMethodError, Interrupt
124
- # When the process is exited, we display the characters again
125
- # And we exit
126
- system "stty echo"
127
- exit
128
- end
115
+ prompt ||= "Enter Password: "
116
+ password = IO::console.getpass prompt
117
+ return password
129
118
  end
130
119
 
131
120
  def self.generate_ec_cert(key, ipv6)
@@ -371,8 +360,16 @@ module EnfCli
371
360
  Readline.completion_append_character = " "
372
361
  Readline.completion_proc = comp
373
362
 
374
- stty_save = `stty -g`.chomp
375
- trap("INT") { system("stty", stty_save); exit }
363
+ ## Need to check stty only on unix like systems. Ignore on windows
364
+ begin
365
+ stty_save = `stty -g`.chomp
366
+ rescue
367
+ stty_save = nil
368
+ end
369
+ trap("INT") {
370
+ system("stty", stty_save) if stty_save
371
+ exit
372
+ }
376
373
 
377
374
  while input = Readline.readline(EnfCli::CTX.instance.prompt, true)
378
375
  break if input == "exit" or input == '\q' or input == "quit"
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2018 Xaptum,Inc
2
+ # Copyright 2018-2020 Xaptum,Inc
3
3
  #
4
4
  # Licensed under the Apache License, Version 2.0 (the "License");
5
5
  # you may not use this file except in compliance with the License.
@@ -91,7 +91,7 @@ module EnfCli
91
91
  end
92
92
 
93
93
  desc "add-firewall-rule", "Add a firewall rule to a /64 network"
94
- method_option :network, :type => :string, :required => true
94
+ method_option :network, :type => :string
95
95
  method_option :priority, :type => :numeric, :required => true
96
96
  method_option :protocol, :type => :string, :required => true, :enum => ["TCP", "UDP", "ICMP6", "6", "17", "58"]
97
97
  method_option :source_ip, :type => :string
@@ -14,5 +14,5 @@
14
14
  # limitations under the License.
15
15
  #
16
16
  module EnfCli
17
- VERSION = "5.0.1-alpha"
17
+ VERSION = "5.0.4"
18
18
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: enfcli
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.1.pre.alpha
4
+ version: 5.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Venkatakumar Srinivasan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-24 00:00:00.000000000 Z
11
+ date: 2021-02-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -269,9 +269,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
269
269
  version: '0'
270
270
  required_rubygems_version: !ruby/object:Gem::Requirement
271
271
  requirements:
272
- - - ">"
272
+ - - ">="
273
273
  - !ruby/object:Gem::Version
274
- version: 1.3.1
274
+ version: '0'
275
275
  requirements: []
276
276
  rubygems_version: 3.0.3
277
277
  signing_key: