You are VERY correct spacewalk-clone-by-date is the way to go. Here is what I’m 
using.  The script is run out of cron on the first of the month. YMMV
One thing is the error message from the parser is “Configuration file is 
invalid, please check syntax.” Not useful at fixing issues.


#! /bin/sh



cd /var/satellite/local-scripts/cloner



MONTH=`/bin/date --date="yesterday" +%B` FDATE=`/bin/date --date="yesterday" 
+%F`



LMONTH=`echo $MONTH | tr '[:upper:]' '[:lower:]'` CONF_FILE=${MONTH}_freeze.conf



# echo ${MONTH} ${LMONTH} ${FDATE} ${CONF_FILE} # read Foo



cat > $CONF_FILE <<EOF

{

    "username":       "username",

    "password":       "password",

    "to_date":        "${FDATE}",

    "assumeyes":       true,

    "use_update_date": true,

    "skip_depsolve":   false,

    "security_only":   false,

    "no_errata_sync":  false,

    "dry_run":         false,

    "blacklist": {

        "ALL": [

            ""

        ]

    },

    "removelist": {

        "ALL": [

           ""

        ]

    },

    "channels": [

        {

            "rhel-x86_64-server-6": {

                "label":       "${LMONTH}-rhel6-x86_64-server-6",

                "name":        "${MONTH} freeze of Red Hat Enterprise Linux (v. 
6 for 64-bit x86_64)",

                "summary":     "This is the patch cluster for ${MONTH}",

                "description": "Automated state freeze for Red Hat Enterprise 
Linux for the month of ${MONTH}",

                "existing-parent-do-not-modify": false

             },

            "rhn-tools-rhel-x86_64-server-6": {

                 "label":      "${LMONTH}-rhn-tools-rhel-x86_64-server-6",

                 "name":       "${MONTH} freeze of Red Hat Network Tools for 
RHEL Server (v6 64-bit x86)",

                 "summary":    "${MONTH} freeze of Red Hat Network Tools for 
RHEL Server (v6 64-bit x86)"

            },

            "rhel-x86_64-server-6-rhscl-1": {

                        "label":       "${LMONTH}-rhel-x86_64-server-6-rhscl-1",

                                "name":        "${MONTH} freeze of Red Hat 
Software Collections 1 (RHEL 6 Server x86_64)",

                                "summary":     "${MONTH} freeze of Red Hat 
Software Collections 1 (RHEL 6 Server x86_64)"

                    },

            "rhel-x86_64-server-optional-6": {

                        "label":       
"${LMONTH}-rhel-x86_64-server-optional-6",

                        "name":        "${MONTH} freeze of Red Hat Enterprise 
Linux Server Optional (v. 6 64-bit x86_64)",

                        "summary":     "${MONTH} freeze of Red Hat Enterprise 
Linux Server Optional (v. 6 64-bit x86_64)"

                    },

            "epel_rhel6_x86_64": {

                        "label":       "${LMONTH}-epel_rhel6_x86_64",

                                "name":        "${MONTH} freeze of EPEL for Red 
Hat Enterprise Linux 6",

                "summary":     "Extra Packages for Enterprise Linux 6 for 
${MONTH}"

                    },

            "pgdg93_rhel6_x86_64": {

                        "label":       "${LMONTH}-pgdg93_rhel6_x86_64",

                                "name":        "${MONTH} freeze of PostgreSQL 
9.3 for Red Hat Enterprise Linux 6",

                                "summary":     "${MONTH} freeze of PostgreSQL 
9.3 for Red Hat Enterprise Linux 6"

                    },

            "puppetlabs-pepackages-6server-x86_64": {

                "label":       "${LMONTH}-puppetlabs-pepackages-6server-x86_64",

                "name":        "${MONTH} freeze of Puppet Labs PE Packages for 
RHEL 6",

                "summary":     "${MONTH} freeze of Puppet Labs PE Packages for 
RHEL 6"

            }

        },

        {

            "rhel-x86_64-server-5":  {

                "label":       "${LMONTH}-freeze-rhel5-x86_64-server-5",

                "name":        "${MONTH} freeze of Red Hat Enterprise Linux (v. 
5 for 64-bit x86_64)",

                "summary":     "This is the patch cluster for ${MONTH}",

                "description": "Automated state freeze for Red Hat Enterprise 
Linux for the month of ${MONTH}",

                "existing-parent-do-not-modify": false

            },

            "rhn-tools-rhel-x86_64-server-5": {

                 "label":      "${LMONTH}-rhn-tools-rhel-x86_64-server-5",

                 "name":       "${MONTH} freeze of Red Hat Network Tools for 
RHEL Server (v5 64-bit x86_64)",

                 "summary":    "${MONTH} freeze of Red Hat Network Tools for 
RHEL Server (v5 64-bit x86_64)"

            },

            "rhel-x86_64-server-supplementary-5": {

                "label":      "${LMONTH}-rhel-x86_64-server-supplementary-5",

                 "name":       "${MONTH} freeze of RHEL Supplementary (v. 5 for 
64-bit x86_64)",

                 "summary":    "${MONTH} freeze of RHEL Supplementary (v. 5 for 
64-bit x86_64)"

            }

        },

        {

            "rhel-i386-server-5":  {

                "label":       "${LMONTH}-freeze-rhel5-i386-server-5",

                "name":        "${MONTH} freeze of Red Hat Enterprise Linux (v. 
5 for 32-bit i386)",

                "summary":     "This is the patch cluster for ${MONTH}",

                "description": "Automated state freeze for Red Hat Enterprise 
Linux for the month of ${MONTH}",

                "existing-parent-do-not-modify": false

            },

            "rhn-tools-rhel-i386-server-5": {

                 "label":      "${LMONTH}-rhn-tools-rhel-i386-server-5",

                 "name":       "${MONTH} freeze of Red Hat Network Tools for 
RHEL Server (v5 32-bit x86)",

                 "summary":    "${MONTH} freeze of Red Hat Network Tools for 
RHEL Server (v5 32-bit x86)"

            },

            "rhel-i386-server-supplementary-5": {

                 "label":      "${LMONTH}-rhel-i386-server-supplementary-5",

                 "name":       "${MONTH} freeze of RHEL Supplementary (v. 5 for 
32-bit x86)",

                 "summary":    "${MONTH} freeze of RHEL Supplementary (v. 5 for 
