Package org.fedorahosted.cobbler.autogen

Examples of org.fedorahosted.cobbler.autogen.Distro


                Repo repo = repoEntry.getKey();
                String repoName = repo.getName();

                for (Distribution distribution : repoEntry.getValue().values()) {

                    Distro existingCobblerDistro = cobblerDistros.get(distribution.getLabel());
                    Distro desiredCobblerDistro = instantiateCobblerDistro(conn, distribution, repoName, rootUrl);

                    if (existingCobblerDistro != null) {
                        // cobbler already has a distro with the name we are looking for.
                        // let's make sure its data is the same, otherwise, we need to upgrade it.
                        // but first, we need to take it out of our map, because whatever is left in this map will be removed from Cobbler later.
                        cobblerDistros.remove(existingCobblerDistro.getName());

                        if (!compareCobblerDistros(existingCobblerDistro, desiredCobblerDistro)) {
                            // the one Cobbler has is old and needs to be updated with the latest data.
                            updateCobblerDistro(existingCobblerDistro, desiredCobblerDistro);
                            existingCobblerDistro.commit();
                            log.info("Updated existing Cobbler distro [" + distribution.getLabel() + "]");
                        } else {
                            log.debug("Cobbler already has distro [" + distribution.getLabel() + "]; keeping it");
                        }
                    } else {
                        desiredCobblerDistro.commit();
                        log.info("Added new distro to Cobbler: [" + distribution.getLabel() + "]");
                    }
                }
            }
View Full Code Here


     * @return an instance of a Cobbler Distro object
     */
    private Distro instantiateCobblerDistro(CobblerConnection conn, Distribution distribution, String repoName,
        String rootUrl) {

        Distro cobblerDistro;
        String distroRootUrl = rootUrl + repoName + "/distributions/" + distribution.getLabel();
        String kernel = distroRootUrl + "/images/pxeboot/vmlinuz"; // TODO what about other arches
        String initrd = distroRootUrl + "/images/pxeboot/initrd.img"; // TODO what about other arches
        String ksTree = distroRootUrl;

        cobblerDistro = new Distro(conn);
        cobblerDistro.setName(distribution.getLabel());
        cobblerDistro.setComment(COMMENT_MARKER + " " + distribution.getLabel());
        cobblerDistro.setKernel(kernel);
        cobblerDistro.setInitrd(initrd);
        Map<String, String> ksmeta = new HashMap<String, String>();
        ksmeta.put("tree", ksTree);
        cobblerDistro.setKsMeta(ksmeta);

        return cobblerDistro;
    }
View Full Code Here

TOP

Related Classes of org.fedorahosted.cobbler.autogen.Distro

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.