brpm_module_brpm 0.1.24 → 0.1.25
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 +8 -8
- data/config.yml +1 -1
- data/lib/brpm_rest_client.rb +33 -23
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NjY2YzYwMWRkMWUxOTNjYTBiZTVjYjY4YjEwNTAzZDE0NjJmNzdlNA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
NzMzNTMzZjQxY2U0MjNiMWYxODRiYmQ4ZTA1OTJkZWU0YjRmZTMxMg==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YmJlZjI0ZTA3YzZmNjczNWRjNjU4N2VlMzM0ODBmZjczM2YwMzc3ZDcxMDAx
|
10
|
+
NjUwZGUxODJlMjAyYTc1Y2QyZWQ1ZWJlZmIwN2U4ZGIwMmE0YzhiYmQ0YTA0
|
11
|
+
YzhmZDU3YmE5Yzk4ZTk2MjlkZDIwZjZjMDNmZmRlNWZlMjdjN2U=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZTQ5MGI3ZDc3YmJmZWQ1Y2EzOWQ4NzRhOTRmMTVkNTVjNzQ4NDliZjU5NTBh
|
14
|
+
ZmIxZmFlODgwZmM4OTUwODRkNGJjMTZmNGI4NjE5ZDZmMTU3OTJhYTgyYTEx
|
15
|
+
YzgxNDkyZjg5MzljNTJkNzUwMzc2ZTM1ODdjNjdkZGYzM2VlOTQ=
|
data/config.yml
CHANGED
data/lib/brpm_rest_client.rb
CHANGED
@@ -1636,11 +1636,7 @@ class BrpmRestClient
|
|
1636
1636
|
result = brpm_get "v1/scripts?filters[name]=#{name}"
|
1637
1637
|
|
1638
1638
|
if result["status"] == "success"
|
1639
|
-
|
1640
|
-
result_hash = nil
|
1641
|
-
else
|
1642
|
-
result_hash = result["response"].first
|
1643
|
-
end
|
1639
|
+
result_hash = result["response"].first
|
1644
1640
|
else
|
1645
1641
|
if result["code"] == 404
|
1646
1642
|
result_hash = nil
|
@@ -1695,30 +1691,44 @@ class BrpmRestClient
|
|
1695
1691
|
end
|
1696
1692
|
|
1697
1693
|
def create_or_update_script(script)
|
1698
|
-
|
1699
|
-
|
1700
|
-
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
|
1708
|
-
|
1709
|
-
|
1694
|
+
# TODO: the scripts REST API is not finished yet: get_script_by_name always returns "null". So for now we are going to create the script and if it returns an error that the name is already taken we will update it
|
1695
|
+
|
1696
|
+
# BrpmAuto.log "Checking if the corresponding script already exists ..."
|
1697
|
+
# existing_script = get_script_by_name(script["name"])
|
1698
|
+
#
|
1699
|
+
# if existing_script.nil?
|
1700
|
+
# BrpmAuto.log "Script doesn't exist yet."
|
1701
|
+
# script_already_exists=false
|
1702
|
+
# else
|
1703
|
+
# BrpmAuto.log "Script already exists."
|
1704
|
+
# script_already_exists=true
|
1705
|
+
#
|
1706
|
+
# script["id"] = existing_script["id"].to_s
|
1707
|
+
# end
|
1710
1708
|
|
1711
1709
|
data = {}
|
1712
1710
|
data["script"] = script
|
1713
1711
|
|
1714
|
-
if script_already_exists
|
1715
|
-
|
1716
|
-
|
1717
|
-
|
1718
|
-
else
|
1719
|
-
|
1712
|
+
# if script_already_exists
|
1713
|
+
# BrpmAuto.log "Updating the script..."
|
1714
|
+
# script = update_script_from_hash(script)
|
1715
|
+
# BrpmAuto.log "Script is updated."
|
1716
|
+
# else
|
1717
|
+
# BrpmAuto.log "Creating the script..."
|
1718
|
+
# script = create_script_from_hash(script)
|
1719
|
+
# BrpmAuto.log "Script is created."
|
1720
|
+
# end
|
1721
|
+
|
1722
|
+
BrpmAuto.log "Creating the script..."
|
1723
|
+
begin
|
1720
1724
|
script = create_script_from_hash(script)
|
1721
1725
|
BrpmAuto.log "Script is created."
|
1726
|
+
rescue Exception => e
|
1727
|
+
if "#{e}".include?("has already been taken")
|
1728
|
+
BrpmAuto.log "Script already exists, updating it..."
|
1729
|
+
script = update_script_from_hash(script)
|
1730
|
+
BrpmAuto.log "Script is updated."
|
1731
|
+
end
|
1722
1732
|
end
|
1723
1733
|
|
1724
1734
|
script
|