32-bit x86)"

            }

        },

        {

            "rhel-x86_64-server-7": {

                "label":       "${LMONTH}-rhel7-x86_64-server-7",

                "name":        "${MONTH} freeze of Red Hat Enterprise Linux (v. 
7 for 64-bit x86_64)",

                "summary":     "This is the patch cluster for ${MONTH}",

                "description": "Automated state freeze for Red Hat Enterprise 
Linux for the month of ${MONTH}",

                "existing-parent-do-not-modify": false

            },

            "rhn-tools-rhel-x86_64-server-7": {

                "label":      "${LMONTH}-rhn-tools-rhel-x86_64-server-7",

                "name":       "${MONTH} freeze of Red Hat Network Tools for 
RHEL Server (v7 64-bit x86)",

                "summary":    "${MONTH} freeze of Red Hat Network Tools for 
RHEL Server (v7 64-bit x86)"

            },

            "rhel-x86_64-server-7-rhscl-1": {

                        "label":       "${LMONTH}-rhel-x86_64-server-7-rhscl-1",

                                "name":        "${MONTH} freeze of Red Hat 
Software Collections 1 (RHEL 7 Server x86_64)",

                                "summary":     "${MONTH} freeze of Red Hat 
Software Collections 1 (RHEL 7 Server x86_64)"

                    },

            "rhel-x86_64-server-optional-7": {

                        "label":       
"${LMONTH}-rhel-x86_64-server-optional-7",

                        "name":        "${MONTH} freeze of Red Hat Enterprise 
Linux Server Optional (v. 7 64-bit x86_64)",

                        "summary":     "${MONTH} freeze of Red Hat Enterprise 
Linux Server Optional (v. 7 64-bit x86_64)"

                    },

            "rhel-x86_64-server-extras-7": {

                "label":       "${LMONTH}-rhel-x86_64-server-extras-7",

                "name":        "${MONTH} freeze of RHEL Server Extras (v. 7 for 
64-bit x86_64)",

                "summary":     "${MONTH} freeze of RHEL Server Extras (v. 7 for 
