lenovo-rbapi 0.0.3 → 0.0.5
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.
- checksums.yaml +4 -4
- data/lib/cnos-rbapi/connect.rb +21 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1d12ecabc5cf8593fe27e5a6c1f2094de61095d
|
4
|
+
data.tar.gz: 8e56e0403e46bff401a0cc2f098da2dc63235453
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d97864eb077aa1a99d797e1707a2ff81c540282cf93a64a76670cf386388ff7d2b67f59c87a99bff17d6e34af972e3cb8624b5bd7a74f2d888c2416cb5b3ca14
|
7
|
+
data.tar.gz: 17954542d882f75366c5a884f6a73045a02de81d2bb5a42ec4e4df7c118bb6f0e9c075f1fb5cec8111ed6fc3b8b1f4e3676d9cf57bef979784b849294e5eb8c5
|
data/lib/cnos-rbapi/connect.rb
CHANGED
@@ -13,6 +13,8 @@
|
|
13
13
|
##
|
14
14
|
require 'rest-client'
|
15
15
|
require 'yaml'
|
16
|
+
require_relative 'rest_utils'
|
17
|
+
require 'json'
|
16
18
|
|
17
19
|
def form_hdr(conn)
|
18
20
|
hdr = {}
|
@@ -41,14 +43,15 @@ class Connect
|
|
41
43
|
# file :config file
|
42
44
|
#
|
43
45
|
# return: Connect object
|
44
|
-
def initialize(
|
45
|
-
params = YAML.load_file(file)
|
46
|
+
def initialize(params)
|
47
|
+
#params = YAML.load_file(file)
|
46
48
|
@transport = params['transport']
|
47
49
|
@port = params['port']
|
48
50
|
@ip = params['ip']
|
49
51
|
@user = params['user']
|
50
52
|
@password = params['password']
|
51
53
|
@cookie = ''
|
54
|
+
#Puppet.notice("transport = #{@ip}")
|
52
55
|
if @transport == 'http'
|
53
56
|
@url = @transport + '://' + @ip + ':' + @port + '/nos/api/login/'
|
54
57
|
end
|
@@ -68,9 +71,25 @@ class Connect
|
|
68
71
|
resp = RestClient::Request.execute(method: :get, url: @url, headers: @hdr, user: @user, password: @password, timeout: 10, :verify_ssl => false)
|
69
72
|
@cookie = resp.cookies['auth_cookie']
|
70
73
|
@hdr['Content-type'] = 'application/json'
|
74
|
+
#Puppet.notice("resp = #{resp}")
|
71
75
|
|
72
76
|
end
|
73
77
|
|
78
|
+
# This API returns the facts asspociated with the URL being supplied.
|
79
|
+
#
|
80
|
+
# parameters:
|
81
|
+
# facts_url - string
|
82
|
+
# any extra arguemnts
|
83
|
+
#
|
84
|
+
# return: facts data - in json format
|
85
|
+
def getFacts(facts_url, args={})
|
86
|
+
#Puppet.notice("URL is = #{facts_url}")
|
87
|
+
url = form_url(self, facts_url)
|
88
|
+
hdr = form_hdr(self)
|
89
|
+
resp = Rest.get(self, url, hdr)
|
90
|
+
#Puppet.notice("Response = #{resp}")
|
91
|
+
return resp.to_json
|
92
|
+
end
|
74
93
|
|
75
94
|
# This API returns Transport protocol for the current node connection.
|
76
95
|
#
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lenovo-rbapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Coleen Quadros
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2018-
|
13
|
+
date: 2018-02-12 00:00:00.000000000 Z
|
14
14
|
dependencies: []
|
15
15
|
description: Lib for REST API's using Ruby
|
16
16
|
email:
|