@@ -73,11 +73,25 @@ def pytest_generate_tests(metafunc):
73
73
74
74
@pytest .fixture (scope = "function" )
75
75
def appliance_preupdate (temp_appliance_preconfig_funcscope ):
76
- """Requests appliance from sprout and configures rpms for crud update
76
+ """Requests appliance from sprout and configures repos for crud update.
77
77
78
- To create the required repo (fresh-new (clean) CFME appliance required).
78
+ This function is using rpmrebuild to build a CFME with high version number to
79
+ force the update.
79
80
80
- register and attach the system to RHN
81
+ In the past, the rpmrebuild tool was used. The downside is that it is
82
+ quite ancient tool, not in any common repo and it may be necessary to build
83
+ it from SRPM if some deps are not met.
84
+
85
+ Note that it would certainly be posible to just take the SRPM of CFME
86
+ and rebuild them using rpmbuild instead of using the rpmrebuild.
87
+
88
+ To create the required repo with rpmrebuild:
89
+
90
+ # # A fresh-new (clean) CFME appliance required.
91
+ #
92
+ # # Register and attach the system to RHN
93
+ #
94
+ # # Define values to be used.
81
95
# SERVER=...redhat.com
82
96
# CFME_STREAM=5.10
83
97
#
@@ -110,17 +124,26 @@ def appliance_preupdate(temp_appliance_preconfig_funcscope):
110
124
pytest .skip ('Failed looking up rpmrebuild in cfme_data.basic_info' )
111
125
112
126
def run (c ):
113
- assert appliance .ssh_client .run_command (c ).success
127
+ cmd = appliance .ssh_client .run_command (c )
128
+ assert cmd .success
129
+
130
+ rhsm_url = cfme_data ['redhat_updates' ]['registration' ]['rhsm' ]['url' ]
131
+ rhsm_username = conf .credentials ['rhsm' ]['username' ]
132
+ rhsm_password = conf .credentials ['rhsm' ]['password' ]
114
133
134
+ run (f'subscription-manager register '
135
+ f'--server { rhsm_url } --password { rhsm_password } --username { rhsm_username } ' )
136
+ run (f'subscription-manager attach' )
115
137
run (f'curl -o /etc/yum.repos.d/rpmrebuild.repo { url } ' )
116
138
run ('yum install rpmrebuild createrepo -y' )
117
139
run ('mkdir /myrepo' )
118
140
run ('rpmrebuild --release=99 cfme-appliance' )
119
141
run ('cp /root/rpmbuild/RPMS/x86_64/cfme-appliance-* /myrepo/' )
120
142
run ('createrepo /myrepo/' )
121
143
run ('echo '
122
- '"[local-repo]\n name=Internal repository\n baseurl=file:///myrepo/\n enabled=1\n gpgcheck=0"'
144
+ '"[local-repo]\n name=Local repository\n baseurl=file:///myrepo/\n enabled=1\n gpgcheck=0"'
123
145
' > /etc/yum.repos.d/local.repo' )
146
+ run (f'subscription-manager clean' )
124
147
yield appliance
125
148
126
149
0 commit comments