64-bit x86_64)"

            },

            "rhel-x86_64-server-supplementary-7": {

                "label":       "${LMONTH}-rhel-x86_64-server-supplementary-7",

                "name":        "${MONTH}  RHEL Server Supplementary (v. 7 for 
64-bit x86_64)",

                "summary":     "${MONTH}  RHEL Server Supplementary (v. 7 for 
64-bit x86_64)"

            },

            "epel_rhel7_x86_64": {

                "label":       "${LMONTH}-epel_rhel7_x86_64",

                "name":        "${MONTH} freeze of EPEL for Red Hat Enterprise 
Linux 7",

                "summary":     "Extra Packages for Enterprise Linux 7 for 
${MONTH}"

            },

            "pgdg93_rhel7_x86_64": {

                "label":       "${LMONTH}-pgdg93_rhel7_x86_64",

                "name":        "${MONTH} freeze of PostgreSQL 9.3 for Red Hat 
Enterprise Linux 7",

                "summary":     "${MONTH} freeze of PostgreSQL 9.3 for Red Hat 
Enterprise Linux 7"

            },

            "puppetlabs-pepackages-7server-x86_64": {

                "label":       "${LMONTH}-puppetlabs-pepackages-7server-x86_64",

                "name":        "${MONTH} freeze of Puppet Labs PE Packages for 
RHEL 7",

                "summary":     "${MONTH} freeze of Puppet Labs PE Packages for 
RHEL 7"

            }

        }

    ]

}

EOF



/usr/bin/spacewalk-clone-by-date --config=${CONF_FILE} && rm -f ${CONF_FILE}



Regards,

Darryl

From: [email protected] 
[mailto:[email protected]] On Behalf Of Waldirio Manhães 
Pinheiro
Sent: Friday, May 29, 2015 12:02 AM
To: [email protected]
Subject: Re: [Spacewalk-list] Cloning channel from script

Hello All

Darryl, my recommendation is use spacewalk-clone-by-date, you have two ways, 
the first one is define all parameters in a single line "beautiful", the second 
and I really prefer, is create a template, you will execute the command 
spacewalk-clone-by-date using the flag -m

###
-m --sample-config
Generate a sample configuration file
###

So you will define all that you would like in your channels (base, child, 
dates, etc) and execute the command again with flag -c

###
-c FILE, --config=FILE
Configuration file holding parameters, see --sample-config for an example.Any 
command-line parameters override those in specified config file.
###

Enjoy

Take Care

______________
Atenciosamente
Waldirio
msn: [email protected]<mailto:[email protected]>
Skype: waldirio
Site: www.waldirio.com.br<http://www.waldirio.com.br>
Blog: blog.waldirio.com.br<http://blog.waldirio.com.br>
LinkedIn: http://br.linkedin.com/pub/waldirio-pinheiro/22/b21/646
PGP: www.waldirio.com.br/public.html<http://www.waldirio.com.br/public.html>

On Wed, May 13, 2015 at 11:24 AM, Matt Micene 
<[email protected]<mailto:[email protected]>> wrote:
That’s the expected behavior of the spacewalk-create-channel tool as far as I 
can tell.  The tool reads files in /usr/share/rhn/channel_data to determine the 
RPM list that was create at issue date of a particular release (RHEL 6 Update 6 
for example).  The tool will only work on channels that were on the 
distribution ISO and it looks like there’s some hidden syntactic sugar as well 
(from my local testing).  So you get only the package published at the time of 
release, no updates.

