Completed
Pull Request — master (#466)
by
unknown
02:27
created

NcmConfigDownload   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 28
Duplicated Lines 0 %
Metric Value
dl 0
loc 28
rs 10
wmc 4

1 Method

Rating   Name   Duplication   Size   Complexity  
B run() 0 27 4
1
# Licensed to the StackStorm, Inc ('StackStorm') under one or more
2
# contributor license agreements.  See the NOTICE file distributed with
3
# this work for additional information regarding copyright ownership.
4
# The ASF licenses this file to You under the Apache License, Version 2.0
5
# (the "License"); you may not use this file except in compliance with
6
# the License.  You may obtain a copy of the License at
7
#
8
#     http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
16
from lib.actions import OrionBaseAction
17
18
19
class NcmConfigDownload(OrionBaseAction):
20
    def run(self, node, platform, configs):
21
        """
22
        Mostly completed! Download configurations via Solarwinds Orion NCM ....
23
24
        see https://github.com/solarwinds/OrionSDK/wiki/NCM-Config-Transfer
25
        """
26
27
        results = {}
28
        node_ids = []
29
30
        self.connect(platform)
31
32
        try:
33
            node_ids.append(self.get_ncm_node_id(node))
34
        except IndexError, msg:
35
            self.send_user_error("{}".format(msg))
36
            raise IndexError(msg)
37
        else:
38
            for config in configs:
39
                orion_data = self.invoke("Cirrus.ConfigArchive",
40
                                         "DownloadConfig",
41
                                         node_ids,
42
                                         config)
43
                transfer_id = orion_data[0]
44
                results[config] = self.get_ncm_transfer_results(transfer_id)
45
46
        return results
47