Esempio n. 1
0
    def populate_appliance_feeds(self):
        # fetch the feed confs from the catalog sources
        # currently catalog provides simple name space for placing
        # files not surfaced anywhere else in the model.

        feeds = {}  #store the feeds from all catalogs
        for c, c_info in self.catalogs.iteritems():
            print c, c_info
            if type(c_info) in [types.StringType, types.UnicodeType]:
                url = c_info
            # the c_info can be tuple containing other rich info
            # like proxy class to download etc. TBD
            try:
                feed_conf = self.fetch_catalog(c, url)
            except Exception, ex:
                feed_conf = self.get_conf_name(c)
                print "Error getting catalog ", c, url, ex
                #print "Will try to use ", feed_conf
                print "Continue using the existing data"
                continue

            if not os.path.exists(feed_conf):
                print "Skipping : %s does not exist.", feed_conf
                continue


#            if not self._feeds:
#                self._feeds = PyConfig(self.local_node, feed_conf)
#            else:
# merge the current feed data
            feed = PyConfig(self.local_node, feed_conf)
            for k, v in feed.iteritems():
                feeds[k] = v
Esempio n. 2
0
    def populate_appliance_feeds(self):
        # fetch the feed confs from the catalog sources
        # currently catalog provides simple name space for placing
        # files not surfaced anywhere else in the model.

        feeds = {}  # store the feeds from all catalogs
        for c, c_info in self.catalogs.iteritems():
            print c, c_info
            if type(c_info) in [types.StringType, types.UnicodeType]:
                url = c_info
            # the c_info can be tuple containing other rich info
            # like proxy class to download etc. TBD
            try:
                feed_conf = self.fetch_catalog(c, url)
            except Exception, ex:
                feed_conf = self.get_conf_name(c)
                print "Error getting catalog ", c, url, ex
                # print "Will try to use ", feed_conf
                print "Continue using the existing data"
                continue

            if not os.path.exists(feed_conf):
                print "Skipping : %s does not exist.", feed_conf
                continue

            #            if not self._feeds:
            #                self._feeds = PyConfig(self.local_node, feed_conf)
            #            else:
            # merge the current feed data
            feed = PyConfig(self.local_node, feed_conf)
            for k, v in feed.iteritems():
                feeds[k] = v