If you want to clone a channel and all the errata, you’re probably better off 
looking at spacewalk-clone-by-date.  You can provide a date to clone errata up 
to, and you can clone channels that aren’t part of the ISO (like rhn-tools).

The syntax is pretty simple spacewalk-clone-by-date –l RHT-channel my-channel 
–d DATE is the basics, and you can automate it with a config file (-m will 
print a sample file).  I wrote about using the tool for work:   
http://blogs.dlt.com/content-workflow-rhn-satellite/

HTH,
Matt


Matt Micene
DLT Solutions
Solution Architect
RHCA# 100-002-435
Direct 703-773-1195

From: 
[email protected]<mailto:[email protected]> 
[mailto:[email protected]<mailto:[email protected]>]
 On Behalf Of Darryl Baker
Sent: Tuesday, May 12, 2015 3:24 PM

To: [email protected]<mailto:[email protected]>
Subject: Re: [Spacewalk-list] Cloning channel from script

I’ve been playing a bit with the spacewalk-create-channel command. Two things 
I’ve noticed:

You must specify the update level and there is no way that I can find to just 
select the “latest update.”

Then once I make the clone the GUI shows no errata in the new channel whereas 
when I make the clone through the RHSS console the channel has a list of them.

I would like to just say the latest update and see the errata attached to the 
clone. Anyone have any thoughts?

Regards,

Darryl

From: 
[email protected]<mailto:[email protected]> 
[mailto:[email protected]<mailto:[email protected]>]
 On Behalf Of Darryl Baker
Sent: Tuesday, May 12, 2015 9:12 AM
To: [email protected]<mailto:[email protected]>
Subject: Re: [Spacewalk-list] Cloning channel from script

I’m only doing a few hundred machines at the moment but we are growing fast. 
Scripts to modify the channels systems are using as well as making the channel 
clones would be great. Thank you for offering. If You would post the collection 
to GitHub, please.


Regards,

Darryl

From: 
[email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Franky Van Liedekerke
Sent: Tuesday, May 12, 2015 1:04 AM
To: [email protected]<mailto:[email protected]>
Subject: Re: [Spacewalk-list] Cloning channel from script

I have several perl scripts that do all that: create new cloned channels, 
subscribe servers to the new channels, update kickstart profiles and activation 
keys.
Even a extra web interface in php and perl crontab to manage the patching of 
thousands of servers via spacewalk.
If interested, I can put them on github ...

Franky
Darryl Baker 
<[email protected]<mailto:[email protected]>> schreef op 
11 mei 2015 17:08:53 CEST:
I’m using Red Hat Satellite 5.7. Each month I clone the distribution channels 
so I can have sets of machines at the identical patch level and those patches 
can be worked through the testing cycle before being applied in production. 
Currently I am doing this manually through the GUI. A mindless, time consuming 
thing. I would like to set up scripts to do this for me. Any clues on how to do 
this will be much appreciated.






Regards,


Darryl Baker
Textura Corporation
Linux Engineer Application Support
1405 Lake Cook Road
Deerfield, Illinois 60015
Office Phone - 847-235-8467
Email – [email protected]<mailto:[email protected]>
[Image removed by sender. cid:05DC2306-1083-4864-A07C-DE5DA45A6302]



________________________________

Spacewalk-list mailing list
[email protected]<mailto:[email protected]>
https://www.redhat.com/mailman/listinfo/spacewalk-list

_______________________________________________
Spacewalk-list mailing list
[email protected]<mailto:[email protected]>
https://www.redhat.com/mailman/listinfo/spacewalk-list

_______________________________________________
Spacewalk-list mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/spacewalk-list

Reply via email to